brickA macro for loading and displaying 3D objects in XWiki.
TypeXAR
CategoryMacro
Developed by

Fawad Ali

Active Installs1
Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

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

sample1.png

A file with custom height and width

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

Using the current page's attachment

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

Result

sample2.png

Using a different page's attachment

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

{{three attachmentRef="[email protected]" /}}
{{three attachmentRef="wiki:[email protected]" /}}

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" /}}

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="[email protected]" disableControls="true" type="gltf" defaultZoomOut="5" /}}

Loading multiple files

This will load multiple objects on the same canvas.

{{three attachmentRef="file1.obj, file2.gltf, [email protected]" 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:[email protected], [email protected], 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.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.3

v1.2

v1.1

v1.0

Dependencies

Dependencies for this extension (org.xwiki.contrib:macro-three 1.3):

  • org.webjars.npm:three 0.121.1
Tags:
    

Get Connected