Wiki source code of Three Macro
Last modified by wiki.ROBOT.ru on 2026/02/15 16:28
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
| 2 | {{toc/}} | ||
| 3 | {{/box}} | ||
| 4 | |||
| 5 | == Description == | ||
| 6 | |||
| 7 | A macro for loading and displaying 3D objects in XWiki. | ||
| 8 | |||
| 9 | == Usage == | ||
| 10 | |||
| 11 | === A file with custom background === | ||
| 12 | |||
| 13 | {{code}} | ||
| 14 | {{three ref="http://example.com/path/to/file.gltf" background="#ffffff" /}} | ||
| 15 | {{/code}} | ||
| 16 | |||
| 17 | **Result** | ||
| 18 | |||
| 19 | {{three ref="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Box/glTF/Box.gltf" background="#ffffff" /}} | ||
| 20 | |||
| 21 | === A file with custom height and width === | ||
| 22 | |||
| 23 | {{code}} | ||
| 24 | {{three ref="http://example.com/path/to/file.gltf" width="100%" height="600px" /}} | ||
| 25 | {{/code}} | ||
| 26 | |||
| 27 | **Result** | ||
| 28 | |||
| 29 | {{three ref="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Box/glTF/Box.gltf" width="100%" height="600px" /}} | ||
| 30 | |||
| 31 | === Using the current page's attachment === | ||
| 32 | |||
| 33 | {{code}} | ||
| 34 | {{three attachmentRef="bar.gltf" /}} | ||
| 35 | {{/code}} | ||
| 36 | |||
| 37 | **Result** | ||
| 38 | |||
| 39 | {{three attachmentRef="bar.gltf" /}} | ||
| 40 | |||
| 41 | === Using a different page's attachment === | ||
| 42 | |||
| 43 | This will look for an attachment named "file.obj" in the specified page. | ||
| 44 | |||
| 45 | {{code}} | ||
| 46 | {{three attachmentRef="Space.Page@file.obj" /}} | ||
| 47 | {{three attachmentRef="wiki:Space.Page@file.obj" /}} | ||
| 48 | {{/code}} | ||
| 49 | |||
| 50 | === Auto rotate the camera === | ||
| 51 | |||
| 52 | This will auto rotate the camera around the object. A custom (optional) auto rotate speed can also be set. | ||
| 53 | |||
| 54 | {{code}} | ||
| 55 | {{three attachmentRef="bar.gltf" autoRotate="true" autoRotateSpeed="20" /}} | ||
| 56 | {{/code}} | ||
| 57 | |||
| 58 | **Result** | ||
| 59 | |||
| 60 | {{three attachmentRef="bar.gltf" autoRotate="true" autoRotateSpeed="20" /}} | ||
| 61 | |||
| 62 | === Disable controls with custom zoom out === | ||
| 63 | |||
| 64 | This will disable the controls and will not allow users to move around in the scene. | ||
| 65 | It will also set a custom initial distance from the object. | ||
| 66 | |||
| 67 | {{code}} | ||
| 68 | {{three attachmentRef="Macros.ThreeMacro.WebHome@bar.gltf" disableControls="true" type="gltf" defaultZoomOut="5" /}} | ||
| 69 | {{/code}} | ||
| 70 | |||
| 71 | **Result** | ||
| 72 | |||
| 73 | {{three attachmentRef="Macros.ThreeMacro.WebHome@bar.gltf" disableControls="true" type="gltf" defaultZoomOut="5" /}} | ||
| 74 | |||
| 75 | === Loading multiple files === | ||
| 76 | |||
| 77 | This will load multiple objects on the same canvas. | ||
| 78 | |||
| 79 | {{code}} | ||
| 80 | {{three attachmentRef="file1.obj, file2.gltf, Space.Page@file3.gltf" ref="http://url.com/file1.gltf, http://url.com/file2.gltf" /}} | ||
| 81 | {{/code}} | ||
| 82 | |||
| 83 | == Parameters == | ||
| 84 | |||
| 85 | |=Name|=Mandatory|=(% style="width:15%" %)Values|=Default|=Description | ||
| 86 | |**ref**|**No**|*||Reference to 3D object files to load from URL separated by comma. Supported formats are .obj, .gltf. | ||
| 87 | |**attachmentRef**|**No**|*||Reference to 3D object files to load from attachments separated by comma. Supported formats are .obj, .gltf. | ||
| 88 | **Syntax:** wiki:Space.Page@attachment.gltf, Space.Page@attachment.gltf, attachment.gltf | ||
| 89 | |**type**|**No**|obj/gltf||Type of the object. Supported types are .obj, .gltf. | ||
| 90 | |**width**|**No**|[0-9]+px or % |100%|Width of the canvas. | ||
| 91 | |**height**|**No**|[0-9]+px or % |400px|Height of the canvas. | ||
| 92 | |**defaultZoomOut**|**No**|[0-9]+|10|Default value of how zoomed out (far) the camera initially is from the object. | ||
| 93 | |**disableControls**|**No**|true/false|false|If the orbit controls used to move camera around the object should be disabled or not. | ||
| 94 | |**autoRotate**|**No**|true/false|false|If the camera should auto rotate around the object or not. | ||
| 95 | |**autoRotateSpeed**|**No**|[0-9]+||Speed of the auto rotate. | ||
| 96 | |**background**|**No**||#000000|Background color of the canvas. |