0.1.0 • Published 5 years ago

xr.js v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

xr.js

Make the integration with the ChromiumXR web browser simple and effective.

Getting Started

Include Three.js and the xr.min.js javascript file.

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/87/three.min.js"></script>
<script src="scripts/xr.min.js"></script>

In the body of your index.html create an <xr-mdl> tag and fill it with the required information

<xr-mdl obj="r2-d2.obj" mtl="r2-d2.mtl" texturePath="./r2d2/" scale="1,1,1" position="2,2,2"  desktop="true"></xr-mdl>

The <xr-mdl> tag supports the following attributes.

AttributeFunctionTypeExample
objSpecify the name to of the .obj file.Stringr2d2.obj
mtlSpecify the name to of the .mtl file.Stringr2d2.mtl
objSpecify the directory to the textures from.String./assets/r2d2/
desktopShow the model on the desktop as well. Defaults to false.Boolfalse
scaleSpecify the scale of the modelString1,1,1
positionSpecify the position of the modelString0,0,0
rotationSpecify the position of the modelString90,90,90

Run the Demo

Start the express server in the example directory.

$ cd example
$ npm install
$ npm start

Open http://localhost:8080 in the ChromiumXR Browser.

When viewed in the normal desktop browser the model will not be visible unless specified.

Info

The example loads an R2D2 model from a directory and displays it in 3D space when viewed with ChromiumXR.