Three Macro

Last modified by wiki.ROBOT.ru on 2026/02/15 16:28

Description

A macro for loading and displaying 3D objects in XWiki.

Usage

A file with custom background

{{three ref="http://example.com/path/to/file.gltf" background="#ffffff" /}}

Result

A file with custom height and width

{{three ref="http://example.com/path/to/file.gltf" width="100%" height="600px" /}}

Result

Using the current page's attachment

{{three attachmentRef="bar.gltf" /}}

Result

Using a different page's attachment

This will look for an attachment named "file.obj" in the specified page.

{{three attachmentRef="Space.Page@file.obj" /}}
{{three attachmentRef="wiki:Space.Page@file.obj" /}}

Auto rotate the camera

This will auto rotate the camera around the object. A custom (optional) auto rotate speed can also be set.

{{three attachmentRef="bar.gltf" autoRotate="true" autoRotateSpeed="20" /}}

Result

Disable controls with custom zoom out

This will disable the controls and will not allow users to move around in the scene.
It will also set a custom initial distance from the object.

{{three attachmentRef="Macros.ThreeMacro.WebHome@bar.gltf" disableControls="true" type="gltf" defaultZoomOut="5" /}}

Result

Loading multiple files

This will load multiple objects on the same canvas.

{{three attachmentRef="file1.obj, file2.gltf, Space.Page@file3.gltf" ref="http://url.com/file1.gltf, http://url.com/file2.gltf" /}}

Parameters

NameMandatoryValuesDefaultDescription
refNo*Reference to 3D object files to load from URL separated by comma. Supported formats are .obj, .gltf.
attachmentRefNo*Reference to 3D object files to load from attachments separated by comma. Supported formats are .obj, .gltf.
Syntax: wiki:Space.Page@attachment.gltf, Space.Page@attachment.gltf, attachment.gltf
typeNoobj/gltfType of the object. Supported types are .obj, .gltf.
widthNo[0-9]+px or % 100%Width of the canvas.
heightNo[0-9]+px or % 400pxHeight of the canvas.
defaultZoomOutNo[0-9]+10Default value of how zoomed out (far) the camera initially is from the object.
disableControlsNotrue/falsefalseIf the orbit controls used to move camera around the object should be disabled or not.
autoRotateNotrue/falsefalseIf the camera should auto rotate around the object or not.
autoRotateSpeedNo[0-9]+Speed of the auto rotate.
backgroundNo#000000Background color of the canvas.