diff --git a/build/karma.conf.js b/build/karma.conf.js index 78185f0be..100efa19e 100644 --- a/build/karma.conf.js +++ b/build/karma.conf.js @@ -3,7 +3,7 @@ const webpackConfig = require('./webpack.karma.config'); const DOC_STATIC_ASSETS_VERSION = '0.130.0'; const MEDIA_STATIC_ASSETS_VERSION = '0.127.0'; -const MODEL3D_STATIC_ASSETS_VERSION = '0.125.0'; +const MODEL3D_STATIC_ASSETS_VERSION = '1.1.1'; const SWF_STATIC_ASSETS_VERSION = '0.112.0'; const TEXT_STATIC_ASSETS_VERSION = '0.114.0'; diff --git a/src/lib/constants.js b/src/lib/constants.js index d196ae208..3e234eac2 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -80,7 +80,7 @@ export const X_REP_HINT_VIDEO_MP4 = '[mp4]'; // whenever a file in that third party directory is updated export const DOC_STATIC_ASSETS_VERSION = '0.130.0'; export const MEDIA_STATIC_ASSETS_VERSION = '0.127.0'; -export const MODEL3D_STATIC_ASSETS_VERSION = '0.125.0'; +export const MODEL3D_STATIC_ASSETS_VERSION = '1.1.1'; export const SWF_STATIC_ASSETS_VERSION = '0.112.0'; export const TEXT_STATIC_ASSETS_VERSION = '0.114.0'; diff --git a/src/third-party/model3d/1.1.1/WebVR/VRConfig.js b/src/third-party/model3d/1.1.1/WebVR/VRConfig.js new file mode 100644 index 000000000..0eb492f0e --- /dev/null +++ b/src/third-party/model3d/1.1.1/WebVR/VRConfig.js @@ -0,0 +1,49 @@ +window.WebVRConfig = { + // Forces availability of VR mode, even for non-mobile devices. + FORCE_ENABLE_VR: false, + + // Complementary filter coefficient. 0 for accelerometer, 1 for gyro. + K_FILTER: 0.98, + + // How far into the future to predict during fast motion (in seconds). + PREDICTION_TIME_S: 0.040, + + // Flag to disable touch panner. In case you have your own touch controls. + TOUCH_PANNER_DISABLED: false, + + // Flag to disabled the UI in VR Mode. + CARDBOARD_UI_DISABLED: false, // Default: false + + // Flag to disable the instructions to rotate your device. + ROTATE_INSTRUCTIONS_DISABLED: false, // Default: false. + + // Enable yaw panning only, disabling roll and pitch. This can be useful + // for panoramas with nothing interesting above or below. + YAW_ONLY: false, + + // To disable keyboard and mouse controls, if you want to use your own + // implementation. + MOUSE_KEYBOARD_CONTROLS_DISABLED: true, + + // Prevent the polyfill from initializing immediately. Requires the app + // to call InitializeWebVRPolyfill() before it can be used. + DEFER_INITIALIZATION: false, + + // Enable the deprecated version of the API (navigator.getVRDevices). + ENABLE_DEPRECATED_API: false, + + // Scales the recommended buffer size reported by WebVR, which can improve + // performance. + // UPDATE(2016-05-03): Setting this to 0.5 by default since 1.0 does not + // perform well on many mobile devices. + BUFFER_SCALE: 0.5, + + // Allow VRDisplay.submitFrame to change gl bindings, which is more + // efficient if the application code will re-bind its resources on the + // next frame anyway. This has been seen to cause rendering glitches with + // THREE.js. + // Dirty bindings include: gl.FRAMEBUFFER_BINDING, gl.CURRENT_PROGRAM, + // gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING, + // and gl.TEXTURE_BINDING_2D for texture unit 0. + DIRTY_SUBMIT_FRAME_BINDINGS: false +}; diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/1024/1.jpg b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/1024/1.jpg new file mode 100644 index 000000000..33d19d196 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/1024/1.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/256/3.jpg b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/256/3.jpg new file mode 100644 index 000000000..3346c0f14 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/256/3.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/512/2.jpg b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/512/2.jpg new file mode 100644 index 000000000..e82fb15b5 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/512/2.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/1.jpg b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/1.jpg new file mode 100644 index 000000000..f73d37448 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/1.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/2.jpg b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/2.jpg new file mode 100644 index 000000000..2cfca3cda Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/64/2.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/entities.json b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/entities.json new file mode 100644 index 000000000..b1ba4339c --- /dev/null +++ b/src/third-party/model3d/1.1.1/WebVR/oculusTouchCommon/entities.json @@ -0,0 +1,439 @@ +{ + "version": { + "major": 4, + "minor": 3 + }, + "entities": [ + { + "type": "image", + "id": "db74915f-8690-4d31-a810-efd0a3600fb8", + "sid": "external_controller01_col.png", + "properties": { + "name": "external_controller01_col.png", + "filename": "external_controller01_col.png", + "width": 1024, + "height": 1024, + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "channels": [ + "red", + "green", + "blue" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "./1024/1.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 77971, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 1024, + "height": 1024, + "sequenceLength": 1 + }, + { + "src": "./64/1.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 4783, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "db74915f-8690-4d31-a810-efd0a3600fb8" + }, + { + "type": "image", + "id": "97de432b-163e-4ecf-ae1f-7d2febcfdfed", + "sid": "external_controller01_spec.png", + "properties": { + "name": "external_controller01_spec.png", + "filename": "external_controller01_spec.png", + "width": 512, + "height": 512, + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "channels": [ + "red", + "green", + "blue" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "./512/2.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 54217, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 512, + "height": 512, + "sequenceLength": 1 + }, + { + "src": "./64/2.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 6055, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "97de432b-163e-4ecf-ae1f-7d2febcfdfed" + }, + { + "type": "texture2D", + "id": "462e107c-784b-4354-ab8b-f944b95f3e12", + "sid": "26", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "external_controller01_col.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "db74915f-8690-4d31-a810-efd0a3600fb8" + }, + "parentId": null, + "parentAssetId": "462e107c-784b-4354-ab8b-f944b95f3e12" + }, + { + "type": "texture2D", + "id": "70626ebd-f9a2-4a39-b7d7-25335f14253e", + "sid": "26", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "external_controller01_spec.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "97de432b-163e-4ecf-ae1f-7d2febcfdfed" + }, + "parentId": null, + "parentAssetId": "70626ebd-f9a2-4a39-b7d7-25335f14253e" + }, + { + "type": "material", + "id": "0887b8e2-1212-468a-85ab-da754ae9b2d5", + "sid": "27", + "properties": { + "shadingModel": "phong", + "transparencyFactor": 0, + "displacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "bump": { + "r": 0, + "b": 0, + "g": 0 + }, + "reflectionFactor": 1, + "shininess": 300, + "vectorDisplacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "emissive": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambient": { + "r": 0, + "b": 0, + "g": 0 + }, + "normalMap": { + "r": 0, + "b": 0, + "g": 0 + }, + "diffuse": { + "r": 1, + "b": 1, + "g": 1 + }, + "reflection": { + "r": 0, + "b": 0, + "g": 0 + }, + "displacementFactor": 1, + "transparentColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambientFactor": 1, + "diffuseFactor": 1, + "specularFactor": 1, + "specular": { + "r": 1, + "b": 1, + "g": 1 + }, + "diffuseTexture": "462e107c-784b-4354-ab8b-f944b95f3e12", + "shininessTexture": "70626ebd-f9a2-4a39-b7d7-25335f14253e", + "vectorDisplacementFactor": 1, + "emissiveFactor": 1, + "bumpFactor": 1, + "name": "external_contoller_01:blinn1SG" + }, + "parentId": null, + "parentAssetId": "0887b8e2-1212-468a-85ab-da754ae9b2d5" + }, + { + "type": "primitiveGeometry", + "id": "63153186-0399-47d9-86ed-874b57b6f428", + "sid": "60", + "properties": { + "name": "Box Logo Geometry", + "type": "plane", + "sizeX": 0.025, + "sizeY": 0.0125 + } + }, + { + "type": "image", + "id": "db74915f-8690-4d31-a810-efd0a3600fb9", + "sid": "box_logo.jpeg", + "properties": { + "name": "box_logo.jpeg", + "filename": "box_logo.jpeg", + "width": 256, + "height": 128, + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "channels": [ + "red", + "green", + "blue" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "./256/3.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 3265, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 256, + "height": 128, + "sequenceLength": 1 + } + ] + }, + { + "type": "texture2D", + "id": "462e107c-784b-4354-ab8b-f944b95f3e13", + "sid": "64", + "properties": { + "stream": false, + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "box_logo.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "db74915f-8690-4d31-a810-efd0a3600fb9" + } + }, + { + "type": "material", + "id": "0887b8e2-1212-468a-85ab-da754ae9b2d6", + "sid": "65", + "properties": { + "shadingModel": "phong", + "transparencyFactor": 0, + "displacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "bump": { + "r": 0, + "b": 0, + "g": 0 + }, + "reflectionFactor": 1, + "shininess": 0, + "vectorDisplacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "emissive": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambient": { + "r": 0, + "b": 0, + "g": 0 + }, + "normalMap": { + "r": 0, + "b": 0, + "g": 0 + }, + "diffuse": { + "r": 1, + "b": 1, + "g": 1 + }, + "reflection": { + "r": 0, + "b": 0, + "g": 0 + }, + "displacementFactor": 1, + "transparentColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambientFactor": 1, + "diffuseFactor": 1, + "specularFactor": 0, + "specular": { + "r": 1, + "b": 1, + "g": 1 + }, + "transparentTexture": "462e107c-784b-4354-ab8b-f944b95f3e13", + "vectorDisplacementFactor": 1, + "emissiveFactor": 1, + "bumpFactor": 1, + "name": "box_logo_mat" + } + } + ] +} diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/entities.json b/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/entities.json new file mode 100644 index 000000000..edeecba88 --- /dev/null +++ b/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/entities.json @@ -0,0 +1,755 @@ +{ + "version": { + "major": 4, + "minor": 3 + }, + "entities": [ + { + "type": "meshGeometry", + "id": "0a8bb532-336d-4113-83ee-2bd0f01326ce", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#bf12e4ff-48d8-462e-8c1c-193287eaf08c" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#e87cc2de-0a06-456f-9bde-9631bcca367c" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#52abbde9-a91d-408a-8cc9-ac4ecf0bb154" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#e83e27e4-6b4c-4533-ac56-61d1cc8c7908", + "primitives": [ + { + "count": 27603, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.013945, + "x": 0.04478, + "z": 0.138579 + }, + "min": { + "y": -0.080107, + "x": -0.064815, + "z": 0.023973 + } + } + }, + "parentId": null, + "parentAssetId": "0a8bb532-336d-4113-83ee-2bd0f01326ce" + }, + { + "type": "prefab", + "id": "a0fb22a0-7840-42f6-85ae-6d81ac1ad840", + "sid": null, + "children": [ + "6f63ec4c-8e35-499a-9e7d-ecad3e33299d" + ], + "properties": { + "name": "Oculus Touch Left" + }, + "parentId": null, + "parentAssetId": "a0fb22a0-7840-42f6-85ae-6d81ac1ad840" + }, + { + "type": "node", + "id": "6f63ec4c-8e35-499a-9e7d-ecad3e33299d", + "sid": "9", + "properties": { + "position": { + "y": 0.036, + "x": -0.008, + "z": -0.04 + }, + "quaternion": { + "y": 0, + "x": 0.33709491700546734, + "z": 0, + "w": 0.9414706670571723 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Oculus Touch Left Root" + }, + "children": [ + "fcdd5e11-06d0-4bf3-ab5b-30e187ee7391", + "463ec05a-a22e-4ec2-9aa1-a5290cbe9e30", + "80641612-c204-4faa-9612-3432f0db4a7f", + "24fc6234-96f9-4d5a-8581-6e41c7a8c4ae", + "1e70959f-b2f7-4622-b3d8-99e130ed0dc9", + "392049ae-4d77-4880-8ead-f564c2c41b5b", + "af445b9b-ac22-475c-899b-510226375735", + "63153186-0399-47d9-86ed-874b57b6f430" + ], + "components": [ + { + "name": "VR Controller Animator", + "attributes": { + "buttons": [ + [{ + "movementType": "translate", + "mesh": "392049ae-4d77-4880-8ead-f564c2c41b5b", + "offset": { "x": 0, "y": -0.0005, "z": 0.0005} + }], + [{ + "movementType": "rotate", + "mesh": "af445b9b-ac22-475c-899b-510226375735", + "pivot": { "x": 0, "y": -0.02622, "z": 0.03769}, + "rotation": { "x": -0.31415926535898, "y": 0, "z": 0 } + }], + [{ + "movementType": "rotate", + "mesh": "1e70959f-b2f7-4622-b3d8-99e130ed0dc9", + "offset": { "x": -0.004, "y": 0, "z": 0}, + "pivot": { "x": 0.01, "y": 0.008, "z": 0.075}, + "rotation": { "x": 0, "y": -0.17453292519943, "z": 0 } + }], + [{ + "movementType": "translate", + "mesh": "80641612-c204-4faa-9612-3432f0db4a7f", + "offset": { "x": 0, "y": -0.001, "z": 0.001} + }], + [{ + "movementType": "translate", + "mesh": "24fc6234-96f9-4d5a-8581-6e41c7a8c4ae", + "offset": { "x": 0, "y": -0.001, "z": 0.001} + }], + [{ + "movementType": "translate", + "mesh": "null", + "offset": { "x": 0, "y": 0, "z": 0} + }] + ], + "axes": [ + [{ + "movementType": "rotate", + "mesh": "392049ae-4d77-4880-8ead-f564c2c41b5b", + "pivot": { "x": -0.00149, "y": -0.01393, "z": 0.05283 }, + "rotation": { "x": 0, "y": 0, "z": -0.5} + }], + [{ + "movementType": "rotate", + "mesh": "392049ae-4d77-4880-8ead-f564c2c41b5b", + "pivot": { "x": -0.00149, "y": -0.01393, "z": 0.05283 }, + "rotation": { "x": 0.5, "y": 0, "z": 0} + }] + ] + }, + "scriptId": "gamepad_animator" + } + ] + }, + { + "type": "mesh", + "id": "fcdd5e11-06d0-4bf3-ab5b-30e187ee7391", + "sid": "32", + "properties": { + "name": "Body", + "geometryId": "0a8bb532-336d-4113-83ee-2bd0f01326ce", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "6f63ec4c-8e35-499a-9e7d-ecad3e33299d", + "parentAssetId": "a0fb22a0-7840-42f6-85ae-6d81ac1ad840" + }, + { + "type": "meshGeometry", + "id": "e4d961a4-aedc-404c-bcb6-9721ec653679", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#08b3adc7-e075-4824-b2c1-62a1c4b8dc93" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#a1cb2cee-74cb-4b8e-9590-8f0473ec0c0a" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#82822bcf-2751-406a-8e18-2321cb0533c3" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#c8f7035c-d499-4b93-8a58-99c6d29902fe", + "primitives": [ + { + "count": 864, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.006992, + "x": 8.13E-4, + "z": 0.067223 + }, + "min": { + "y": 2.73E-4, + "x": -0.008225, + "z": 0.059438 + } + } + }, + "parentId": null, + "parentAssetId": "e4d961a4-aedc-404c-bcb6-9721ec653679" + }, + { + "type": "mesh", + "id": "463ec05a-a22e-4ec2-9aa1-a5290cbe9e30", + "sid": "33", + "properties": { + "name": "Oculus Menu", + "geometryId": "e4d961a4-aedc-404c-bcb6-9721ec653679", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "70e9fb0f-4abd-47f1-8977-3bf23cc8a871", + "parentAssetId": "7f15546b-af72-4e9c-b6fa-accf0b800a02" + }, + { + "type": "meshGeometry", + "id": "306c4219-44bf-4d6a-81b1-9f44fa0314fb", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#706b8722-3ab5-412c-b6c3-9dccc0ce8cf3" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#fbd237e8-f4e8-49e3-908d-c139ab812306" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#b9c7e793-f333-40da-86d6-3cd27d7cfb38" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#bc75a166-2c38-41b4-81f0-fda81332e204", + "primitives": [ + { + "count": 1248, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.003812, + "x": 0.016053, + "z": 0.062682 + }, + "min": { + "y": -0.003911, + "x": 0.006087, + "z": 0.053844 + } + } + }, + "parentId": null, + "parentAssetId": "306c4219-44bf-4d6a-81b1-9f44fa0314fb" + }, + { + "type": "mesh", + "id": "80641612-c204-4faa-9612-3432f0db4a7f", + "sid": "34", + "properties": { + "name": "Button X", + "geometryId": "306c4219-44bf-4d6a-81b1-9f44fa0314fb", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11e35bc8-2fe8-46bb-93f7-60d215f04d71", + "parentAssetId": "4b655f7c-59a9-46fd-86bb-28fbe07c01b7" + }, + { + "type": "meshGeometry", + "id": "2330a720-b7b2-4370-b479-04ec8b9768a4", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#19b7a5d0-4b24-4757-b687-9d8fc71fe2dc" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#c5bf7e01-dce9-4347-b47b-3adc8c5538a5" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#11f81298-fe6c-4e4b-ac03-a024640861b7" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#c4d7ac4c-bd31-47c3-b273-a43110ba25e4", + "primitives": [ + { + "count": 1248, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.004784, + "x": 0.0223, + "z": 0.052217 + }, + "min": { + "y": -0.012507, + "x": 0.012333, + "z": 0.043379 + } + } + }, + "parentId": null, + "parentAssetId": "2330a720-b7b2-4370-b479-04ec8b9768a4" + }, + { + "type": "mesh", + "id": "24fc6234-96f9-4d5a-8581-6e41c7a8c4ae", + "sid": "35", + "properties": { + "name": "Button Y", + "geometryId": "2330a720-b7b2-4370-b479-04ec8b9768a4", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "54fa7367-67b0-456e-a9fb-c3c73533b540", + "parentAssetId": "c56ea2bc-25f0-4d42-8d42-efe57cc769f0" + }, + { + "type": "meshGeometry", + "id": "fc29e860-0acd-432e-b15c-faa0ed8a19fa", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#e31a300e-4672-4837-a8e8-1867370573c3" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#05214335-be0f-4920-906f-ba5114ca43f8" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#675046e1-4e7f-43d9-ac96-bc1af44d6e2c" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#b497c351-08b5-4759-b68d-d74ece3839a1", + "primitives": [ + { + "count": 1950, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.003392, + "x": 0.013944, + "z": 0.099841 + }, + "min": { + "y": -0.021302, + "x": 8.12E-4, + "z": 0.075777 + } + } + }, + "parentId": null, + "parentAssetId": "fc29e860-0acd-432e-b15c-faa0ed8a19fa" + }, + { + "type": "mesh", + "id": "1e70959f-b2f7-4622-b3d8-99e130ed0dc9", + "sid": "36", + "properties": { + "name": "Button Grip", + "geometryId": "fc29e860-0acd-432e-b15c-faa0ed8a19fa", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "ed0b49b5-cd33-4435-a8e6-aa201eb3ce67", + "parentAssetId": "c20e7faf-b968-4e46-8226-22a3db8d4bcb" + }, + { + "type": "meshGeometry", + "id": "982c9270-6401-480f-9ed9-2e327eed164b", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#fd59e017-b1c2-4578-b540-8c9ee1c08c9c" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#b31ed175-9f4d-41b9-a652-bac3ffd5a443" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#9d5bda06-f29a-4b19-8651-c971bdd5e1c4" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#45b265d5-53cf-40d3-af7d-d15d04c9529c", + "primitives": [ + { + "count": 4800, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.002687, + "x": 0.007183, + "z": 0.057865 + }, + "min": { + "y": -0.017401, + "x": -0.010158, + "z": 0.037724 + } + } + }, + "parentId": null, + "parentAssetId": "982c9270-6401-480f-9ed9-2e327eed164b" + }, + { + "type": "mesh", + "id": "392049ae-4d77-4880-8ead-f564c2c41b5b", + "sid": "37", + "properties": { + "name": "Thumbstick", + "geometryId": "982c9270-6401-480f-9ed9-2e327eed164b", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "84e8592c-b519-4e71-a1db-d6f405d7c930", + "parentAssetId": "2de6f3ab-d637-483e-8fcf-38833634d2b8" + }, + { + "type": "meshGeometry", + "id": "33f11b9a-87a4-4d18-a21b-450c07cae8b7", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#5519ba61-f111-47d7-ada4-eab32f521764" + }, + "uvs1": { + "name": "UVs", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#d50257f9-50ef-49f5-8a49-0f382fb6b6da" + }, + "normals": { + "name": "Normals", + "accessorId": "64566e89-93a8-40e4-852e-5d6fc5135291#197e522f-342e-4071-8596-8a0aa8afcf33" + } + }, + "indices": "64566e89-93a8-40e4-852e-5d6fc5135291#aa392a6a-e88f-455d-8ecd-c8d050be6735", + "primitives": [ + { + "count": 1956, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.019894, + "x": 0.019267, + "z": 0.061405 + }, + "min": { + "y": -0.046112, + "x": -0.006725, + "z": 0.036159 + } + } + }, + "parentId": null, + "parentAssetId": "33f11b9a-87a4-4d18-a21b-450c07cae8b7" + }, + { + "type": "mesh", + "id": "af445b9b-ac22-475c-899b-510226375735", + "sid": "30", + "properties": { + "name": "Trigger", + "geometryId": "33f11b9a-87a4-4d18-a21b-450c07cae8b7", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "4dbaa495-9bbc-4df8-984c-25b22db143b6", + "parentAssetId": "ea6906cc-261a-401d-a13e-0c3b84988c9b" + }, + { + "type": "mesh", + "id": "63153186-0399-47d9-86ed-874b57b6f430", + "sid": "62", + "properties": { + "name": "Box Logo Mesh", + "geometryId": "63153186-0399-47d9-86ed-874b57b6f428", + "position": { "x": 0.007, "y": -0.017567707664, "z": 0.0362585}, + "quaternion": { "x": -0.35227423327509, "y": 0, "z": 0, "w": 0.9358968236779349}, + "materials": [ "0887b8e2-1212-468a-85ab-da754ae9b2d6" ] + } + }, + { + "type": "buffer", + "id": "64566e89-93a8-40e4-852e-5d6fc5135291", + "sid": "geometry.bin", + "properties": { + "name": "geometry.bin", + "src": "geometry.bin", + "isExternal": true, + "contentLength": 457908, + "accessors": { + "bf12e4ff-48d8-462e-8c1c-193287eaf08c": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 110412, + "byteStride": 0, + "count": 6639 + }, + "e87cc2de-0a06-456f-9bde-9631bcca367c": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 190080, + "byteStride": 0, + "count": 6639 + }, + "52abbde9-a91d-408a-8cc9-ac4ecf0bb154": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 243192, + "byteStride": 0, + "count": 6639 + }, + "e83e27e4-6b4c-4533-ac56-61d1cc8c7908": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 0, + "byteStride": 0, + "count": 27603 + }, + "08b3adc7-e075-4824-b2c1-62a1c4b8dc93": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 326316, + "byteStride": 0, + "count": 225 + }, + "a1cb2cee-74cb-4b8e-9590-8f0473ec0c0a": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 329016, + "byteStride": 0, + "count": 225 + }, + "82822bcf-2751-406a-8e18-2321cb0533c3": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 330816, + "byteStride": 0, + "count": 225 + }, + "c8f7035c-d499-4b93-8a58-99c6d29902fe": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 322860, + "byteStride": 0, + "count": 864 + }, + "706b8722-3ab5-412c-b6c3-9dccc0ce8cf3": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 338508, + "byteStride": 0, + "count": 289 + }, + "fbd237e8-f4e8-49e3-908d-c139ab812306": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 341976, + "byteStride": 0, + "count": 289 + }, + "b9c7e793-f333-40da-86d6-3cd27d7cfb38": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 344288, + "byteStride": 0, + "count": 289 + }, + "bc75a166-2c38-41b4-81f0-fda81332e204": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 333516, + "byteStride": 0, + "count": 1248 + }, + "19b7a5d0-4b24-4757-b687-9d8fc71fe2dc": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 352748, + "byteStride": 0, + "count": 289 + }, + "c5bf7e01-dce9-4347-b47b-3adc8c5538a5": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 356216, + "byteStride": 0, + "count": 289 + }, + "11f81298-fe6c-4e4b-ac03-a024640861b7": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 358528, + "byteStride": 0, + "count": 289 + }, + "c4d7ac4c-bd31-47c3-b273-a43110ba25e4": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 347756, + "byteStride": 0, + "count": 1248 + }, + "e31a300e-4672-4837-a8e8-1867370573c3": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 369796, + "byteStride": 0, + "count": 357 + }, + "05214335-be0f-4920-906f-ba5114ca43f8": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 374080, + "byteStride": 0, + "count": 357 + }, + "675046e1-4e7f-43d9-ac96-bc1af44d6e2c": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 376936, + "byteStride": 0, + "count": 357 + }, + "b497c351-08b5-4759-b68d-d74ece3839a1": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 361996, + "byteStride": 0, + "count": 1950 + }, + "fd59e017-b1c2-4578-b540-8c9ee1c08c9c": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 400420, + "byteStride": 0, + "count": 1204 + }, + "b31ed175-9f4d-41b9-a652-bac3ffd5a443": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 414868, + "byteStride": 0, + "count": 1204 + }, + "9d5bda06-f29a-4b19-8651-c971bdd5e1c4": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 424500, + "byteStride": 0, + "count": 1204 + }, + "45b265d5-53cf-40d3-af7d-d15d04c9529c": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 381220, + "byteStride": 0, + "count": 4800 + }, + "5519ba61-f111-47d7-ada4-eab32f521764": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 446772, + "byteStride": 0, + "count": 348 + }, + "d50257f9-50ef-49f5-8a49-0f382fb6b6da": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 450948, + "byteStride": 0, + "count": 348 + }, + "197e522f-342e-4071-8596-8a0aa8afcf33": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 453732, + "byteStride": 0, + "count": 348 + }, + "aa392a6a-e88f-455d-8ecd-c8d050be6735": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 438948, + "byteStride": 0, + "count": 1956 + } + } + }, + "parentId": null, + "parentAssetId": "64566e89-93a8-40e4-852e-5d6fc5135291" + } + ] +} diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/geometry.bin b/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/geometry.bin new file mode 100644 index 000000000..43a921ca5 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchLeft/geometry.bin differ diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/entities.json b/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/entities.json new file mode 100644 index 000000000..b99f8e1cc --- /dev/null +++ b/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/entities.json @@ -0,0 +1,746 @@ +{ + "version": { + "major": 4, + "minor": 3 + }, + "entities": [ + { + "type": "meshGeometry", + "id": "eac92056-0c88-408b-9fae-6db9b15d283a", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#cb672069-1462-4967-8339-b9bcde55492d" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#797eb683-04c4-4ec9-aaad-0498b44f0375" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#4dbaa2fb-3ec9-4125-82a6-de87d3092bcf" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#dbcfdb46-3ba0-45e8-bdb0-8ae38346200f", + "primitives": [ + { + "count": 27603, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.013945, + "x": 0.064815, + "z": 0.138579 + }, + "min": { + "y": -0.080107, + "x": -0.04478, + "z": 0.023973 + } + } + }, + "parentId": null, + "parentAssetId": "eac92056-0c88-408b-9fae-6db9b15d283a" + }, + { + "type": "prefab", + "id": "ed42df95-98eb-4237-872f-97358cede7f3", + "sid": null, + "properties": { + "name": "Oculus Touch Right" + }, + "children": [ + "11076cce-eb56-454c-99f6-ada374a5be93" + ] + }, + { + "type": "node", + "id": "11076cce-eb56-454c-99f6-ada374a5be93", + "sid": "9", + "properties": { + "position": { + "y": 0.036, + "x": 0.008, + "z": -0.04 + }, + "quaternion": { + "y": 0, + "x": 0.33709491700546734, + "z": 0, + "w": 0.9414706670571723 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Oculus Touch Right Root" + }, + "children": [ + "679414ba-df7c-43f3-b6aa-17165dc40110", + "491648e1-c35b-4f77-9aa0-aaff56fe2104", + "607fcf93-75c6-4f06-8eee-8b6f4c96fcea", + "febe0761-30a4-443c-bda7-093f84e2914a", + "30f0e4f0-a88f-41c4-82a3-027584c1c7b5", + "ba23e989-245b-4816-bf11-ff9b3fbfafd9", + "248fc92a-a3d6-4fed-8623-3c59b79e7869", + "63153186-0399-47d9-86ed-874b57b6f429" + ], + "components": [ + { + "name": "VR Controller Animator", + "attributes": { + "buttons": [ + [{ + "movementType": "translate", + "mesh": "ba23e989-245b-4816-bf11-ff9b3fbfafd9", + "offset": { "x": 0, "y": -0.0005, "z": 0.0005} + }], + [{ + "movementType": "rotate", + "mesh": "248fc92a-a3d6-4fed-8623-3c59b79e7869", + "pivot": { "x": 0, "y": -0.02622, "z": 0.03769}, + "rotation": { "x": -0.31415926535898, "y": 0, "z": 0 } + }], + [{ + "movementType": "rotate", + "mesh": "30f0e4f0-a88f-41c4-82a3-027584c1c7b5", + "offset": { "x": 0.004, "y": 0, "z": 0}, + "pivot": { "x": -0.01, "y": 0.008, "z": 0.075}, + "rotation": { "x": 0, "y": 0.17453292519943, "z": 0 } + }], + [{ + "movementType": "translate", + "mesh": "491648e1-c35b-4f77-9aa0-aaff56fe2104", + "offset": { "x": 0, "y": -0.001, "z": 0.001} + }], + [{ + "movementType": "translate", + "mesh": "607fcf93-75c6-4f06-8eee-8b6f4c96fcea", + "offset": { "x": 0, "y": -0.001, "z": 0.001} + }], + [{ + "movementType": "translate", + "mesh": "null", + "offset": { "x": 0, "y": 0, "z": 0} + }] + ], + "axes": [ + [{ + "movementType": "rotate", + "mesh": "ba23e989-245b-4816-bf11-ff9b3fbfafd9", + "pivot": { "x": -0.00149, "y": -0.01393, "z": 0.05283 }, + "rotation": { "x": 0, "y": 0, "z": -0.5} + }], + [{ + "movementType": "rotate", + "mesh": "ba23e989-245b-4816-bf11-ff9b3fbfafd9", + "pivot": { "x": -0.00149, "y": -0.01393, "z": 0.05283 }, + "rotation": { "x": 0.5, "y": 0, "z": 0} + }] + ] + }, + "scriptId": "gamepad_animator" + } + ] + }, + { + "type": "mesh", + "id": "679414ba-df7c-43f3-b6aa-17165dc40110", + "sid": "30", + "properties": { + "name": "Body", + "geometryId": "eac92056-0c88-408b-9fae-6db9b15d283a", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "5e192f3d-622d-4468-8551-27a4b23743c5", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#bd54ab75-836f-4b22-b42d-c3ec9b724616" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#2e5b2bbb-ba3a-4659-a2bb-8e323a13908c" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#006e9155-5ec1-45c0-981c-709c818c096c" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#69577b62-967c-4f7a-bcf0-f12adacf2657", + "primitives": [ + { + "count": 1248, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.003812, + "x": -0.006087, + "z": 0.062682 + }, + "min": { + "y": -0.003911, + "x": -0.016053, + "z": 0.053844 + } + } + }, + "parentId": null, + "parentAssetId": "5e192f3d-622d-4468-8551-27a4b23743c5" + }, + { + "type": "mesh", + "id": "491648e1-c35b-4f77-9aa0-aaff56fe2104", + "sid": "31", + "properties": { + "name": "Button A", + "geometryId": "5e192f3d-622d-4468-8551-27a4b23743c5", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "63153186-0399-47d9-86ed-874b57b6f427", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#1beed844-a6bd-4d4b-835d-e638f521dbc2" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#a1b69197-dc33-4584-84fd-94f9ff912819" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#43c2bdec-2c45-4068-9d1e-08c1046e1222" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#4d58518f-9322-49d2-b076-2c3b58e28b53", + "primitives": [ + { + "count": 1248, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.004784, + "x": -0.012333, + "z": 0.052217 + }, + "min": { + "y": -0.012507, + "x": -0.0223, + "z": 0.043379 + } + } + }, + "parentId": null, + "parentAssetId": "63153186-0399-47d9-86ed-874b57b6f427" + }, + { + "type": "mesh", + "id": "607fcf93-75c6-4f06-8eee-8b6f4c96fcea", + "sid": "32", + "properties": { + "name": "Button B", + "geometryId": "63153186-0399-47d9-86ed-874b57b6f427", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "c6387d4c-f023-49ef-89fa-f329036ad9e0", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#f3f68ecb-c2e0-4c59-b984-3cfc3c73a977" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#69f7d01a-72e8-44d1-aefe-b5fd25300664" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#b1e6a23f-dad5-4dd2-92b0-b65bd919905f" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#9e8bac41-a803-4c34-8b2d-fa0c27ee588d", + "primitives": [ + { + "count": 864, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.00699, + "x": 0.008223, + "z": 0.067222 + }, + "min": { + "y": 2.74E-4, + "x": -8.11E-4, + "z": 0.05944 + } + } + }, + "parentId": null, + "parentAssetId": "c6387d4c-f023-49ef-89fa-f329036ad9e0" + }, + { + "type": "mesh", + "id": "febe0761-30a4-443c-bda7-093f84e2914a", + "sid": "33", + "properties": { + "name": "Home Button", + "geometryId": "c6387d4c-f023-49ef-89fa-f329036ad9e0", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "e3fc799b-73d1-4105-a704-c32995c3059c", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#40b682c9-ad39-4752-a998-adcb21841f11" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#cb5e7457-a6a0-4b97-a95f-2c40d49cf473" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#ab700605-878f-44bb-9be5-4ee933f2a00e" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#85d98a80-ac82-4788-95db-ddf01411f713", + "primitives": [ + { + "count": 1950, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.003392, + "x": -8.12E-4, + "z": 0.099841 + }, + "min": { + "y": -0.021302, + "x": -0.013944, + "z": 0.075777 + } + } + }, + "parentId": null, + "parentAssetId": "e3fc799b-73d1-4105-a704-c32995c3059c" + }, + { + "type": "mesh", + "id": "30f0e4f0-a88f-41c4-82a3-027584c1c7b5", + "sid": "34", + "properties": { + "name": "Button Grip", + "geometryId": "e3fc799b-73d1-4105-a704-c32995c3059c", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "553fc2e4-b5c8-43c6-83cc-40a0c94e6c0b", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#77d9a9ad-0bb1-4a6b-8978-880bcaf32d97" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#98dd7809-883d-457d-b514-74a1a62a3f13" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#d67fadd3-9bae-4c16-9d12-91f9b9ae27e5" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#4abd3433-9e12-47a4-9773-42bfaef8d397", + "primitives": [ + { + "count": 4800, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.002687, + "x": 0.010158, + "z": 0.057865 + }, + "min": { + "y": -0.017401, + "x": -0.007183, + "z": 0.037724 + } + } + }, + "parentId": null, + "parentAssetId": "553fc2e4-b5c8-43c6-83cc-40a0c94e6c0b" + }, + { + "type": "mesh", + "id": "ba23e989-245b-4816-bf11-ff9b3fbfafd9", + "sid": "35", + "properties": { + "name": "Thumbstick", + "geometryId": "553fc2e4-b5c8-43c6-83cc-40a0c94e6c0b", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "meshGeometry", + "id": "d62f7a35-1658-4026-87cc-9aea60e32213", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#674f0a45-9364-47c9-bea4-0fb85fbdf86b" + }, + "uvs1": { + "name": "UVs", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#a08271b6-a0fa-4283-9999-08fe60518803" + }, + "normals": { + "name": "Normals", + "accessorId": "7ace8382-522a-48f4-811f-3580029f7703#264c362c-a708-432d-87d1-e22fb8d23236" + } + }, + "indices": "7ace8382-522a-48f4-811f-3580029f7703#77a5499f-a10e-4b21-b6ee-b2ee3e19e0e0", + "primitives": [ + { + "count": 1956, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.019894, + "x": 0.006725, + "z": 0.061405 + }, + "min": { + "y": -0.046112, + "x": -0.019267, + "z": 0.036159 + } + } + }, + "parentId": null, + "parentAssetId": "d62f7a35-1658-4026-87cc-9aea60e32213" + }, + { + "type": "mesh", + "id": "248fc92a-a3d6-4fed-8623-3c59b79e7869", + "sid": "36", + "properties": { + "name": "Trigger", + "geometryId": "d62f7a35-1658-4026-87cc-9aea60e32213", + "materials": [ + "0887b8e2-1212-468a-85ab-da754ae9b2d5" + ] + }, + "children": [], + "parentId": "11076cce-eb56-454c-99f6-ada374a5be93" + }, + { + "type": "mesh", + "id": "63153186-0399-47d9-86ed-874b57b6f429", + "sid": "61", + "properties": { + "name": "Box Logo Mesh", + "geometryId": "63153186-0399-47d9-86ed-874b57b6f428", + "position": { "x": -0.006, "y": -0.017567707664, "z": 0.0362585}, + "quaternion": { "x": -0.35227423327509, "y": 0, "z": 0, "w": 0.9358968236779349}, + "materials": [ "0887b8e2-1212-468a-85ab-da754ae9b2d6" ] + } + }, + { + "type": "buffer", + "id": "7ace8382-522a-48f4-811f-3580029f7703", + "sid": "geometry.bin", + "properties": { + "name": "geometry.bin", + "src": "geometry.bin", + "isExternal": true, + "contentLength": 457908, + "accessors": { + "cb672069-1462-4967-8339-b9bcde55492d": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 110412, + "byteStride": 0, + "count": 6639 + }, + "797eb683-04c4-4ec9-aaad-0498b44f0375": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 190080, + "byteStride": 0, + "count": 6639 + }, + "4dbaa2fb-3ec9-4125-82a6-de87d3092bcf": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 243192, + "byteStride": 0, + "count": 6639 + }, + "dbcfdb46-3ba0-45e8-bdb0-8ae38346200f": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 0, + "byteStride": 0, + "count": 27603 + }, + "bd54ab75-836f-4b22-b42d-c3ec9b724616": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 327852, + "byteStride": 0, + "count": 289 + }, + "2e5b2bbb-ba3a-4659-a2bb-8e323a13908c": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 331320, + "byteStride": 0, + "count": 289 + }, + "006e9155-5ec1-45c0-981c-709c818c096c": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 333632, + "byteStride": 0, + "count": 289 + }, + "69577b62-967c-4f7a-bcf0-f12adacf2657": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 322860, + "byteStride": 0, + "count": 1248 + }, + "1beed844-a6bd-4d4b-835d-e638f521dbc2": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 342092, + "byteStride": 0, + "count": 289 + }, + "a1b69197-dc33-4584-84fd-94f9ff912819": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 345560, + "byteStride": 0, + "count": 289 + }, + "43c2bdec-2c45-4068-9d1e-08c1046e1222": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 347872, + "byteStride": 0, + "count": 289 + }, + "4d58518f-9322-49d2-b076-2c3b58e28b53": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 337100, + "byteStride": 0, + "count": 1248 + }, + "f3f68ecb-c2e0-4c59-b984-3cfc3c73a977": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 354796, + "byteStride": 0, + "count": 225 + }, + "69f7d01a-72e8-44d1-aefe-b5fd25300664": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 357496, + "byteStride": 0, + "count": 225 + }, + "b1e6a23f-dad5-4dd2-92b0-b65bd919905f": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 359296, + "byteStride": 0, + "count": 225 + }, + "9e8bac41-a803-4c34-8b2d-fa0c27ee588d": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 351340, + "byteStride": 0, + "count": 864 + }, + "40b682c9-ad39-4752-a998-adcb21841f11": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 369796, + "byteStride": 0, + "count": 357 + }, + "cb5e7457-a6a0-4b97-a95f-2c40d49cf473": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 374080, + "byteStride": 0, + "count": 357 + }, + "ab700605-878f-44bb-9be5-4ee933f2a00e": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 376936, + "byteStride": 0, + "count": 357 + }, + "85d98a80-ac82-4788-95db-ddf01411f713": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 361996, + "byteStride": 0, + "count": 1950 + }, + "77d9a9ad-0bb1-4a6b-8978-880bcaf32d97": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 400420, + "byteStride": 0, + "count": 1204 + }, + "98dd7809-883d-457d-b514-74a1a62a3f13": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 414868, + "byteStride": 0, + "count": 1204 + }, + "d67fadd3-9bae-4c16-9d12-91f9b9ae27e5": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 424500, + "byteStride": 0, + "count": 1204 + }, + "4abd3433-9e12-47a4-9773-42bfaef8d397": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 381220, + "byteStride": 0, + "count": 4800 + }, + "674f0a45-9364-47c9-bea4-0fb85fbdf86b": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 446772, + "byteStride": 0, + "count": 348 + }, + "a08271b6-a0fa-4283-9999-08fe60518803": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 450948, + "byteStride": 0, + "count": 348 + }, + "264c362c-a708-432d-87d1-e22fb8d23236": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 453732, + "byteStride": 0, + "count": 348 + }, + "77a5499f-a10e-4b21-b6ee-b2ee3e19e0e0": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 438948, + "byteStride": 0, + "count": 1956 + } + } + }, + "parentId": null, + "parentAssetId": "7ace8382-522a-48f4-811f-3580029f7703" + } + ] +} diff --git a/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/geometry.bin b/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/geometry.bin new file mode 100644 index 000000000..d50c5f09b Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/oculusTouchRight/geometry.bin differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/entities.json b/src/third-party/model3d/1.1.1/WebVR/viveController/entities.json new file mode 100644 index 000000000..00f962c0b --- /dev/null +++ b/src/third-party/model3d/1.1.1/WebVR/viveController/entities.json @@ -0,0 +1,1869 @@ +{ + "version": { + "major": 4, + "minor": 3 + }, + "entities": [ + { + "type": "texture2D", + "id": "702be2b4-d955-4daf-98b3-467c160d6081", + "sid": "27", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "onepointfive_texture.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "f0a4a127-9e4e-49cd-92ec-9b237bf3ab82" + }, + "parentId": null, + "parentAssetId": "702be2b4-d955-4daf-98b3-467c160d6081" + }, + { + "type": "texture2D", + "id": "36908f7d-f068-4aa5-bb12-49fdaf153267", + "sid": "28", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "onepointfive_spec.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "0fd80b56-19dc-4074-92ff-ea2a04954119" + }, + "parentId": null, + "parentAssetId": "36908f7d-f068-4aa5-bb12-49fdaf153267" + }, + { + "type": "material", + "id": "65960582-73cc-452c-aa54-53e9c0619d7a", + "sid": "29", + "properties": { + "shadingModel": "phong", + "transparencyFactor": 0, + "displacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "bump": { + "r": 0, + "b": 0, + "g": 0 + }, + "reflectionFactor": 1, + "shininess": 300, + "vectorDisplacementColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "emissive": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambient": { + "r": 0, + "b": 0, + "g": 0 + }, + "normalMap": { + "r": 0, + "b": 0, + "g": 0 + }, + "emissiveFactor": 1, + "diffuse": { + "r": 1, + "b": 1, + "g": 1 + }, + "reflection": { + "r": 0, + "b": 0, + "g": 0 + }, + "displacementFactor": 1, + "transparentColor": { + "r": 0, + "b": 0, + "g": 0 + }, + "ambientFactor": 1, + "specularFactor": 1, + "specular": { + "r": 1, + "b": 1, + "g": 1 + }, + "diffuseTexture": "702be2b4-d955-4daf-98b3-467c160d6081", + "shininessTexture": "36908f7d-f068-4aa5-bb12-49fdaf153267", + "ambientTexture": "5ee0068b-67d4-43f6-928a-f23147a96877", + "vectorDisplacementFactor": 1, + "diffuseFactor": 1, + "bumpFactor": 1, + "name": "lambert4SG" + }, + "parentId": null, + "parentAssetId": "65960582-73cc-452c-aa54-53e9c0619d7a" + }, + { + "type": "meshGeometry", + "id": "d8b81c4e-c8e2-44e3-bc22-d7a9eca8d674", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#dc03b4d3-ac68-4091-af6f-8d87287502eb" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#2a89c921-bef9-4132-a4da-88b498ce1575" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#383ff643-6e35-4c55-a79b-9f73ee9fa827" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#7cf3e15c-192f-4bc1-a5c2-2e32c533598f", + "primitives": [ + { + "count": 41898, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.007103, + "x": 0.058716, + "z": 0.173514 + }, + "min": { + "y": -0.075882, + "x": -0.058716, + "z": -0.045913 + } + } + }, + "parentId": null, + "parentAssetId": "d8b81c4e-c8e2-44e3-bc22-d7a9eca8d674" + }, + { + "type": "prefab", + "id": "9d1f19de-9704-4964-950d-7f0a34830aaf", + "sid": null, + "children": [ + "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07" + ], + "properties": { + "name": "Vive Controller" + }, + "parentId": null, + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "node", + "id": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "sid": "9", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "RootNode" + }, + "children": [ + "6a843fe1-3d5b-4131-9871-7755f8ee4436", + "02d6fa8f-20e8-44d4-9546-32eac20bf480", + "8a4ca53f-4e03-4050-bc77-144b84af1e76", + "f478dabd-9860-4aa9-b159-01e8886de8c4", + "e183a43a-2f36-44bb-8227-5e4ec6d92ce5", + "88d6e0d2-ef94-44c8-8b16-b3937599f67f", + "4a227367-5529-4c97-ba6d-9b8fd1a3f2e0", + "b07d8801-ea45-4f42-be64-8b68a1c17106" + ], + "components": [ + { + "name": "VR Controller Animator", + "attributes": { + "buttons": [ + [{ + "movementType": "translate", + "mesh": "4a227367-5529-4c97-ba6d-9b8fd1a3f2e0", + "offset": { "x": 0, "y": -0.001, "z": 0} + }, { + "mesh": "c1a0fe68-efc4-483f-a2c6-a9aadf809066", + "movementType": "translate", + "offset": { "x": 0, "y": 0, "z": 0}, + "renderOnTouchOnly": true + }], + [{ + "movementType": "rotate", + "mesh": "b07d8801-ea45-4f42-be64-8b68a1c17106", + "pivot": { "x": 0, "y": -0.016, "z": 0.039}, + "rotation": { "x": -0.29670597283904, "y": 0, "z": 0 } + }], + [{ + "movementType": "rotate", + "mesh": "8a4ca53f-4e03-4050-bc77-144b84af1e76", + "pivot": { "x": -0.019, "y": -0.006, "z": 0.075}, + "rotation": { "x": 0, "y": 0.0349, "z": 0 } + }, { + "movementType": "rotate", + "mesh": "e183a43a-2f36-44bb-8227-5e4ec6d92ce5", + "pivot": { "x": 0.019, "y": -0.006, "z": 0.075}, + "rotation": { "x": 0, "y": -0.0349, "z": 0 } + }], + [{ + "movementType": "translate", + "mesh": "02d6fa8f-20e8-44d4-9546-32eac20bf480", + "offset": { "x": 0, "y": -0.00075, "z": 0} + }] + ], + "axes": [ + [{ + "movementType": "translate", + "mesh": "c1a0fe68-efc4-483f-a2c6-a9aadf809066", + "offset": { "x": 0.035, "y": 0, "z": 0} + }], + [{ + "movementType": "translate", + "mesh": "c1a0fe68-efc4-483f-a2c6-a9aadf809066", + "offset": { "x": 0, "y": 0.004, "z": -0.035} + }] + ] + }, + "scriptId": "gamepad_animator" + } + ], + "parentId": "9d1f19de-9704-4964-950d-7f0a34830aaf", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "mesh", + "id": "6a843fe1-3d5b-4131-9871-7755f8ee4436", + "sid": "30", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Body", + "geometryId": "d8b81c4e-c8e2-44e3-bc22-d7a9eca8d674", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "1c8a146c-083a-4f54-aff3-c616192e060e", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#2c81ed1d-a5b6-450a-a620-fbebdab8a8ab" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#5960c340-276b-4b4a-a7ae-6d7c14fc92e7" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#6a429e27-0b2a-413c-b948-0b22a72f1997" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#b65862df-c105-4d01-a923-d322a6096859", + "primitives": [ + { + "count": 792, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.007729, + "x": 0.004993, + "z": 0.024979 + }, + "min": { + "y": 0.003233, + "x": -0.004993, + "z": 0.014858 + } + } + }, + "parentId": null, + "parentAssetId": "1c8a146c-083a-4f54-aff3-c616192e060e" + }, + { + "type": "mesh", + "id": "02d6fa8f-20e8-44d4-9546-32eac20bf480", + "sid": "31", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Button", + "geometryId": "1c8a146c-083a-4f54-aff3-c616192e060e", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "41325bb4-92f6-4004-90f6-e828ba29a50c", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#c03da50f-5983-4802-a397-bfaca600420b" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#0e116b75-21f0-4994-ab04-5477ef153184" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#8568f6bb-c2a6-4b74-afdf-cb293f55c064" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#02a70561-1fbf-439a-9082-4cd8e85f2ee7", + "primitives": [ + { + "count": 1176, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.006792, + "x": -0.01216, + "z": 0.10192 + }, + "min": { + "y": -0.021856, + "x": -0.022254, + "z": 0.072368 + } + } + }, + "parentId": null, + "parentAssetId": "41325bb4-92f6-4004-90f6-e828ba29a50c" + }, + { + "type": "mesh", + "id": "8a4ca53f-4e03-4050-bc77-144b84af1e76", + "sid": "32", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Left Grip", + "geometryId": "41325bb4-92f6-4004-90f6-e828ba29a50c", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "b2542d8d-42f8-42b4-b040-9bacad867d77", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#7b30a573-b551-4994-aa9e-21e624f209bc" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#83558a55-8e03-44c4-9af0-4cfa7071699b" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#097627dd-502c-4cb3-ae85-7a80ede48b4a" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#e02d8ad6-5890-44ff-a4b8-1bf4f0235760", + "primitives": [ + { + "count": 180, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.002979, + "x": 5.68E-4, + "z": 0.096888 + }, + "min": { + "y": 0.001996, + "x": -5.68E-4, + "z": 0.095675 + } + } + }, + "parentId": null, + "parentAssetId": "b2542d8d-42f8-42b4-b040-9bacad867d77" + }, + { + "type": "mesh", + "id": "f478dabd-9860-4aa9-b159-01e8886de8c4", + "sid": "33", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "LED", + "geometryId": "b2542d8d-42f8-42b4-b040-9bacad867d77", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "image", + "id": "08db2b5a-859f-4b63-80ca-6827ef0d1149", + "sid": "onepointfive_occ_bake.tga", + "properties": { + "name": "onepointfive_occ_bake.tga", + "filename": "onepointfive_occ_bake.tga", + "width": 1024, + "height": 1024, + "colorspace": "srgb", + "compression": "none", + "depth": 8, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "images/1024/1.png", + "isExternal": true, + "contentType": "image/png", + "contentLength": 507505, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "width": 1024, + "height": 1024, + "sequenceLength": 1 + }, + { + "src": "images/64/1.png", + "isExternal": true, + "contentType": "image/png", + "contentLength": 8539, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "08db2b5a-859f-4b63-80ca-6827ef0d1149" + }, + { + "type": "image", + "id": "0fd80b56-19dc-4074-92ff-ea2a04954119", + "sid": "onepointfive_spec.png", + "properties": { + "name": "onepointfive_spec.png", + "filename": "onepointfive_spec.png", + "width": 1024, + "height": 1024, + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "channels": [ + "red", + "green", + "blue" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "images/1024/2.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 95213, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 1024, + "height": 1024, + "sequenceLength": 1 + }, + { + "src": "images/64/2.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 5460, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "0fd80b56-19dc-4074-92ff-ea2a04954119" + }, + { + "type": "image", + "id": "f0a4a127-9e4e-49cd-92ec-9b237bf3ab82", + "sid": "onepointfive_texture.png", + "properties": { + "name": "onepointfive_texture.png", + "filename": "onepointfive_texture.png", + "width": 1024, + "height": 1024, + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "channels": [ + "red", + "green", + "blue" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "images/1024/3.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 84111, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 1024, + "height": 1024, + "sequenceLength": 1 + }, + { + "src": "images/64/3.jpg", + "isExternal": true, + "contentType": "image/jpeg", + "contentLength": 1983, + "channels": [ + "red", + "green", + "blue" + ], + "colorspace": "srgb", + "compression": "jpeg", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "f0a4a127-9e4e-49cd-92ec-9b237bf3ab82" + }, + { + "type": "texture2D", + "id": "5ee0068b-67d4-43f6-928a-f23147a96877", + "sid": "27", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "onepointfive_occ_bake.tga", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "08db2b5a-859f-4b63-80ca-6827ef0d1149" + }, + "parentId": null, + "parentAssetId": "5ee0068b-67d4-43f6-928a-f23147a96877" + }, + { + "type": "meshGeometry", + "id": "9ca85fea-8adb-4bdf-9280-6b5d933b643b", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#8a7a721c-d026-4ed4-8bab-2a7cae6bca64" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#b92412f2-da6b-4d31-9a9b-b63b5d2c18d9" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#9de3ee5b-68f5-4a23-a163-24a88716bf6e" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#d8ea1136-92e7-481d-b2ad-5413fd5e90e4", + "primitives": [ + { + "count": 1176, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.006792, + "x": 0.022246, + "z": 0.10192 + }, + "min": { + "y": -0.021856, + "x": 0.012163, + "z": 0.072368 + } + } + }, + "parentId": null, + "parentAssetId": "9ca85fea-8adb-4bdf-9280-6b5d933b643b" + }, + { + "type": "mesh", + "id": "e183a43a-2f36-44bb-8227-5e4ec6d92ce5", + "sid": "34", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Right Grip", + "geometryId": "9ca85fea-8adb-4bdf-9280-6b5d933b643b", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "7d93f112-da90-4da3-aec3-a0efd27e187d", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#5168d1bb-a12d-4439-86c4-d3dd0a7e0f65" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#50952636-76cc-4da3-8dce-5071d927ba14" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#1b40a4ea-914f-453d-929e-d4c2c3d5ce93" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#a15d23cf-fac0-461f-ba7d-ea9e5e18dc58", + "primitives": [ + { + "count": 2304, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.005168, + "x": 0.003965, + "z": 0.05977 + }, + "min": { + "y": -0.017578, + "x": -0.003965, + "z": 0.037023 + } + } + }, + "parentId": null, + "parentAssetId": "7d93f112-da90-4da3-aec3-a0efd27e187d" + }, + { + "type": "mesh", + "id": "9c33843c-7b33-46d8-9463-b14331ede881", + "sid": "35", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Scroll Wheel", + "geometryId": "7d93f112-da90-4da3-aec3-a0efd27e187d", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "8ce6cd69-1614-4e88-8af2-c720a2fca291", + "sid": "29", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#ebc3a8d8-5cd0-4eb0-9592-21d9c395f0fc" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#cc715392-b31d-4a26-aa70-17ae0a12fb64" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#22e13ea5-0867-423a-a737-91d4aba20753" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#3ff2e8ab-725f-4f90-b8fb-64305e512501", + "primitives": [ + { + "count": 600, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -3.6E-4, + "x": 0.015, + "z": 0.159711 + }, + "min": { + "y": -0.00606, + "x": -0.015, + "z": 0.129877 + } + } + }, + "parentId": null, + "parentAssetId": "8ce6cd69-1614-4e88-8af2-c720a2fca291" + }, + { + "type": "mesh", + "id": "3980ab4f-cd96-47e4-9e8c-ae6176026277", + "sid": "36", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Status", + "geometryId": "8ce6cd69-1614-4e88-8af2-c720a2fca291", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "image", + "id": "90aa10af-8298-4b1a-b221-34b91c47e2ff", + "sid": "status.png", + "properties": { + "name": "status.png", + "filename": "status.png", + "width": 256, + "height": 256, + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "sequenceLength": 1 + }, + "representations": [ + { + "src": "images/256/4.png", + "isExternal": true, + "contentType": "image/png", + "contentLength": 24086, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "width": 256, + "height": 256, + "sequenceLength": 1 + }, + { + "src": "images/128/4.png", + "isExternal": true, + "contentType": "image/png", + "contentLength": 11739, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "width": 128, + "height": 128, + "sequenceLength": 1 + }, + { + "src": "images/64/4.png", + "isExternal": true, + "contentType": "image/png", + "contentLength": 5240, + "channels": [ + "red", + "green", + "blue", + "alpha" + ], + "colorspace": "srgb", + "compression": "zip", + "depth": 8, + "width": 64, + "height": 64, + "sequenceLength": 1 + } + ], + "parentId": null, + "parentAssetId": "90aa10af-8298-4b1a-b221-34b91c47e2ff" + }, + { + "type": "texture2D", + "id": "246d7999-3c66-4749-9c39-b5af66cfcc59", + "sid": "27", + "properties": { + "useMipmap": false, + "cropLeft": 0, + "textureUse": "standard", + "name": "status.png", + "uvSet": "default", + "mappingType": "uv", + "wrapModeV": "repeat", + "wrapModeU": "repeat", + "uvSwap": false, + "alphaSource": "none", + "premultiplyAlpha": true, + "cropRight": 0, + "rotation": { + "y": 0, + "x": 0, + "z": 0 + }, + "scaling": { + "y": 1, + "x": 1, + "z": 1 + }, + "alpha": 1, + "translation": { + "y": 0, + "x": 0, + "z": 0 + }, + "cropTop": 0, + "cropBottom": 0, + "useMaterial": false, + "imageId": "90aa10af-8298-4b1a-b221-34b91c47e2ff" + }, + "parentId": null, + "parentAssetId": "246d7999-3c66-4749-9c39-b5af66cfcc59" + }, + { + "type": "meshGeometry", + "id": "67a935c6-b282-4934-8d1b-fe19fbe3f3c7", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#126fd407-e380-46e9-9268-95442254a829" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#d3d5ff76-9647-4c0e-9fc5-b7e9f118c66a" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#f27809dd-644b-48ef-86ca-5137dc74ab91" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#47306056-d3c1-44b5-84a1-544fc49bca15", + "primitives": [ + { + "count": 792, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.004181, + "x": 0.004993, + "z": 0.093391 + }, + "min": { + "y": -1.01E-4, + "x": -0.004993, + "z": 0.083127 + } + } + }, + "parentId": null, + "parentAssetId": "67a935c6-b282-4934-8d1b-fe19fbe3f3c7" + }, + { + "type": "mesh", + "id": "88d6e0d2-ef94-44c8-8b16-b3937599f67f", + "sid": "37", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "System Button", + "geometryId": "67a935c6-b282-4934-8d1b-fe19fbe3f3c7", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "e01e018f-19ea-4772-9c4c-c70ba1dc1504", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#371fd41b-40e5-4eb1-8786-5d54e722d729" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#d52fbe9e-f3f6-4056-88be-e148ce6d4ed4" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#38c509af-0f3e-4eb8-bba4-55452cad96dc" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#6d49d03d-aaea-4cb0-8600-d67d8cd27a3d", + "primitives": [ + { + "count": 2508, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.007248, + "x": 0.021412, + "z": 0.070286 + }, + "min": { + "y": -0.005289, + "x": -0.021412, + "z": 0.027171 + } + } + }, + "parentId": null, + "parentAssetId": "e01e018f-19ea-4772-9c4c-c70ba1dc1504" + }, + { + "type": "mesh", + "id": "4a227367-5529-4c97-ba6d-9b8fd1a3f2e0", + "sid": "38", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Track Pad", + "geometryId": "e01e018f-19ea-4772-9c4c-c70ba1dc1504", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [ + "c1a0fe68-efc4-483f-a2c6-a9aadf809066" + ], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "ea6ff9e9-01f0-454f-ab93-12722d6eb982", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#5282dbe6-f5fc-4755-8cf3-4f736de2dd17" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#f1d2f6bc-2192-48c2-bda7-40969667877b" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#cfcb63ae-a937-43d5-971c-ddd0d0a3448c" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#56d3f27f-08d3-4eeb-b548-52d9ae92e854", + "primitives": [ + { + "count": 3636, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.007251, + "x": 0.021412, + "z": 0.070282 + }, + "min": { + "y": -0.012278, + "x": -0.021412, + "z": 0.027171 + } + } + }, + "parentId": null, + "parentAssetId": "ea6ff9e9-01f0-454f-ab93-12722d6eb982" + }, + { + "type": "mesh", + "id": "4ce1ade0-aa40-4ad8-b79a-d885b4aac703", + "sid": "39", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Track Pad Scroll Cut", + "geometryId": "ea6ff9e9-01f0-454f-ab93-12722d6eb982", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "meshGeometry", + "id": "ef3ad11d-aed8-415a-b1ec-7b7e9be7f534", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#3806c41b-96ec-4002-bd7a-f785acb87a96" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#ef8d2348-38c9-46b9-91ee-d904d6bf6bdf" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#e43228b0-8fd2-467d-929b-55e5d64a8884" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#5097768c-7877-456e-9468-376e25ca0f21", + "primitives": [ + { + "count": 1320, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": 0.006032, + "x": 0.002246, + "z": 0.05145 + }, + "min": { + "y": 0.001539, + "x": -0.002246, + "z": 0.046957 + } + } + }, + "parentId": null, + "parentAssetId": "ef3ad11d-aed8-415a-b1ec-7b7e9be7f534" + }, + { + "type": "mesh", + "id": "c1a0fe68-efc4-483f-a2c6-a9aadf809066", + "sid": "40", + "properties": { + "position": { + "y": -0.02, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Track Pad Touch", + "geometryId": "ef3ad11d-aed8-415a-b1ec-7b7e9be7f534", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "4a227367-5529-4c97-ba6d-9b8fd1a3f2e0" + }, + { + "type": "meshGeometry", + "id": "506ebd1a-3a5c-4067-a41a-b83d8c48fa2d", + "sid": "31", + "properties": { + "name": "Mesh", + "attributes": { + "positions": { + "name": "positions", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#c5c38a94-3824-41f6-b4fd-815f6514fda9" + }, + "uvs1": { + "name": "UVs", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#2894a326-ca05-46c4-944d-b61ee306315a" + }, + "normals": { + "name": "Normals", + "accessorId": "55797b6a-8632-4654-8f76-3b9bf3a507bb#eaab2176-bc88-4862-8295-4bb5410505ff" + } + }, + "indices": "55797b6a-8632-4654-8f76-3b9bf3a507bb#d8560de5-b12d-4bf0-a043-43ad8f43f2df", + "primitives": [ + { + "count": 3456, + "start": 0, + "primitive": "triangles", + "materialIndex": 0 + } + ], + "bounds": { + "max": { + "y": -0.016596, + "x": 0.009557, + "z": 0.057847 + }, + "min": { + "y": -0.038785, + "x": -0.009548, + "z": 0.038757 + } + } + }, + "parentId": null, + "parentAssetId": "506ebd1a-3a5c-4067-a41a-b83d8c48fa2d" + }, + { + "type": "mesh", + "id": "b07d8801-ea45-4f42-be64-8b68a1c17106", + "sid": "41", + "properties": { + "position": { + "y": 0, + "x": 0, + "z": 0 + }, + "quaternion": { + "y": 0, + "x": 0, + "z": 0, + "w": 1 + }, + "scale": { + "y": 1, + "x": 1, + "z": 1 + }, + "name": "Trigger", + "geometryId": "506ebd1a-3a5c-4067-a41a-b83d8c48fa2d", + "materials": [ + "65960582-73cc-452c-aa54-53e9c0619d7a" + ] + }, + "children": [], + "parentId": "c04bfc7a-eb8c-42ae-b3e2-c6e3485a0a07", + "parentAssetId": "9d1f19de-9704-4964-950d-7f0a34830aaf" + }, + { + "type": "buffer", + "id": "55797b6a-8632-4654-8f76-3b9bf3a507bb", + "sid": "geometry.bin", + "properties": { + "name": "geometry.bin", + "src": "geometry.bin", + "isExternal": true, + "contentLength": 683704, + "accessors": { + "dc03b4d3-ac68-4091-af6f-8d87287502eb": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 167592, + "byteStride": 0, + "count": 10279 + }, + "2a89c921-bef9-4132-a4da-88b498ce1575": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 290940, + "byteStride": 0, + "count": 10279 + }, + "383ff643-6e35-4c55-a79b-9f73ee9fa827": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 373172, + "byteStride": 0, + "count": 10279 + }, + "7cf3e15c-192f-4bc1-a5c2-2e32c533598f": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 0, + "byteStride": 0, + "count": 41898 + }, + "2c81ed1d-a5b6-450a-a620-fbebdab8a8ab": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 499688, + "byteStride": 0, + "count": 145 + }, + "5960c340-276b-4b4a-a7ae-6d7c14fc92e7": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 501428, + "byteStride": 0, + "count": 145 + }, + "6a429e27-0b2a-413c-b948-0b22a72f1997": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 502588, + "byteStride": 0, + "count": 145 + }, + "b65862df-c105-4d01-a923-d322a6096859": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 496520, + "byteStride": 0, + "count": 792 + }, + "c03da50f-5983-4802-a397-bfaca600420b": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 509032, + "byteStride": 0, + "count": 210 + }, + "0e116b75-21f0-4994-ab04-5477ef153184": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 511552, + "byteStride": 0, + "count": 210 + }, + "8568f6bb-c2a6-4b74-afdf-cb293f55c064": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 513232, + "byteStride": 0, + "count": 210 + }, + "02a70561-1fbf-439a-9082-4cd8e85f2ee7": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 504328, + "byteStride": 0, + "count": 1176 + }, + "7b30a573-b551-4994-aa9e-21e624f209bc": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 516472, + "byteStride": 0, + "count": 49 + }, + "83558a55-8e03-44c4-9af0-4cfa7071699b": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 517060, + "byteStride": 0, + "count": 49 + }, + "097627dd-502c-4cb3-ae85-7a80ede48b4a": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 517452, + "byteStride": 0, + "count": 49 + }, + "e02d8ad6-5890-44ff-a4b8-1bf4f0235760": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 515752, + "byteStride": 0, + "count": 180 + }, + "8a7a721c-d026-4ed4-8bab-2a7cae6bca64": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 522744, + "byteStride": 0, + "count": 210 + }, + "b92412f2-da6b-4d31-9a9b-b63b5d2c18d9": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 525264, + "byteStride": 0, + "count": 210 + }, + "9de3ee5b-68f5-4a23-a163-24a88716bf6e": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 526944, + "byteStride": 0, + "count": 210 + }, + "d8ea1136-92e7-481d-b2ad-5413fd5e90e4": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 518040, + "byteStride": 0, + "count": 1176 + }, + "5168d1bb-a12d-4439-86c4-d3dd0a7e0f65": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 538680, + "byteStride": 0, + "count": 470 + }, + "50952636-76cc-4da3-8dce-5071d927ba14": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 544320, + "byteStride": 0, + "count": 470 + }, + "1b40a4ea-914f-453d-929e-d4c2c3d5ce93": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 548080, + "byteStride": 0, + "count": 470 + }, + "a15d23cf-fac0-461f-ba7d-ea9e5e18dc58": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 529464, + "byteStride": 0, + "count": 2304 + }, + "ebc3a8d8-5cd0-4eb0-9592-21d9c395f0fc": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 556120, + "byteStride": 0, + "count": 121 + }, + "cc715392-b31d-4a26-aa70-17ae0a12fb64": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 557572, + "byteStride": 0, + "count": 121 + }, + "22e13ea5-0867-423a-a737-91d4aba20753": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 558540, + "byteStride": 0, + "count": 121 + }, + "3ff2e8ab-725f-4f90-b8fb-64305e512501": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 553720, + "byteStride": 0, + "count": 600 + }, + "126fd407-e380-46e9-9268-95442254a829": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 563160, + "byteStride": 0, + "count": 145 + }, + "d3d5ff76-9647-4c0e-9fc5-b7e9f118c66a": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 564900, + "byteStride": 0, + "count": 145 + }, + "f27809dd-644b-48ef-86ca-5137dc74ab91": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 566060, + "byteStride": 0, + "count": 145 + }, + "47306056-d3c1-44b5-84a1-544fc49bca15": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 559992, + "byteStride": 0, + "count": 792 + }, + "371fd41b-40e5-4eb1-8786-5d54e722d729": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 577832, + "byteStride": 0, + "count": 515 + }, + "d52fbe9e-f3f6-4056-88be-e148ce6d4ed4": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 584012, + "byteStride": 0, + "count": 515 + }, + "38c509af-0f3e-4eb8-bba4-55452cad96dc": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 588132, + "byteStride": 0, + "count": 515 + }, + "6d49d03d-aaea-4cb0-8600-d67d8cd27a3d": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 567800, + "byteStride": 0, + "count": 2508 + }, + "5282dbe6-f5fc-4755-8cf3-4f736de2dd17": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 608856, + "byteStride": 0, + "count": 864 + }, + "f1d2f6bc-2192-48c2-bda7-40969667877b": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 619224, + "byteStride": 0, + "count": 864 + }, + "cfcb63ae-a937-43d5-971c-ddd0d0a3448c": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 626136, + "byteStride": 0, + "count": 864 + }, + "56d3f27f-08d3-4eeb-b548-52d9ae92e854": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 594312, + "byteStride": 0, + "count": 3636 + }, + "3806c41b-96ec-4002-bd7a-f785acb87a96": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 641784, + "byteStride": 0, + "count": 242 + }, + "ef8d2348-38c9-46b9-91ee-d904d6bf6bdf": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 644688, + "byteStride": 0, + "count": 242 + }, + "e43228b0-8fd2-467d-929b-55e5d64a8884": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 646624, + "byteStride": 0, + "count": 242 + }, + "5097768c-7877-456e-9468-376e25ca0f21": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 636504, + "byteStride": 0, + "count": 1320 + }, + "c5c38a94-3824-41f6-b4fd-815f6514fda9": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 663352, + "byteStride": 0, + "count": 636 + }, + "2894a326-ca05-46c4-944d-b61ee306315a": { + "type": "vec2", + "componentType": "float32", + "byteOffset": 670984, + "byteStride": 0, + "count": 636 + }, + "eaab2176-bc88-4862-8295-4bb5410505ff": { + "type": "vec3", + "componentType": "float32", + "byteOffset": 676072, + "byteStride": 0, + "count": 636 + }, + "d8560de5-b12d-4bf0-a043-43ad8f43f2df": { + "type": "scalar", + "componentType": "uint32", + "byteOffset": 649528, + "byteStride": 0, + "count": 3456 + } + } + }, + "parentId": null, + "parentAssetId": "55797b6a-8632-4654-8f76-3b9bf3a507bb" + } + ] +} diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/geometry.bin b/src/third-party/model3d/1.1.1/WebVR/viveController/geometry.bin new file mode 100644 index 000000000..738b13825 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/geometry.bin differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/1.png b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/1.png new file mode 100644 index 000000000..bff9c10fc Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/1.png differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/2.jpg b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/2.jpg new file mode 100644 index 000000000..249765308 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/2.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/3.jpg b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/3.jpg new file mode 100644 index 000000000..dd8d62095 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/1024/3.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/1.png b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/1.png new file mode 100644 index 000000000..0824933aa Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/1.png differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/2.jpg b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/2.jpg new file mode 100644 index 000000000..128caa983 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/2.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/3.jpg b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/3.jpg new file mode 100644 index 000000000..cceb62bfb Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/3.jpg differ diff --git a/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/4.png b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/4.png new file mode 100644 index 000000000..cfb824979 Binary files /dev/null and b/src/third-party/model3d/1.1.1/WebVR/viveController/images/64/4.png differ diff --git a/src/third-party/model3d/1.1.1/box3d-runtime.min.js b/src/third-party/model3d/1.1.1/box3d-runtime.min.js new file mode 100644 index 000000000..97118b207 --- /dev/null +++ b/src/third-party/model3d/1.1.1/box3d-runtime.min.js @@ -0,0 +1,21 @@ +(function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("THREE")):"function"==typeof define&&define.amd?define("Box3D",["THREE"],t):"object"==typeof exports?exports.Box3D=t(require("THREE")):e.Box3D=t(e.THREE)})(this,function(e){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=272)}([function(e,t,r){"use strict";function i(e,t){function r(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function n(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function o(e,t){return function(r,i){t(r,i,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))(function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(o,s)}u((i=i.apply(e,t||[])).next())})}function p(e,t){function r(e){return function(t){return i([e,t])}}function i(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,a&&(o=a[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(a,r[1])).done)return o;switch(a=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,a=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(o=u.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function h(){for(var e=[],t=0;t=e&&(t.engine.off("update",i,t),t.trigger("endTimer"))};this.engine.on("update",i,this)},t.events={load:{params:[],action:!1,category:"Loading"},loadBase:{params:[],action:!1,category:"Loading"},loadDependencies:{params:[],action:!1,category:"Loading"},startTimer:{params:[{name:"time",description:"The time (in seconds) that will elapse before the 'endTimer' event will be fired.",type:"f",default:5}],action:!0,category:"General"},endTimer:{params:[],action:!1,category:"General"}},t.validators={},t.defaults={},t.schema={},t}(t.baseEntityMixins);t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.on("setVisible",this.setVisible,this),this.on("setInvisible",this.setInvisible,this),this.on("toggleVisibility",this.toggleVisibility,this),this.on("change:children",this.onChildrenChanged,this)},t.prototype.uninitialize=function(){this.off("setVisible",this.setVisible,this),this.off("setInvisible",this.setInvisible,this),this.off("toggleVisibility",this.toggleVisibility,this),this.off("change:children",this.onChildrenChanged,this),this.uninitPrefabBindings(),e.prototype.uninitialize.call(this)},t.prototype.getRootObject=function(){var e=this.getParentObject();return e?e.getRootObject():this},t.prototype.reset=function(){this.runtimeData&&(this.runtimeData.position.copy(this.getPosition()),this.runtimeData.quaternion.copy(this.getQuaternion()),this.runtimeData.scale.copy(this.getScale()))},t.prototype.createRuntimeData=function(e){this.runtimeData=new a.Object3D,this.runtimeData.name=this.getRuntimeName(),e()},t.prototype.clone=function(t,r){void 0===r&&(r=!0);var i=e.prototype.clone.call(this,t);if(i.set("parentId",null),i.set("prefabAssetId",this.get("prefabAssetId")),i.set("prefabObjectId",this.get("prefabObjectId")),r){var n=this.getChildren();n.forEach(function(e){var t=e.clone(void 0,r);i.addChild(t)}),this.isInstanceTop()&&(i.set("prefabInstanceId",i.id),i.traverse(function(e){e.set("prefabInstanceId",i.id)}))}return i},t.prototype.alignToPosition=function(e,t){var r=new a.Vector3(e.x||0,e.y||0,e.z||0),n=this.getQuaternion(),o=this.getScale(),s=this.getCenter(),u=new a.Quaternion(n.x,n.y,n.z,n.w),p=this.getBounds(),c={};c.min=new a.Vector3(p.min.x,p.min.y,p.min.z),c.max=new a.Vector3(p.max.x,p.max.y,p.max.z),c.min.applyQuaternion(u),c.max.applyQuaternion(u);var l=new a.Vector3(s.x,s.y,s.z);l.applyQuaternion(u),c.min.multiply(o),c.max.multiply(o),l.multiply(o),t&&Object.keys(t).forEach(function(e){var i=Math.min(c.min[e],c.max[e]),n=Math.max(c.min[e],c.max[e]),a=.5*t[e]+.5;r[e]-=(1-a)*i+a*n}),this.setProperty("position",i.__assign({},r))},t.prototype.getPosition=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("position")),t},t.prototype.setPosition=function(e,t,r){if(void 0===r)throw new Error("Calling setPosition with invalid arguments. Expected setPosition( x, y, z ).");this.setProperty("position",{x:e,y:t,z:r})},t.prototype.getQuaternion=function(e){var t=e||new a.Quaternion;return t.copy(this.getProperty("quaternion")),t},t.prototype.setQuaternion=function(e,t,r,i){if(void 0===i)throw new Error("Calling setQuaternion with invalid arguments. Expected setQuaternion( x, y, z, w ).");this.setProperty("quaternion",{x:e,y:t,z:r,w:i})},t.prototype.getScale=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("scale")),t},t.prototype.setScale=function(e,t,r){if(void 0===r)throw new Error("Calling setScale with invalid arguments. Expected setScale( x, y, z ).");this.setProperty("scale",{x:e,y:t,z:r})},t.prototype.getCenter=function(e){var t=e||new a.Vector3,r=this.getBounds();return t.copy(r.min),t.add(r.max),t.multiplyScalar(.5),t},t.prototype.setVisible=function(){this.setProperty("visible",!0),this.engine.needsRender=!0},t.prototype.setInvisible=function(){this.setProperty("visible",!1),this.engine.needsRender=!0},t.prototype.toggleVisibility=function(){var e=!this.getProperty("visible");this.setProperty("visible",e),this.engine.needsRender=!0},t.prototype.loadBase=function(t){e.prototype.loadBase.call(this,t),this.isInstance()&&this.initPrefabBindings()},t.prototype.reloadBase=function(t){var r=this;this.isInstance()&&this.uninitPrefabBindings();var i=this.runtimeData&&this.runtimeData.parent;i&&i.remove(this.runtimeData);var n=this.runtimeData&&this.runtimeData.children;e.prototype.reloadBase.call(this,function(){i&&i.add(r.runtimeData),n&&n.forEach(function(e){return r.runtimeData.add(e)}),"function"==typeof t&&t()})},t.prototype.unload=function(t){var r=this;if(void 0===t&&(t=!1),this.runtimeData&&this.runtimeData.parent&&this.runtimeData.parent.remove(this.runtimeData),t){var i=this.getChildIds();i.forEach(function(e){var i=r.engine.getObjectById(e);i&&i.unload(t)})}e.prototype.unload.call(this)},t.prototype.destroy=function(){this.engine.destroyObjectById(this.id)},t.prototype.traverse=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t),r.traverse(e)})},t.prototype.traverseWhile=function(e){var t=this,r=this.getChildren();return r.some(function(r){return e(r,t)||r.traverseWhile(e)})},t.prototype.traverseSome=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t)||r.traverseSome(e)})},t.prototype.getAncestors=function(e){var t=this.getParentObject();return t?e&&!e(t)?t.getAncestors(e):[t].concat(t.getAncestors(e)):[]},t.prototype.getDescendants=function(e){var t=[],r="function"!=typeof e; +return this.traverse(function(i){(r||e(i))&&t.push(i)}),t},t.prototype.getDescendant=function(e){var t,r="function"!=typeof e;return this.traverseWhile(function(i){if(!t&&(r||e(i)))return t=i,!0}),t},t.prototype.getDescendantById=function(e){return this.getDescendant(function(t){return t.id===e})},t.prototype.getDescendantByName=function(e){return this.getDescendant(function(t){return t.getName()===e})},t.prototype.getDescendantByType=function(e){return this.getDescendant(function(t){return t.type===e})},t.prototype.getDescendantByClass=function(e){return this.getDescendant(function(t){return t instanceof e})},t.prototype.getDescendantsByType=function(e){return this.getDescendants(function(t){return t.type===e})},t.prototype.getDescendantsByClass=function(e){return this.getDescendants(function(t){return t instanceof e})},t.prototype.getDescendantsByName=function(e){return this.getDescendants(function(t){return t.getName()===e})},t.prototype.getChildById=function(e){return this.sharedData.children.indexOf(e)!==-1?this.engine.getObjectById(e):null},t.prototype.getChild=function(e){var t=this.getChildren(e);return t.length?t[0]:null},t.prototype.getChildren=function(e){var t=this,r=this.getChildIds(),i="function"!=typeof e;return r.filter(function(r){var n=t.getChildById(r);return n&&(i||e(n))}).map(function(e){return t.engine.getObjectById(e)})},t.prototype.getChildrenMap=function(e){var t={},r=this.getChildren(e);return r.forEach(function(e){e&&(t[e.id]=e)}),t},t.prototype.getParentObject=function(){return this.engine.getObjectById(this.get("parentId"))},t.prototype.addChild=function(e,t){this.addChildById(e.id,t)},t.prototype.addChildById=function(e,t){var r=this.engine.getObjectById(e);if(!r)throw new Error("Can't find child object with id, "+e);this.engine.entityDispatcher.dispatchChildAdded(this.id,e,t)},t.prototype.removeChild=function(e,t){this.removeChildById(e.id,t)},t.prototype.removeChildById=function(e,t){var r=this.getChildById(e);return r?void this.engine.entityDispatcher.dispatchChildRemoved(this.id,e,t):void n.default.warn("Object, "+e+", is not a child of this object")},t.prototype.getChildIds=function(e){var t="function"!=typeof e;return t?this.sharedData.children.slice():this.sharedData.children.filter(function(t){return e(t)})},t.prototype.setChildIds=function(e,t){void 0===t&&(t=!1),this.engine.entityDispatcher.dispatchChildChanged(this.id,e,t)},t.prototype.scaleToSize=function(e){var t={},r=this.getBounds();t.min=new a.Vector3(r.min.x,r.min.y,r.min.z),t.max=new a.Vector3(r.max.x,r.max.y,r.max.z);var i=t.min.distanceTo(t.max),n=e/i;n<=0&&(n=1),this.setProperty("scale",{x:n,y:n,z:n})},t.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return t?r.set(t.min,t.max):this.computeBounds(r)},t.prototype.getSphericalBounds=function(e){var t=e||new a.Sphere,r=this.getBounds();return t.radius=t.center.subVectors(r.max,r.min).multiplyScalar(.5).length(),t.center.addVectors(r.max,r.min).multiplyScalar(.5),t},t.prototype.getLocalBounds=function(e){var t=e||new a.Box3;return t.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),t},t.prototype.computeBounds=function(e){var t=this.getChildren(),r=this.getLocalBounds(e||new a.Box3),i=new a.Matrix4;return t.forEach(function(e){var t=e.computeBounds();t.isEmpty()||(i.compose(e.getPosition(),e.getQuaternion(),e.getScale()),t.applyMatrix4(i),r.union(t))}),this.setProperty("bounds",{min:{x:r.min.x,y:r.min.y,z:r.min.z},max:{x:r.max.x,y:r.max.y,z:r.max.z}}),r},t.prototype.getPreviousProperty=function(e){var t=this.sharedData.previousProperties[e];if(void 0!==t)return t;var r=this.getPrefabObject();return r?r.getProperty(e):this.getDefaultProperty(e)},t.prototype.getProperty=function(e){var t=this.getOwnProperty(e);if(void 0!==t)return t;var r=this.getPrefabProperty(e);return r?r:this.getDefaultProperty(e)},t.prototype.getProperties=function(){var e=this.getOwnProperties(),t=this.getPrefabObject(),r=this.getDefaultProperties();if(t){var i=t.getOwnProperties();return Object.assign(r,i,e)}return Object.assign(r,e)},t.prototype.getInstanceTop=function(){var e=this.get("prefabInstanceId");return e?this.engine.getObjectById(e):null},t.prototype.getPrefabObject=function(){return this.engine.getObjectById(this.get("prefabObjectId"))},t.prototype.getPrefabProperty=function(e){var t=this.getPrefabObject();if(t)return t.getProperty(e)},t.prototype.isInstance=function(){return!!this.get("prefabObjectId")},t.prototype.isInstanceTop=function(){return this.get("prefabInstanceId")===this.id},t.prototype.breakPrefabLink=function(e){if(void 0===e&&(e=!0),!this.isInstance())throw new Error("breakPrefabLink: Can't call this on an entity that isn't an instance.");e&&this.getChildren().forEach(function(t){t.breakPrefabLink(e)}),this.uninitPrefabBindings(),this.mergeProperties(this.getPrefabObject());var t={};t.prefabInstanceId=void 0,t.prefabObjectId=void 0,t.prefabAssetId=void 0},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),t.hasOwnProperty("static")){var i=this.getProperty("static");this.runtimeData.matrixAutoUpdate=!i,this.runtimeData.rotationAutoUpdate=!i,i&&(this.runtimeData.matrixWorldNeedsUpdate=!0,this.runtimeData.updateMatrix())}if(t.hasOwnProperty("visible")&&(this.runtimeData.visible=this.getProperty("visible")),t.hasOwnProperty("castShadow")&&(this.runtimeData.castShadow=this.getProperty("castShadow")),t.hasOwnProperty("receiveShadow")&&(this.runtimeData.receiveShadow=this.getProperty("receiveShadow")),t.hasOwnProperty("frustumCulled")&&(this.runtimeData.frustumCulled=this.getProperty("frustumCulled")),t.hasOwnProperty("position")){var n=this.getPosition();this.runtimeData.position.set(n.x,n.y,n.z)}if(t.hasOwnProperty("quaternion")){var a=this.getQuaternion();this.runtimeData.quaternion.set(a.x,a.y,a.z,a.w)}if(t.hasOwnProperty("scale")){var o=this.getScale();this.runtimeData.scale.set(o.x,o.y,o.z)}this.engine.needsRender=!0},t.prototype.getRuntimeName=function(){return this.engine.getRuntimeName(this.getSid())},t.prototype.initPrefabBindings=function(){var e=this.getPrefabObject();e&&e.on("change:properties",this.onPrefabEntityChanged,this)},t.prototype.uninitPrefabBindings=function(){var e=this.getPrefabObject();e&&e.off("change:properties",this.onPrefabEntityChanged,this)},t.prototype.onPrefabEntityChanged=function(){n.default.warn("TODO - re-implement updating from prefab changes")},t.prototype.onChildLoaded=function(e){var t=this;this.when("loadBase",function(){t.runtimeData.add(e.runtimeData),t.engine.needsRender=!0})},t.prototype.onChildrenChanged=function(e,t){var r=this;t.forEach(function(e){e&&(e.set("parentId",null),r.unregisterDependency(e),r.stopListening(e,"loadBase",r.onChildLoaded),r.isBaseLoaded()&&e.isBaseLoaded()&&(r.runtimeData.remove(e.runtimeData),r.engine.needsRender=!0))}),e.forEach(function(e){var t=e.getParentObject();t&&t.id!==r.id&&t.removeChildById(e.id,!0),e.set("parentId",r.id),r.listenTo(e,"loadBase",r.onChildLoaded),e.isBaseLoaded()&&(r.isBaseLoaded()?(r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0):r.when("loadBase",function(){r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0})),r.registerDependency(e)}),this.unsetProperty("bounds"),this.getAncestors().forEach(function(e){return e.unsetProperty("bounds")})},t.events={toggleVisibility:{params:[],action:!0,category:"Rendering"},setVisible:{params:[],action:!0,category:"Rendering"},setInvisible:{params:[],action:!0,category:"Rendering"}},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={LOAD:"load",STATE_CHANGE:"state_change",CANCEL:"cancel",ERROR:"error",PROGRESS:"progress",DONE:"done"};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,n=r(0),a=r(1),o=r(6),s=r(3);(function(e){e[e.Normal=101]="Normal",e[e.Stereo2dOverUnder=102]="Stereo2dOverUnder",e[e.Stereo2dUnderOver=103]="Stereo2dUnderOver",e[e.Stereo2dLeftRight=104]="Stereo2dLeftRight",e[e.Stereo2dRightLeft=105]="Stereo2dRightLeft",e[e.StereoCubeHorizontal=106]="StereoCubeHorizontal"})(i=t.ImageLayout||(t.ImageLayout={}));var u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.loadedBytes=0,t}return n.__extends(t,e),t.getThreeImageFormat=function(e){switch(e){case"alpha":return a.AlphaFormat;case"rgb":return a.RGBFormat;case"rgba":return a.RGBAFormat;case"luminance":return a.LuminanceFormat;case"luminanceAlpha":return a.LuminanceAlphaFormat;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.RGBFormat"),a.RGBFormat}},t.getThreeImageEncoding=function(e){switch(e){case"linear":return a.LinearEncoding;case"srgb":return a.sRGBEncoding;case"gamma":return a.GammaEncoding;case"rgbe":return a.RGBEEncoding;case"logLuv":return a.LogLuvEncoding;case"rgbm7":return a.RGBM7Encoding;case"rgbm16":return a.RGBM16Encoding;case"rgbd":return a.RGBDEncoding;case"depth":return a.BasicDepthPacking;case"rgbaDepth":return a.RGBADepthPacking;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.sRGBEncoding"),a.sRGBEncoding}},t.getThreeDataType=function(e){switch(e){case"uByte":return a.UnsignedByteType;case"byte":return a.ByteType;case"short":return a.ShortType;case"uShort":return a.UnsignedShortType;case"int":return a.IntType;case"uInt":return a.UnsignedIntType;case"float":return a.FloatType;case"halfFloat":return a.HalfFloatType;case"uShort4444":return a.UnsignedShort4444Type;case"uShort5551":return a.UnsignedShort5551Type;case"uShort565":return a.UnsignedShort565Type;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.UnsignedByteType"),a.UnsignedByteType}},t.getChannelCountFromFormat=function(e){switch(e){case"alpha":case"luminance":return 1;case"luminanceAlpha":return 2;case"rgb":return 3;case"rgba":return 4;default:return 0}},t.prototype.unload=function(){this.loadedBytes=0,e.prototype.unload.call(this)},t.prototype.getChosenRepresentation=function(){return this.chosenRepresentation},t.prototype.getDataSizeLoadedSelf=function(){return this.loadedBytes},t.prototype.applyPropertiesUnloaded=function(t){void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),this.engine.trigger("imageChanged",this.id,t)},t.prototype.getDataSizeDownloadSelf=function(){return this.chosenRepresentation?this.chosenRepresentation.contentLength:1},t.prototype.getFormat=function(){return"rgb"},t.prototype.isPowerOfTwo=function(){var e=this.getWidth(),t=this.getHeight();return a.Math.isPowerOfTwo(e)&&a.Math.isPowerOfTwo(t)},t.prototype.getWidth=function(){var e=this.getMaxRepresentationWidth(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getHeight=function(){var e=this.getMaxRepresentationHeight(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getMaxRepresentationWidth=function(){return 0},t.prototype.getMaxRepresentationHeight=function(){return 0},t.prototype.getOriginalWidth=function(){return 0},t.prototype.getOriginalHeight=function(){return 0},t.prototype.getMaxTextureSize=function(){return Number.MAX_VALUE},t}(o.default);t.default=u},function(e,t,r){"use strict";function i(e,t){if(void 0!==e&&null!==e)return Array.isArray(e)?e.forEach(t):void Object.keys(e).forEach(function(r){t(e[r],r)})}function n(e){return Array.isArray(e)?[].concat.apply([],e.map(function(e){return n(e)})):e}function a(e,t){return e.reduce(function(e,r){return e[r[t]]=r,e},{})}function o(e,t){return n(u(e,t))}function s(e){return e}function u(e,t){var r;return void 0===e||null===e?e:Array.isArray(e)?e.map(t):(r={},Object.keys(e).forEach(function(i){r[i]=t(e[i],i)}),r)}function p(e,t){return Object.keys(e).reduce(function(r,i){return t.indexOf(i)===-1&&(r[i]=e[i]),r},{})}e.exports={each:i,flatMap:o,flatten:n,identity:s,indexBy:a,map:u,omit:p}},function(e,t,r){"use strict";function i(e,t){var r=Math.floor(e),i=t?t:{r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255};return i}Object.defineProperty(t,"__esModule",{value:!0});var n,a=r(0),o=r(3),s=r(1),u=r(6),p=r(5),c=r(4),l=r(229);(function(e){e[e.STANDIN_TEXTURE_WHITE=0]="STANDIN_TEXTURE_WHITE",e[e.STANDIN_TEXTURE_WHITE_CUBE=1]="STANDIN_TEXTURE_WHITE_CUBE",e[e.STANDIN_TEXTURE_BLACK=2]="STANDIN_TEXTURE_BLACK",e[e.STANDIN_TEXTURE_BLACK_CUBE=3]="STANDIN_TEXTURE_BLACK_CUBE",e[e.STANDIN_TEXTURE_NORMAL=4]="STANDIN_TEXTURE_NORMAL"})(n=t.StandInTexture||(t.StandInTexture={}));var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.listenTo(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.uninitialize=function(){e.prototype.uninitialize.call(this),this.stopListening(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.getProperty=function(t){var r=e.prototype.getProperty.call(this,t);if(void 0===r){var i=this.getShader().getProperty("parameters");i[t]&&(r=i[t].default)}return r},t.prototype.getDefaultProperties=function(){var t=e.prototype.getDefaultProperties.call(this),r=this.getShader().getProperty("parameters");return Object.keys(r).forEach(function(e){t[e]=r[e].default}),t},t.prototype.verifyProperty=function(r,i){return!t.schema.properties[r]||e.prototype.verifyProperty.call(this,r,i)},t.prototype.setProperty=function(r,n,a){if(t.schema.properties[r])return e.prototype.setProperty.call(this,r,n,a);var s=this.getShader(),u=s.getProperty("parameters");if(u[r]){var p,c=u[r].type;if("t"===c&&("string"==typeof n||null===n)||"f"===c&&"number"==typeof n||"b"===c&&"boolean"==typeof n||"i"===c&&"number"==typeof n&&Math.round(n)===n||"opt"===c&&u[r].options.hasOwnProperty(n))p=n;else if("c"===c){if(p=this.sharedData.properties.hasOwnProperty(r)&&"object"==typeof this.sharedData.properties[r]?this.sharedData.properties[r]:{r:0,g:0,b:0},"string"==typeof n){var l=n;"0x"!==l.slice(0,2)&&(l=String(parseInt(l,10)),l="0x"+l.toString()),i(parseInt(l,16),p)}else if("number"==typeof n){var d=Math.max(0,Math.max(16777215,n));i(d,p)}else if(n&&"number"==typeof n.r&&"number"==typeof n.g&&"number"==typeof n.b){p.r=n.r,p.g=n.g,p.b=n.b;var h=u[r].min,f=u[r].max;void 0!==h&&(p.r=Math.max(p.r,h),p.g=Math.max(p.g,h),p.b=Math.max(p.b,h)),void 0!==f&&(p.r=Math.min(p.r,f),p.g=Math.min(p.g,f),p.b=Math.min(p.b,f))}}else"v"===c.charAt(0)&&"number"==typeof n.x&&"number"==typeof n.y?(p=this.sharedData.properties.hasOwnProperty(r)?this.sharedData.properties[r]:{},p.x=n.x,p.y=n.y,"v3"===c&&"number"==typeof n.z?p.z=n.z:"v4"===c&&"number"==typeof n.z&&"number"==typeof n.w&&(p.z=n.z,p.w=n.w)):"undefined"==typeof n?p=void 0:o.default.error("Wrong type specified for "+r);this.engine.entityDispatcher.dispatchPropertyChanged(this.id,r,p,a)}},t.prototype.getReferencedAssetsList=function(e){var t=this,r=[],i={},n=this.getShader(),a=n.getProperty("parameters");return p.forEach(a,function(n,a){var o,s;"t"===n.type&&(t.isParameterUsed(a)&&(o=t.getProperty(a)),o&&(s=t.engine.getAssetById(o),i[o]?e&&r.push(s):(i[o]=s,r.push(s))))}),r},t.prototype.getShader=function(){var t=e.prototype.getProperty.call(this,"shaderId");return this.engine.getAssetById(t)||(t=this.getDefaultProperty("shaderId")),this.engine.getAssetById(t)},t.prototype.isParameterEditable=function(e){var t=this.getShader();if(!t)return!1;var r=t.getProperty("parameters");return!!r[e]&&(!r[e].displayWhen||this.testParameterConditions(r[e].displayWhen))},t.prototype.getStandInTexture=function(e,t){var r=this.engine.getAssetById(this.getProperty(e));if(r){var i;return t?"normal"===t?i=n.STANDIN_TEXTURE_NORMAL:"bump"===t&&(i=r.isCubeMap()?n.STANDIN_TEXTURE_BLACK:n.STANDIN_TEXTURE_BLACK_CUBE):i=r.isCubeMap()?n.STANDIN_TEXTURE_WHITE_CUBE:n.STANDIN_TEXTURE_WHITE,this.engine.materialUtilities.getStandInTexture(i)}},t.prototype.unload=function(){var t=this;if(this.getDependencies().forEach(function(e){return t.stopListening(e,"load")}),this.runtimeData){this.engine.trigger("materialUnloaded",this.id),o.default.info(this.engine.getName()+" - Unloading material, "+this.getName());for(var r in this.runtimeData)this.runtimeData.hasOwnProperty(r)&&(this.runtimeData[r].dispose(),delete this.runtimeData[r]);this.runtimeData=null,e.prototype.unload.call(this)}},t.prototype.applyPropertiesLoaded=function(r,i){var n=this;if(e.prototype.applyPropertiesLoaded.call(this,r,i),r.hasOwnProperty("shaderId")){var a=this.getShader(),o=this.getPreviousProperty("shaderId");if(o!==a.id&&"init"!==i&&this.getThreeConstructor()!==this.getThreeConstructor(o))return void this.reloadBase();a.when("load",function(){p.forEach(t.materialObjectTypes,function(e,t){var r=n.runtimeData[t];r instanceof s.ShaderMaterial&&(r.vertexShader=a.runtimeData.vertexShader,r.fragmentShader=a.runtimeData.fragmentShader,r.uniforms=s.UniformsUtils.clone(a.runtimeData.uniforms),n.addSharedUniforms(r.uniforms)),r.needsUpdate=!0}),n.updateMaterialDefines(),n.updateShaderParameters(n.getProperties()),n.updateTransparency(),n.updateDerivatives(),n.engine.needsRender=!0}),a.isUnloaded()&&a.load()}else{var u=this.getShader(),c=u.getProperty("parameters"),l=!1,d=!1,h=!1;for(var f in r)if(r.hasOwnProperty(f)&&c[f]){if(c[f].transparency&&(l=!0),"undefined"!=typeof c[f].derivatives&&(d=!0),u.getDependentParameters(f).length||c[f].forceUpdate){h=!0;break}this.updateShaderParameter(f)}h&&(this.updateMaterialDefines(),this.updateShaderParameters(this.getProperties()),l=!0,d=!0),l&&this.updateTransparency(),d&&this.updateDerivatives(),this.engine.needsRender=!0}},t.prototype.applyPropertiesUnloaded=function(t){var r=this;void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t);var i,n,a=this.getShader(),o=a.getProperty("parameters"),s=!1;t&&(t.hasOwnProperty("shaderId")&&this.cleanShaderParameters(),p.forEach(t,function(e,t){o[t]&&("t"===o[t].type&&(i=r.getProperty(t),n=r.getPreviousProperty(t),r.isParameterUsed(t)?n!==i&&(r.registerDependencyById(i),r.unregisterDependencyById(n)):n!==i&&(s=!0)),(a.getDependentParameters(t).length||o[t].forceUpdate)&&(s=!0))}),s&&this.resetDependencies())},t.prototype.createRuntimeData=function(e){var r=this,i=this.getShader();i.when("load",function(){r.runtimeData={};var n={},a=r.getThreeConstructor();a===s.ShaderMaterial&&(n.vertexShader=i.runtimeData.vertexShader,n.fragmentShader=i.runtimeData.fragmentShader,n.uniforms=s.UniformsUtils.clone(i.runtimeData.uniforms),r.addSharedUniforms(n.uniforms)),Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e]=new a(n),r.runtimeData[e].name=r.getName();var i=t.materialObjectTypes[e];p.forEach(i,function(t,i){r.runtimeData[e].hasOwnProperty(i)&&(r.runtimeData[e][i]=p.deepClone(t))})}),e()},this),i.isUnloaded()&&i.load()},t.prototype.getThreeConstructor=function(e){var t=e?this.engine.getAssetById(e):this.getShader();if(!t)throw new Error("Bad or unknown shader ID, "+e);t.isUnloaded()&&t.load();var r;switch(t.runtimeData.vertexShader){case"MeshPhongMaterial":r=s.MeshPhongMaterial;break;case"MeshLambertMaterial":r=s.MeshLambertMaterial;break;default:r=s.ShaderMaterial}return r},t.prototype.testParameterCondition=function(e,t){var r=this.getShader(),i=r.getProperty("parameters");if(!i[e])return!1;var n=this.getProperty(e);"t"===i[e].type&&(this.engine.getAssetById(n)||(n=null));for(var a in t)if(t.hasOwnProperty(a))switch(a){case"equals":if(!p.shallowEquals(n,t[a]))return!1;break;case"notEquals":if(p.shallowEquals(n,t[a]))return!1;break;case"equalsDefault":if(!p.shallowEquals(n,i[e].default))return!1;break;case"notEqualsDefault":if(p.shallowEquals(n,i[e].default))return!1;break;default:return!1}return!0},t.prototype.testParameterConditions=function(e){var t=!0;for(var r in e)if(e.hasOwnProperty(r))if("or"===r){if(!this.testParameterConditionsOr(e[r])){t=!1;break}}else if(!this.testParameterCondition(r,e[r])){t=!1;break}return t},t.prototype.testParameterConditionsOr=function(e){for(var t=!1,r=0,i=e;r1;if("NotFalsy"===t)return this.getProperty(e);if("HasAlpha"===t&&"t"===i[e].type){var n=this.engine.getAssetById(this.getProperty(e));return n&&"rgba"===n.getFormat()}}return!1},t.prototype.isParameterUsed=function(e){var t,r=this.getShader(),i=!1;if(r)return t=r.getProperty("parameters"),t[e]&&(i=!t[e].enabledWhen||this.testParameterConditions(t[e].enabledWhen)),i},t.prototype.onTextureLoaded=function(e){var r=this;if(!e.isLoadFailed()){var i=e.getThreeTexture();if(i){var n=this.getShader();if(n){var a=n.getProperty("parameters"),o=Object.keys(a).filter(function(t){return"t"===a[t].type&&r.isParameterUsed(t)&&r.getProperty(t)===e.id});o.forEach(function(e){r.setThreeValue(e,i)});var s=o.some(function(e){return a[e].forceUpdate});s&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0}),this.engine.needsRender=!0}}}},t.prototype.updateShaderParameter=function(e){var r=this,i=this.getShader(),n=i.getProperty("parameters"),a=n[e];if(a){var o=!0,s=this.getProperty(e);switch(a.type.charAt(0)){case"t":var u=this.engine.getAssetById(s);if(u&&this.isParameterUsed(e)){var p=this.getPreviousProperty(e);if(p!==this.getProperty(e)){var c=this.engine.getEntityById(p);c&&this.stopListening(c,"loadBase",this.onTextureLoaded)}this.stopListening(u,"loadBase",this.onTextureLoaded),this.listenTo(u,"loadBase",this.onTextureLoaded),s=this.getStandInTexture(e,a.textureUsage),this.engine.needsRender=!0,u.isUnloaded()?u.load():u.isBaseLoaded()&&this.onTextureLoaded.call(this,u),u.isBaseLoaded()&&(o=!1)}else s=null;break;case"b":a.animation&&s&&(t.timeValueInUse=!0),s=s?1:0;break;case"v":a.animation&&(s.x||s.y||s.z||s.w)&&(t.timeValueInUse=!0);break;case"o":s=a.options[s]}o&&this.setThreeValue(e,s),a.forceUpdate&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0})}},t.prototype.getThreeValue=function(e,t){var r,i=this.getShader(),n=i.getProperty("parameters"),a=n[e],o=a.uniformName||e;if(a.isRenderParam)r=this.runtimeData[t][o];else if(a.isUniform){var u=this.runtimeData[t].uniforms[o];r=u?u.value:null}if("c"===a.type)r||(r=new s.Color(a.default.r,a.default.g,a.default.b));else if("v"===a.type.charAt(0)&&!r){var p=a.default;switch(a.type.charAt(1)){case"4":r=new s.Vector4(p.x,p.y,p.z,p.w);break;case"3":r=new s.Vector3(p.x,p.y,p.z);break;case"2":r=new s.Vector2(p.x,p.y)}}return r},t.prototype.setThreeValue=function(e,r){var i=this;if(this.runtimeData){var n=this.getShader(),a=n.getProperty("parameters"),o=a[e],s=o.uniformName||e;Object.keys(t.materialObjectTypes).forEach(function(t){var n=i.getThreeValue(e,t);if("c"===o.type)n.setRGB(r.r,r.g,r.b);else if("b"===o.type)n=!!r;else if("v"===o.type.charAt(0))switch(o.type.charAt(1)){case"4":n.w=r.w;case"3":n.z=r.z;case"2":n.x=r.x,n.y=r.y}else"t"===o.type?(n&&r&&n.encoding===r.encoding&&n.mapping===r.mapping||(i.runtimeData[t].needsUpdate=!0),n=r):n=r;if(o.isUniform){var a=i.runtimeData[t].uniforms[s];if(!a)throw new Error("Trying to set non-existent uniform "+s);a.value=n}o.isRenderParam&&(i.runtimeData[t][s]=n)})}},t.prototype.setExtension=function(e,r){var i=this;this.runtimeData&&Object.keys(t.materialObjectTypes).forEach(function(t){i.runtimeData[t].extensions&&i.runtimeData[t].extensions.hasOwnProperty(e)&&(i.runtimeData[t].extensions[e]=r)})},t.prototype.onTextureDeleted=function(e){var t=this,r=this.getOwnProperties(),i=Object.keys(r).filter(function(t){return r[t]===e});i.forEach(function(e){t.setProperty(e,null)})},t.builtInAssetDescriptors={missingMaterial:{id:"missingMaterial",type:"material",properties:{name:"Missing Material",albedoColor:{r:.8275,g:.8275,b:.8275}}}},t.materialObjectTypes={static:{lights:!0,fog:!0,skinning:!1},skinned:{lights:!0,fog:!0,skinning:!0},staticTangents:{lights:!0,fog:!0,skinning:!1,defines:{USE_TANGENTS:!0}},skinnedTangents:{lights:!0,fog:!0,skinning:!0,defines:{USE_TANGENTS:!0}},depthStatic:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!1,defines:{DEPTH_PASS:!0}},depthSkinned:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!0,defines:{DEPTH_PASS:!0}}},t.sharedUniforms={time:{type:"f",value:0},screenDimensions:{type:"v4",value:new s.Vector4}},t.timeValueInUse=!1,t}(u.default);c.addSchemas("MaterialAsset",d),t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;(function(e){e[e.BUFFER=1]="BUFFER",e[e.IMAGE=2]="IMAGE",e[e.VIDEO=3]="VIDEO",e[e.ENTITIES=4]="ENTITIES",e[e.JSON=5]="JSON"})(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(39),a=i.__assign({},n.default,{id:"baseObject",title:"BaseObjectDef",properties:i.__assign({},n.default.properties,{parentId:{type:"string",description:"The ID of the entity's parent."},prefabAssetId:{type:"string"},prefabObjectId:{type:"string"},prefabInstanceId:{type:"string"},children:{type:"array",items:{type:"string"},default:[],description:"The IDs of this entity's children."},previousChildren:{type:"array",items:{type:"string"},default:[],description:"The previous IDs of this entity's children."},properties:{$ref:"baseObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(40),a=i.__assign({},n.default,{id:"baseObjectProperties",title:"BaseObjectPropertiesDef",properties:i.__assign({},n.default.properties,{position:{$ref:"vector3.json",default:{x:0,y:0,z:0}},quaternion:{$ref:"vector4.json",default:{x:0,y:0,z:0,w:1}},scale:{$ref:"vector3.json",default:{x:1,y:1,z:1}},castShadow:{type:"boolean",default:!0},receiveShadow:{type:"boolean",default:!0},visible:{type:"boolean",default:!0},bounds:{$ref:"box3.json",description:"#read-only"}})});t.default=a},function(e,t,r){var i=r(270),n=r(271),a=n;a.v1=i,a.v4=n,e.exports=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=r(6),u=r(12),p=r(12),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.createColorTexture=function(e,t,r,i){void 0===e&&(e=255),void 0===t&&(t=255),void 0===r&&(r=255);var n=a.RGBFormat,o=void 0!==i?4:3,s=new Uint8Array(o);s[0]=e,s[1]=t,s[2]=r,4===o&&(s[3]=i,n=a.RGBAFormat);var u=new a.DataTexture(s,1,1,n,void 0,void 0,void 0,void 0,void 0,void 0);return u.needsUpdate=!0,u},t.createColorTextureCube=function(e,r,i,n){void 0===e&&(e=255),void 0===r&&(r=255),void 0===i&&(i=255);var o=[0,1,2,3,4,5].map(function(a){return t.createColorTexture(e,r,i,n)}),s=new a.CubeTexture(o);return s.generateMipmaps=!1,s.format=o[0].format,s.minFilter=a.NearestFilter,s.magFilter=a.NearestFilter,s.needsUpdate=!0,s},t.getBytesPerPixel=function(e,t){var r=0;switch(t){case"float":case"uInt":case"int":r=4;break;case"halfFloat":case"short":case"uShort":r=2;break;case"uByte":case"byte":r=1;break;case"uShort4444":case"uShort5551":case"uShort565":return 2}return u.default.getChannelCountFromFormat(e)*r},t.getMissingTexture=function(){return t.missingTexture2d||(t.missingTexture2d=t.createColorTexture()),t.missingTexture2d},t.getMissingTextureCube=function(){return t.missingTextureCube||(t.missingTextureCube=t.createColorTextureCube()),t.missingTextureCube},t.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.listenTo(this.engine,"imageUnloaded",function(e){t.getProperty("imageId")===e&&t.unload()})},t.prototype.createRuntimeData=function(e){var r=this,i=function(){r.runtimeData=t.getMissingTexture(),r.setState(o.StateType.Base,o.State.Failed),r.trigger("loadProgress",r),"function"==typeof e&&e.call(r)},n=this.getImage();if(n){var a=function(t){return t.runtimeData?(r.createTextureData(t.runtimeData),void("function"==typeof e&&e.call(r))):void i()};this.listenTo(n,"load",a),n.isLoaded()&&a.call(this,n),n.isUnloaded()&&n.load()}else i()},t.prototype.createTextureData=function(e){n.default.warn("Need to implement createTextureData in derrived class.")},t.prototype.unload=function(){var t=this.getImage();t&&this.stopListening(t,"load"),this.runtimeData&&(this.engine.trigger("textureUnloaded",this.id),n.default.info(this.engine.getName()+" - Unloading texture, "+this.getName()),this.runtimeData.dispose()),e.prototype.unload.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r);var i=this.runtimeData instanceof a.WebGLRenderTarget?this.runtimeData.texture:this.runtimeData;t.hasOwnProperty("wrapModeU")&&(i.wrapS=this.getThreeAddressMode(this.getAddressModeU())),t.hasOwnProperty("wrapModeV")&&(i.wrapT=this.getThreeAddressMode(this.getAddressModeV())),t.hasOwnProperty("anisotropy")&&(i.anisotropy=this.getProperty("anisotropy")),t.hasOwnProperty("minFilter")&&(i.minFilter=this.getThreeFilter(this.getMinFilter())),t.hasOwnProperty("magFilter")&&(i.magFilter=this.getThreeFilter(this.getMagFilter())),t.hasOwnProperty("useMipmap")&&(i.generateMipmaps=this.isMipmapsEnabled()),this.engine.needsRender=!0},t.prototype.applyPropertiesUnloaded=function(t){if(void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),t.hasOwnProperty("imageId")){var r=this.getPreviousProperty("imageId");r&&this.unregisterDependencyById(r),t.imageId&&this.registerDependencyById(this.getProperty("imageId"))}this.engine.trigger("textureChanged",this.id,t); +},t.prototype.getAddressModeU=function(){return this.getSupportedAddressMode(this.getProperty("wrapModeU"))},t.prototype.getAddressModeV=function(){return this.getSupportedAddressMode(this.getProperty("wrapModeV"))},t.prototype.getSupportedAddressMode=function(e){var t=this.getImage();return t&&!t.isPowerOfTwo()?"clampToEdge":e},t.prototype.getLayout=function(){var e=this.getProperty("layout");if(e)return e;var t=this.getImage();return t?t.getProperty("layout"):p.ImageLayout.Normal},t.prototype.getWidth=function(){var e=this.getImage();return e?e.getWidth():1},t.prototype.getHeight=function(){var e=this.getImage();return e?e.getHeight():1},t.prototype.getMinFilter=function(){return this.getSupportedFilter(this.getProperty("minFilter"))},t.prototype.getMagFilter=function(){return this.getSupportedFilter(this.getProperty("magFilter"))},t.prototype.getSupportedFilter=function(e){var t=this.getDataType();if(!this.isLinearFilterAvailableForType(t))return"nearest";if(!this.isMipmapsEnabled())switch(e){default:case"nearest":case"nearestWithNearestMipmap":case"nearestWithLinearMipmap":return"nearest";case"linear":case"linearWithNearestMipmap":case"linearWithLinearMipmap":return"linear"}return e},t.prototype.getBytesPerPixel=function(){return t.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.getDataType=function(){var e=this.getProperty("type"),t=e,r=this.engine.getThreeRenderer(),i=r.extensions;switch(e){case"float":if(i.get("OES_texture_float")){t="float";break}case"halfFloat":t=i.get("OES_texture_half_float")?"halfFloat":"uByte";break;default:t=e}return t},t.prototype.getEncoding=function(){var e=this.getProperty("encoding");if(e)return e;var t=this.getImage();if(!t)return"srgb";var r=t.getChosenRepresentation();if(!r)return"srgb";switch(r.colorspace){case"rgb":case"gray":return"linear";default:return"srgb"}},t.prototype.getFormat=function(){var e=this.getOwnProperty("format");if(!e){var t=this.getImage();if(t)return t.getFormat()}return this.getProperty("format")},t.prototype.getThreeFormat=function(){return u.default.getThreeImageFormat(this.getFormat())},t.prototype.getThreeDataType=function(){return u.default.getThreeDataType(this.getDataType())},t.prototype.getThreeEncoding=function(){return u.default.getThreeImageEncoding(this.getEncoding())},t.prototype.getMipCount=function(){if(!this.isMipmapsEnabled())return 1;var e=this.getWidth(),t=this.getHeight(),r=Math.max(e,t);return Math.floor(Math.log2(Math.max(r,1)))+1},t.prototype.getImage=function(){return this.engine.getAssetById(this.getProperty("imageId"))},t.prototype.getDataSizeInMemorySelf=function(){var e=this.getImage();if(e instanceof u.default){var r=e.getChosenRepresentation();if(!r)return e.getDataSizeInMemory();if(r.compression&&"zip"!==r.compression&&"jpeg"!==r.compression)return e.getDataSizeDownloadSelf();if(this.getHdrPackingType(r.channels))return this.getWidth()*this.getHeight()*t.getBytesPerPixel("rgb",this.getDataType())}return this.getWidth()*this.getHeight()*t.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.isCubeMap=function(){return!1},t.prototype.isLinearFilterAvailableForType=function(e){var t=this.engine.getThreeRenderer(),r=t.extensions;switch(e){case"halfFloat":return!!r.get("OES_texture_half_float_linear");case"float":return!!r.get("OES_texture_float_linear");default:return!0}},t.prototype.isMipmapsEnabled=function(){if(!this.isLinearFilterAvailableForType(this.getDataType()))return!1;var e=this.getImage();return!(e&&!e.isPowerOfTwo())&&this.getProperty("useMipmap")},t.prototype.getHdrPackingType=function(e){return e&&4===e.length&&"exponent"===e[3]?"rgbe":null},t.prototype.createDdsTexture=function(e,t){var r=this.parseDDS(e,!0),i=new a.CompressedTexture(null,0,0);i.format=r.format,i.generateMipmaps=!1;var n=function(e){return e.width<=t&&e.height<=t};if(r.isCubemap){i.flipY=!1;for(var o=i.image=[],s=r.mipmaps.length/r.mipmapCount,u=0;u>8&255,e>>16&255,e>>24&255)}function o(e,t,r,i){var n,a,o,s,u,p,c=r*i*4,l=new Uint8Array(e,t,c),d=new Uint8Array(c),h=0,f=0;for(a=0;ae?t.video.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.video&&t.video.height>e?t.video.height:e},0):0},t.prototype.onUpdate=function(){if(this.runtimeData){var e=this.runtimeData.imageData;e&&!e.paused&&!e.error&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.engine.needsRender=!0)}},t.prototype.pause=function(){this.runtimeData&&this.runtimeData.image.pause()},t.prototype.play=function(e,t){this.runtimeData&&(e&&(this.runtimeData.imageData.currentTime=t),this.runtimeData.imageData.play())},t.prototype.stop=function(){this.runtimeData&&(this.runtimeData.imageData.pause(),this.runtimeData.imageData.currentTime=0)},t.prototype.toggle=function(){this.runtimeData&&(this.runtimeData.imageData.paused?this.play():this.pause())},t.prototype.getOriginalWidth=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.width||0,e)},0)},t.prototype.getOriginalHeight=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.height||0,e)},0)},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxHeight:u},e),i=t.map(function(e){return r.maxHeight-(e.video||{}).height||0}),n=i.reduce(function(e,t,r){var n=e>=0?i[e]:Number.MAX_VALUE;return t>=0&&t=0?t[n]:null},t.events={pause:{params:[],action:!0,category:""},play:{params:[{name:"seek",type:"b",description:"",default:!1},{name:"seekTime",type:"f",description:"",default:0}],action:!0,category:""},stop:{params:[],action:!0,category:""},toggle:{params:[],action:!0,category:""}},t}(n.default);s.addSchemas("VideoAsset",p),t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(10),s=r(14),u=r(23),p=r(4),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.engine.on("materialDeleted",this.onMaterialDeleted,this),this.on("setMaterial",this.setMaterial,this),this.on("castShadowsEnable",this.castShadowsEnable,this),this.on("castShadowsDisable",this.castShadowsDisable,this),this.on("castShadowsToggle",this.castShadowsToggle,this)},t.prototype.uninitialize=function(){this.off("setMaterial",this.setMaterial,this),this.off("castShadowsEnable",this.castShadowsEnable,this),this.off("castShadowsDisable",this.castShadowsDisable,this),this.off("castShadowsToggle",this.castShadowsToggle,this),this.engine.off("materialDeleted",this.onMaterialDeleted,this),e.prototype.uninitialize.call(this)},t.prototype.unload=function(t){void 0===t&&(t=!1),this.runtimeData&&(this.runtimeData.material=null,this.runtimeData.geometry=null),e.prototype.unload.call(this,t)},t.prototype.castShadowsDisable=function(){this.setProperty("castShadow",!1)},t.prototype.castShadowsEnable=function(){this.setProperty("castShadow",!0)},t.prototype.castShadowsToggle=function(){var e=!this.getProperty("castShadow");this.setProperty("castShadow",e)},t.prototype.createRuntimeData=function(e){var t=this,r=this.getProperty("geometryId"),i=this.getProperty("skinId"),a=this.engine.materialUtilities.getMissingMaterial(),o=a?a.id:null;Promise.all([this.loadAsset(o),this.loadAsset(r),this.loadAsset(i)]).then(function(){t.createMeshLoaded(),e()}).catch(function(r){t.isDestroyed()||(n.default.error(t.engine.getName()+" - MeshObject: "+r.toString()),t.createDefaultMesh(),"function"==typeof e&&e())})},t.prototype.getGeometry=function(){var e=this.getGeometryAsset();return e?e.getGeometry(u.default.primitiveType.TRIANGLES):null},t.prototype.getGeometryAsset=function(){var e=this.getProperty("geometryId");return e?this.engine.getAssetById(e):null},t.prototype.getLocalBounds=function(e){var r=this.getGeometryAsset();return r?r.getBounds(e):e?e.set(t.defaultLocalBounds.min,t.defaultLocalBounds.max):t.defaultLocalBounds},t.prototype.getMaterial=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=!0),e<0||e>=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getPreviousMaterial=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=!0),e<0||e>=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getPreviousMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getMaterialCount=function(){return this.getMaterialIds().length},t.prototype.getMaterials=function(e){void 0===e&&(e=!0);for(var t=[],r=this.getMaterialCount(),i=0;i=this.getMaterialCount())throw new Error("Invalid index parameter");var r=e instanceof s.default?e.id:e,i=(this.getOwnProperty("materials")||[]).slice();i[t]!==r&&(i[t]=r,this.setProperty("materials",i))},t.prototype.getMaterialIds=function(){for(var e=this.getProperty("materials"),t=this.getPrefabObject(),r=t?t.getProperty("materials"):[],i=[],n=Math.max(e.length,r.length),a=0;athis.pitchAngleBoundsMax?this.targetEuler.x=this.pitchAngleBoundsMax:this.targetEuler.x1&&n.default.warn('Clip "'+e+'" contains multiple layers, but AnimationAsset.prototype.createAnimation() only supports a single layer.');var i=this.getLayer(r.layers[0]),o=i?i.channels.map(function(e){return t.getChannel(e)}):[],s=o.map(function(e){return t.createKeyframeTrack(e,r.start,r.stop)});return new a.AnimationClip(r.name,r.stop-r.start,s)},t.prototype.createKeyframeTrack=function(e,t,r){var i=this,n=e.times.split("#"),o=n[0],u=n[1],p=this.engine.getEntityById(o);if(!p)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+o);var c=p.getAccessor(u),l=p.getArray(u);if(!c||!l)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+u);var d=e.values.split("#"),h=d[0],f=d[1],m=this.engine.getEntityById(h);if(!m)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+h);var y=m.getAccessor(f),g=m.getArray(f);if(!y||!g)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+f);var v,b=e.targetObject.map(function(e){return i.engine.getRuntimeName(e)}),P=b.join("/")+"."+e.targetProperty,x="quaternion"===e.targetProperty?a.QuaternionKeyframeTrack:a.VectorKeyframeTrack,E=-1;for(v=0;v=t){E=v;break}var w=-1;for(v=l.length;v-- >0;)if(l[v]<=r){w=v;break}var _=E>=0?E:0,S=w>=0?w+1:l.length,D=s.default.getTypeSize(y.type),A=l.subarray(_,S),T=g.subarray(_*D,S*D),M=0===t?A:A.slice().map(function(e){return e-t});return new x(P,M,T,null)},t}(o.default);p.addSchemas("AnimationAsset",c),t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(6),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.uninitialize=function(){this.runtimeData&&this.runtimeData.pause(),e.prototype.uninitialize.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),this.runtimeData&&(t.hasOwnProperty("loop")&&(this.runtimeData.loop=this.getProperty("loop")),t.hasOwnProperty("state")))switch(this.getProperty("state")){case"pause":this.runtimeData.pause();break;case"play":this.runtimeData.play()}},t}(n.default);a.addSchemas("AudioAsset",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(19),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){this.createRTImageData(),this.trigger("loadProgress",this),e()},t.prototype.getLayout=function(){return this.getProperty("layout")},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r),(t.hasOwnProperty("format")||t.hasOwnProperty("type")||t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(this.runtimeData.__webglFramebuffer&&(this.runtimeData.dispose(),delete this.runtimeData.__webglFramebuffer),this.runtimeData.texture.format=this.getThreeFormat(), +this.runtimeData.texture.type=this.getThreeDataType(),this.runtimeData.texture.height=this.getHeight(),this.runtimeData.texture.width=this.getWidth()),this.runtimeData.texture.encoding=this.getThreeEncoding()},t}(n.default);t.default=a},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(20),p=r(5),c=r(4),l=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(r,t),r.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return r.set(t.min,t.max)},r.prototype.getDataSizeInMemorySelf=function(){return 0},r.prototype.applyPropertiesUnloaded=function(e){t.prototype.applyPropertiesUnloaded.call(this,e),e.accessorId&&this.registerBufferDependency()},r.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.decode()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},r.prototype.createBufferAttribute=function(e,t,r,i){var n=r.num_points(),o=i.components_count(),s=n*o,u=new e.DracoFloat32Array;t.GetAttributeFloatForAllPoints(r,i,u);for(var p=new Float32Array(s),c=0;c0&&(f.addGroup(v,x,g),v+=x),g=P}}var E=3*c-v;E>0&&f.addGroup(v,E,g),e.destroy(y)}else f.addGroup(0,3*c,-1);var w=this.getProperty("bounds"),_=new a.Vector3(w.min.x,w.min.y,w.min.z),S=new a.Vector3(w.max.x,w.max.y,w.max.z);f.boundingBox=new a.Box3(_,S),f.computeBoundingSphere(),this.addMissingAttributes(f),this.setGeometry(o.default.primitiveType.TRIANGLES,f)},r.prototype.decode=function(){var t=e.Module;if(!t)throw new Error("Draco module not found");var r=u.default.getBufferArray(this.engine,this.getProperty("accessorId")),i=new t.DecoderBuffer;i.Init(r,r.byteLength),i.Init(r,r.byteLength);var a=new t.WebIDLWrapper,o=a.GetEncodedGeometryType(i);if(o===t.TRIANGULAR_MESH){var s=a.DecodeMeshFromBuffer(i);this.createBufferGeometry(t,a,s),t.destroy(s)}else n.default.warn(this.engine.getName()+(" - DracoGeometryAsset: Unrecognized geometry type '"+o+"'"));t.destroy(a),t.destroy(i)},r.prototype.registerBufferDependency=function(){var e=this.getProperty("accessorId"),t=e.split("#");if(2!==t.length)throw new Error(this.engine.getName()+" - DracoGeometryAsset: Invalid accessorId, "+e);this.registerDependencyById(t[0])},r}(o.default);c.addSchemas("DracoGeometryAsset",l),t.default=l}).call(t,r(74))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(9),o=r(12),s=r(11),u=r(15),p=r(4),c=["red","green","blue"],l="rgb",d=16384,h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.loadPriority=2,t}return i.__extends(t,e),t.prototype.unload=function(){this.runtimeData&&(this.engine.trigger("imageUnloaded",this.id),n.default.info(this.engine.getName()+" - Unloading image, "+this.getName()),e.prototype.unload.call(this))},t.prototype.getChosenRepresentation=function(){return this.chosenRepresentation},t.prototype.isCompressed=function(){return this.runtimeData?"jpeg"!==this.runtimeData.compression&&"zip"!==this.runtimeData.compression:this.getProperty("useCompression")},t.prototype.getCompressionFormat=function(){if(this.getProperty("useCompression")){var e=this.engine.getThreeRenderer();if(e){var t=e.extensions;if(t.get("WEBGL_compressed_texture_s3tc"))return"dxt";if(t.get("WEBGL_compressed_texture_pvrtc"))return"pvrtc"}}},t.prototype.getFormat=function(){var e=this.getChosenRepresentation();if(e.channels)switch(e.channels.length){case 4:return"alpha"===e.channels[3]?"rgba":"rgb";case 3:return"rgb";case 2:return"luminanceAlpha";case 1:return"luminance";default:return l}},t.prototype.getOriginalWidth=function(){return this.getProperty("width")||0},t.prototype.getOriginalHeight=function(){return this.getProperty("height")||0},t.prototype.getMaxRepresentationWidth=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.width>e?t.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.height>e?t.height:e},0):0},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.getImageResponseType=function(e){switch(e){case"image/vnd-ms.dds":return"arraybuffer";default:return"blob"}},t.prototype.applyPropertiesUnloaded=function(e){var t={maxSize:Math.max(this.getWidth(),this.getHeight()),compression:this.getCompressionFormat()};this.chosenRepresentation=this.findRepresentation(t)},t.prototype.createRuntimeData=function(e){var t=this;if(!this.chosenRepresentation)throw new Error("No suitable representation found to load");this.loadLowResImage(e).then(function(){return t.loadHighResImage(e)}).catch(this.onImageLoadError.bind(this))},t.prototype.loadLowResImage=function(e){var t=this;if(this.loadPriority=2,!this.getProperty("stream"))return Promise.resolve();var r={maxSize:64},i=this.findRepresentation(r);return i?new Promise(function(r,n){var a=t.loadResource(i.src,u.default.IMAGE,e,{priority:t.loadPriority,responseType:t.getImageResponseType(i.contentType),isExternal:i.isExternal});a.once(s.default.LOAD,function(e){t.onImageLoad(e,i),t.loadPriority=8,r()}),a.once(s.default.CANCEL,function(){n(new Error("Failed to load low res texture"))}),a.once(s.default.ERROR,n)}):Promise.resolve()},t.prototype.loadHighResImage=function(e){var t=this;if(!this.isDestroyed())return new Promise(function(r,i){var n=function(e){t.isDestroyed()||(t.loadedBytes=t.getDataSizeDownload()*e.loaded/e.total,t.trigger("loadProgress",t))};t.setState(a.StateType.Base,a.State.InProgress);var o=t.chosenRepresentation,p=t.loadResource(o.src,u.default.IMAGE,e,{responseType:t.getImageResponseType(o.contentType),isExternal:o.isExternal,priority:t.loadPriority});p.once(s.default.PROGRESS,n),p.once(s.default.LOAD,function(e){t.onImageLoad(e,o)}),p.once(s.default.ERROR,i)})},t.prototype.onImageLoad=function(e,t){if(this.runtimeData||(this.runtimeData={}),this.runtimeData.contentType=t.contentType,this.runtimeData.compression=t.compression,this.runtimeData.colorspace=t.colorspace,this.runtimeData.channels=t.channels||c,this.runtimeData.width=t.width,this.runtimeData.height=t.height,!(e instanceof ArrayBuffer||e instanceof Image))throw new Error("Unknown container type for image data!");this.runtimeData.imageData=e,this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this)},t.prototype.onImageLoadError=function(e){this.isDestroyed()||(n.default.error("There was an error loading the image, "+this.getName(),e),this.setState(a.StateType.Base,a.State.Failed),this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this))},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxSize:d},e),i=t.filter(function(e){if(e.compression===r.compression)return!0;switch(e.compression){case"zip":case"jpeg":return!r.compression;case"dxt":case"dxt1":case"dxt5":return"dxt"===r.compression}return!1});0===i.length&&(i=t.filter(function(e){return"zip"===e.compression||"jpeg"===e.compression}));var n=i.filter(function(e){var t=e.channels||c;return!r.channels||t.toString()===r.channels.toString()});0===n.length&&(n=i);var a=["image/vnd-ms.dds"],o=n.filter(function(e){var t=Math.max(e.width,e.height),i=a.indexOf(e.contentType)!==-1;return t<=r.maxSize||i}),s=o.reduce(function(e,t,r){var i=Math.max(t.width,t.height),n=e>=0?Math.max(o[e].width,o[e].height):0;return i>n?r:e},-1);return s>=0?o[s]:null},t}(o.default);p.addSchemas("ImageAsset",h),t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(20),p=r(5),c=r(4),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.getDataSizeInMemorySelf=function(){var e=this,t=this.getProperty("attributes");return Object.keys(t).map(function(r){var i=t[r],n=u.default.getBufferAccessor(e.engine,i.accessorId);return u.default.getComponentTypeSize(n.componentType)*u.default.getTypeSize(n.type)*n.count}).reduce(function(e,t){return t+e},0)},t.prototype.applyPropertiesUnloaded=function(t){e.prototype.applyPropertiesUnloaded.call(this,t),(t.attributes||t.indices)&&this.registerBufferDependency()},t.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.createBufferGeometry()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},t.prototype.createAttributes=function(e){var t=this,r={indices:"index",positions:"position",normals:"normal",tangents:"tangent",colors:"color",uvs1:"uv",uvs2:"uv2",skinIndices:"skinIndex",skinWeights:"skinWeight"},i=Object.assign({indices:{accessorId:this.getProperty("indices")}},this.getProperty("attributes")),n={};return p.forEach(r,function(r,a){if(i.hasOwnProperty(a)){var o=i[a].accessorId;n[r]=t.createBufferAttribute(o,e[r])}}),n},t.prototype.createBufferAttribute=function(e,t){var r=u.default.getBufferAccessor(this.engine,e),i=u.default.getBufferArray(this.engine,e),n=u.default.getTypeSize(r.type);if(void 0===t||n===t)return new a.BufferAttribute(i,n);for(var o=new i.constructor(r.count*t),s=Math.min(n,t),p=0;p=this.updateFrameInterval&&this.isEnabled()&&(this.framesElapsed=0,this.captureScene()))},t.prototype.getCubeCamera=function(){return this.cubeCamera},t.prototype.createTempRenderTexture=function(){this.tempRenderTexture=this.getEngine().createRenderTextureCube({width:512,height:512,format:"rgba",type:"uByte"},"render_tex_cube"),this.tempRenderTexture.load()},t.prototype.initCameras=function(){this.cubeCamera=new n.Object3D;var e=90,t=1;this.cameraPX=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPX.up.set(0,-1,0),this.cameraPX.lookAt(new n.Vector3(1,0,0)),this.cubeCamera.add(this.cameraPX),this.cameraNX=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNX.up.set(0,-1,0),this.cameraNX.lookAt(new n.Vector3(-1,0,0)),this.cubeCamera.add(this.cameraNX),this.cameraPY=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPY.up.set(0,0,1),this.cameraPY.lookAt(new n.Vector3(0,1,0)),this.cubeCamera.add(this.cameraPY),this.cameraNY=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNY.up.set(0,0,-1),this.cameraNY.lookAt(new n.Vector3(0,-1,0)),this.cubeCamera.add(this.cameraNY),this.cameraPZ=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPZ.up.set(0,-1,0),this.cameraPZ.lookAt(new n.Vector3(0,0,1)),this.cubeCamera.add(this.cameraPZ),this.cameraNZ=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNZ.up.set(0,-1,0),this.cameraNZ.lookAt(new n.Vector3(0,0,-1)),this.cubeCamera.add(this.cameraNZ)},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(5),o=r(1),s=r(2),u=function(e){function t(){var t=e.call(this)||this;return t.controlPoints=void 0,t.prevControlPointsLength=0,t.closed=!1,t.tempVector=new o.Vector3,t.tempVector4=new o.Vector4,t.tempMatrix=new o.Matrix4,t.visualizationCurveColor=2236962,t.visualizationSelectedCurveColor=874150,t.orientationHelpers=[],t.canTryUpdateAgain=!0,t.curveMaterial=void 0,t.curveGeometry=void 0,t.curveMesh=void 0,t.curveTessellation=200,t.selected=!1,t.updateStarted=!1,t}return i.__extends(t,e),t.prototype.onSelected=function(){this.selected=!0,this.curveMaterial&&this.curveMaterial.color.setHex(this.visualizationSelectedCurveColor),this.orientationHelpers.forEach(function(e){return e.traverse(function(e){e.visible=!0})})},t.prototype.onUnselected=function(){this.selected=!1,this.curveMaterial&&this.curveMaterial.color.setHex(this.visualizationCurveColor),this.orientationHelpers.forEach(function(e){return e.traverse(function(e){e.visible=!1})})},t.prototype.isCurveInit=function(){return this.curve.points.length>0},t.prototype.onStartup=function(){this.initCurve()},t.prototype.onAttributesChanged=function(){this.initCurve()},t.prototype.onShutdown=function(){this.cleanupCurveMesh(),this.cleanupOrientationHelpers(),this.cleanupCurveMaterial()},t.prototype.initCurve=function(){!this.updateStarted&&this.controlPoints&&this.controlPoints.length&&(this.updateStarted=!0,this.cleanupCurveMesh(),this.cleanupOrientationHelpers(),this.prevControlPointsLength=this.controlPoints.length,this.createCurve(),this.enableVisualizations&&(this.cleanupCurveMesh(),this.createCurveMesh(),this.updateOrientationHelpers()))},t.prototype.createCurve=function(){var e=this;this.controlPoints.forEach(function(t){return t.off("change:properties",e.updateCurve,e)}),this.curve=new o.CatmullRomCurve3,this.closed&&(this.curve.closed=!0);var t=this.getEntity().getRootObject();t.when("loadDependencies",function(r){t.runtimeData.updateMatrixWorld(!0),a.forEach(e.controlPoints,function(t){if(t){var r=t.getPosition().clone();e.curve.points.push(r),e.tempMatrix.makeRotationFromQuaternion(t.runtimeData.quaternion);var i=e.tempMatrix.toArray();e.tempVector.set(i[0],i[1],i[2]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,16711680)),e.tempVector.set(i[4],i[5],i[6]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,65280)),e.tempVector.set(i[8],i[9],i[10]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,255)),t.on("change:properties",e.updateCurve,e)}else e.tempVector.set(0,0,0),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680)),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680)),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680))}),e.updateCurve({}),e.updateStarted=!1,e.selected||e.onUnselected(),e.trigger("curveInit")},this)},t.prototype.updateCurve=function(e){var t=this,r=0;e.hasOwnProperty("position")&&(a.forEach(this.controlPoints,function(e){e&&(e.runtimeData.parent?(e.getPosition(t.tempVector),t.tempVector4.set(t.tempVector.x,t.tempVector.y,t.tempVector.z,1),t.tempVector4.applyMatrix4(e.runtimeData.parent.matrixWorld),t.curve.points[r].set(t.tempVector4.x,t.tempVector4.y,t.tempVector4.z),r++):t.canTryUpdateAgain&&(t.canTryUpdateAgain=!1,setTimeout(function(){n.default.info("Trying again"),t.updateCurve({})},10)))}),this.enableVisualizations&&(this.cleanupCurveMesh(),this.createCurveMesh()),this.canTryUpdateAgain=!0),e.hasOwnProperty("quaternion")&&this.updateOrientationHelpers()},t.prototype.cleanupCurveMaterial=function(){this.curveMaterial&&(this.curveMaterial.dispose(),this.curveMaterial=void 0)},t.prototype.cleanupOrientationHelpers=function(){var e=this;this.orientationHelpers.forEach(function(t){e.getRootThreeObject().remove(t)}),this.orientationHelpers=[]},t.prototype.cleanupCurveMesh=function(){this.enableVisualizations&&this.curveMesh&&(this.getRootThreeObject().remove(this.curveMesh),this.curveGeometry.dispose(),this.curveMesh.material=void 0)},t.prototype.createCurveMesh=function(){var e=this;this.curveMaterial||(this.curveMaterial=new o.MeshPhongMaterial({color:this.visualizationCurveColor,transparent:!1,opacity:.75,blending:o.AdditiveBlending})),this.curve.points.length&&(this.curveGeometry=new o.TubeGeometry(this.curve,this.curveTessellation,.1,8,this.closed),this.curveMesh=new o.Mesh(this.curveGeometry,this.curveMaterial),this.getRootObject().when("loadBase",function(){e.getRootThreeObject().add(e.curveMesh),a.forEach(e.orientationHelpers,function(t){e.getRootThreeObject().add(t)})},this),this.updateOrientationHelpers())},t.prototype.updateOrientationHelpers=function(){var e=this;this.controlPoints.forEach(function(t,r){var i=t.runtimeData;e.orientationHelpers[3*r].position.copy(e.curve.points[r]),e.orientationHelpers[3*r+1].position.copy(e.curve.points[r]),e.orientationHelpers[3*r+2].position.copy(e.curve.points[r]),e.tempMatrix.makeRotationFromQuaternion(i.quaternion);var n=e.tempMatrix.toArray();e.tempVector.set(n[0],n[1],n[2]),e.orientationHelpers[3*r].setDirection(e.tempVector),e.tempVector.set(n[4],n[5],n[6]),e.orientationHelpers[3*r+1].setDirection(e.tempVector),e.tempVector.set(n[8],n[9],n[10]),e.orientationHelpers[3*r+2].setDirection(e.tempVector)})},t}(s.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){return e.call(this)||this}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this;this.logTag=document.createElement("div"),this.logTag.id="consoleLogger",this.logTag.style.position="absolute",this.logTag.style.top="0",this.logTag.style.left="0",this.logTag.style.width="100%",this.logTag.style.height="100%",this.logTag.style.margin="0",this.logTag.style.padding="0",this.logTag.style.color="#000",this.logTag.style.background="rgba(0,0,0,0.5)",this.logTag.style.fontWeight="bold",this.logTag.style.textAlign="left",this.logTag.style.overflow="scroll",this.logTag.style["pointer-events"]="none",this.logTag.style["z-index"]="1",window.document.body.appendChild(this.logTag),this.oldLog=window.console.log,this.oldError=window.console.error,this.oldWarn=window.console.warn,window.console.log=window.console.error=window.console.warn=function(t){e.logTag.innerHTML+=t+"
"}},t.prototype.onShutdown=function(){this.logTag&&(window.document.body.removeChild(this.logTag),window.console.log=this.oldLog,window.console.error=this.oldError,window.console.warn=this.oldWarn,this.logTag=void 0)},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(269),o=function(e){function t(){var t=e.call(this)||this;return t.stats=new a,t.initialized=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.stats.showPanel(0)},t.prototype.onPreUpdate=function(){this.isEnabled()&&this.stats.begin()},t.prototype.onPostRender=function(){this.isEnabled()&&this.stats.end()},t.prototype.onEnable=function(){document.body.appendChild(this.stats.dom),this.initialized=!0},t.prototype.onDisable=function(){this.initialized&&(document.body.removeChild(this.stats.dom),this.initialized=!1)},t}(n.default);t.default=o},function(e,t,r){"use strict";function i(e,t){if(e&&e.style)for(var r in t)t.hasOwnProperty(r)&&(e.style[r]=t[r])}function n(e,t){e.classList?e.classList.add(t):e.className+=" "+t}Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),o=r(1),s=r(2),u=r(5),p=r(19),c=r(217),l={position:"absolute",left:"0",top:"0",padding:"8px","border-radius":"5px","font-family":"proxima_nova_regular,Helvetica,Arial,sans-serif","max-width":"25%","min-width":"25px",transition:"opacity 0.1s ease-in-out, background 0.1s ease-in-out",cursor:"pointer"},d=function(e){function t(){var t=e.call(this)||this;return t.renderEventName="render",t.textureRegistryById={},t}return a.__extends(t,e),t.prototype.onAwake=function(){this.getEngine().on("assetLoaded",this.registerTexture,this),this.getEngine().on("assetUnloaded",this.unregisterTexture,this)},t.prototype.onStartup=function(){var e=this;this.init2dScene(),this.initCubeScene(),this.renderEventName+="Group"+this.renderGroup,this.getEngine().on(this.renderEventName,this.renderView,this),this.listenTo(this.getEngine(),"rendererResize",this.resize),this.getEngine().getAssetsByClass(p.default).forEach(function(t){return e.registerTexture(t)}),this.resize()},t.prototype.onShutdown=function(){this.getEngine().off("assetLoaded",this.registerTexture,this),this.getEngine().off("assetUnloaded",this.unregisterTexture,this),this.getEngine().off(this.renderEventName,this.renderView,this)},t.prototype.init2dScene=function(){this.camera2D=new o.OrthographicCamera(-1,1,1,-1,0,1),this.scene2D=new o.Scene,this.material2D=new o.ShaderMaterial(c.default),this.material2D.transparent=!0,this.mesh2D=new o.Mesh(new o.PlaneGeometry(2,2),this.material2D),this.scene2D.add(this.mesh2D)},t.prototype.initCubeScene=function(){var e=90,t=1,r=o.ShaderLib.cube;this.sceneCube=new o.Scene,this.geoCube=new o.BoxGeometry(100,100,100),this.materialCube=new o.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:r.uniforms,depthWrite:!1,depthTest:!1,side:o.BackSide}),this.meshCube=new o.Mesh(this.geoCube,this.materialCube),this.cameraPX=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPX.up.set(0,1,0),this.cameraPX.lookAt(new o.Vector3(1,0,0)),this.sceneCube.add(this.cameraPX),this.cameraNX=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNX.up.set(0,1,0),this.cameraNX.lookAt(new o.Vector3(-1,0,0)),this.sceneCube.add(this.cameraNX),this.cameraPY=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPY.up.set(0,0,-1),this.cameraPY.lookAt(new o.Vector3(0,1,0)),this.sceneCube.add(this.cameraPY),this.cameraNY=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNY.up.set(0,0,1),this.cameraNY.lookAt(new o.Vector3(0,-1,0)),this.sceneCube.add(this.cameraNY),this.cameraPZ=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPZ.up.set(0,1,0),this.cameraPZ.lookAt(new o.Vector3(0,0,1)),this.sceneCube.add(this.cameraPZ),this.cameraNZ=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNZ.up.set(0,1,0),this.cameraNZ.lookAt(new o.Vector3(0,0,-1)),this.sceneCube.add(this.cameraNZ),this.sceneCube.add(this.meshCube)},t.prototype.setTexture=function(e){var t=this;this.currentTexture=this.textureRegistryById[e],this.currentTexture?this.currentTexture.load(function(){switch(t.currentTexture.type){case"renderTextureCube":case"textureCube":t.materialCube.uniforms.tCube.value=t.currentTexture.getThreeTexture();break;case"texture2D":case"renderTexture2D":t.material2D.uniforms.tDiffuse.value=t.currentTexture.getThreeTexture()}t.mesh2D.visible=!0,t.meshCube.visible=!0}):(this.mesh2D.visible=!1,this.meshCube.visible=!1)},t.prototype.updateViewport=function(){var e,t=this.getEngine().getRenderer().getWidth(),r=this.getEngine().getRenderer().getHeight();"%"===this.viewportBottom.slice(-1)?(e=.01*parseFloat(this.viewportBottom.slice(0,-1)),this.y=e*r):this.y=parseInt(this.viewportBottom,10),"%"===this.viewportLeft.slice(-1)?(e=.01*parseFloat(this.viewportLeft.slice(0,-1)),this.x=e*t):this.x=parseInt(this.viewportLeft,10),"%"===this.viewportWidth.slice(-1)?(e=.01*parseFloat(this.viewportWidth.slice(0,-1)),this.width=e*t):this.width=parseInt(this.viewportWidth,10),"%"===this.viewportHeight.slice(-1)?(e=.01*parseFloat(this.viewportHeight.slice(0,-1)),this.height=e*r):this.height=parseInt(this.viewportHeight,10),this.x<0&&(this.x+=t),this.y<0&&(this.y+=r)},t.prototype.updateTextureDropdown=function(){var e=this;this.isEnabled()&&setTimeout(function(){var t;if(!e.textureDropDown){if(e.textureDropDown=document.createElement("select"),e.textureDropDown.name="Textures",e.textureDropDown.id="Textures",n(e.textureDropDown,"debugger-dropdown"),i(e.textureDropDown,l),!e.getThreeRenderer())return;var r=e.getThreeRenderer().domElement;r.parentElement?r.parentElement.appendChild(e.textureDropDown):r.appendChild(e.textureDropDown),e.textureDropDown.onchange=function(){e.setTexture(e.textureDropDown.value)}}e.textureDropDown.options.length=0,t=document.createElement("option"),t.value=0,t.text="None",e.textureDropDown.appendChild(t),u.forEach(e.textureRegistryById,function(r,i){t=document.createElement("option"),t.value=i,t.text=""!==r.name?r.getName():i,e.textureDropDown.appendChild(t)}),e.textureDropDown.style.top=e.getEngine().getRenderer().getHeight()-e.y-e.height+"px",e.textureDropDown.style.left=e.x+"px",e.textureDropDown.style.zIndex="200"},0)},t.prototype.resize=function(){this.isEnabled()&&(this.updateTextureDropdown(),this.updateViewport())},t.prototype.renderView=function(){var e=this.getThreeRenderer();if(this.isEnabled()&&this.currentTexture)switch(e.setRenderTarget(null),this.currentTexture.type){case"texture2D":case"renderTexture2D":e.setViewport(this.x,this.y,this.width,this.height),e.render(this.scene2D,this.camera2D);break;case"textureCube":case"renderTextureCube":var t=.25*this.width,r=.3333*this.height;e.setViewport(this.x,this.y+r,t,r),e.render(this.sceneCube,this.cameraPX,null,!1),e.setViewport(this.x+1.999*t,this.y+r,t,r),e.render(this.sceneCube,this.cameraNX,null,!1),e.setViewport(this.x+t,this.y+1.99*r,t,r),e.render(this.sceneCube,this.cameraPY,null,!1),e.setViewport(this.x+t,this.y,t,r),e.render(this.sceneCube,this.cameraNY,null,!1),e.setViewport(this.x+t,this.y+r,t,r),e.render(this.sceneCube,this.cameraPZ,null,!1),e.setViewport(this.x+2.99*t,this.y+r,t,r),e.render(this.sceneCube,this.cameraNZ,null,!1)}},t.prototype.registerTexture=function(e){if(e)switch(e.type){case"renderTextureCube":case"textureCube":case"texture2D":case"renderTexture2D":this.textureRegistryById[e.id]=e}},t.prototype.unregisterTexture=function(e){e&&this.textureRegistryById[e.id]&&delete this.textureRegistryById[e.id]},t}(s.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(){function e(e,t,r,i){this.targetEntityType=e,this.targetComponentName=t,this.propertyName=r,this.targetValue=i,this.previousValues={},this.lastTimeSavings=0,this.targetEntityType=e,this.targetComponentName=t,this.propertyName=r,this.targetValue=i}return e}();t.QualityChangeLevel=a;var o=.9,s=function(e){function t(){var t=e.call(this)||this;return t.QualityChangeLevel=a,t.frameTimeThreshold=33.333333333,t.testInterval=2e3,t.qualityChangeLevels=[],t.currentLevel=t.qualityChangeLevels.length,t.elapsedRenderTime=0,t.framesRecorded=0,t.justStarted=!0,t.justAutoSteppedDown=!1,t.autoOptimize=!0,t}return i.__extends(t,e),t.prototype.setQualityChangeLevels=function(e){this.setMaxQuality(),this.qualityChangeLevels=e,this.currentLevel=this.qualityChangeLevels.length,this.isEnabled()&&(this.autoOptimize=!0)},t.prototype.setFrameTimeThreshold=function(e){this.frameTimeThreshold=e},t.prototype.setTestInterval=function(e){this.testInterval=e,this.elapsedRenderTime=0,this.framesRecorded=0},t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&(this.elapsedRenderTime+=1e3*e,this.framesRecorded++,!(this.elapsedRenderTimethis.frameTimeThreshold?(this.stepRenderingQualityDown(),this.justAutoSteppedDown=!0):this.qualityChangeLevels[this.currentLevel]&&this.lastAvgFrameTime0;)this.currentLevel=this.currentLevel>1?this.currentLevel-1:0,e=!this.stepRenderingQuality(!1);e||(this.qualityChangeLevels[this.currentLevel].frameTimeAtDrop=this.lastAvgFrameTime)},t.prototype.stepRenderingQualityUp=function(){for(var e=!0;e&&this.currentLevelthis.time?1:n(Math.max(0,Math.min(1,this.currentTime/this.time)));this.objects.forEach(function(e,i){var n=e.runtimeData.parent.worldToLocal(l.copy(t.destinations[i])).clone(),a=t.direction>0?t.sources[i]:n,o=t.direction>0?n:t.sources[i];l.lerpVectors(a,o,r),e.setPosition(l.x,l.y,l.z)}),this.currentTime>this.time&&this.getEntity().trigger(this.direction>0?"endExplode":"endContract")}},t.prototype.reset=function(){var e=this;this.objects.forEach(function(t,r){t.setPosition(e.sources[r].x,e.sources[r].y,e.sources[r].z)}),this.objects.length=0,this.sources.length=0,this.destinations.length=0,this.currentTime=this.time},t.prototype.contract=function(){this.isEnabled()&&(this.direction=-1,this.currentTime=0,this.getEntity().trigger("beginContract"))},t.prototype.explode=function(e,t){var r=this;if(this.isEnabled()){this.reset();var i=this.getEntity().getDescendantsByType("mesh"),n=this.getEntity().getCenter();n.applyMatrix4(this.getRuntimeData().matrixWorld);var a=new p.Quaternion;a.setFromRotationMatrix(this.getRuntimeData().matrixWorld);var o=this.getFormationFunc(e||this.formation,i.length,n,a,t||this.scale).bind(this);i.forEach(function(e,t){o(t,l,e),r.objects.push(e),r.sources.push(e.getPosition()),r.destinations.push(l.clone())}),this.currentTime=0,this.direction=1,this.getEntity().trigger("beginExplode")}},t.prototype.toggleExplode=function(){this.direction>0?this.contract():this.explode()},t.prototype.getFormationFunc=function(e,t,r,i,n){switch(e){case"Grid":return a(t,r,n,i);case"Scale":return o(r,n);default:case"Circle":return s(t,r,n,i)}},t}(c.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=e.call(this)||this;return t.el=void 0,t.fsEnabled=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.toggle=this.toggle.bind(this),this.getEntity().on("toggleFullscreen",this.toggle,this),this.listenTo(this.getGlobalEvents(),"fullscreen::toggle",this.toggle),this.listenTo(this.getGlobalEvents(),"fullscreen::enable",this.enableFullscreen),this.listenTo(this.getGlobalEvents(),"fullscreen::disable",this.disableFullscreen)},t.prototype.toggle=function(){this.fsEnabled?this.disableFullscreen():this.enableFullscreen()},t.prototype.enableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.el.requestFullscreen(),this.fsEnabled=!0},t.prototype.disableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.fsEnabled&&document.exitFullscreen(),this.fsEnabled=!1},t.prototype.attachFullscreenAPI=function(){this.el=this.getEngine().container,this.el.requestFullscreen=this.el.requestFullscreen||this.el.requestFullScreen||this.el.mozRequestFullscreen||this.el.mozRequestFullScreen||this.el.webkitRequestFullscreen||this.el.webkitRequestFullScreen||this.el.msRequestFullscreen||this.el.msRequestFullScreen,document.exitFullscreen=document.exitFullscreen||document.exitFullScreen||document.mozCancelFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.webkitExitFullScreen||document.msExitFullscreen||document.msExitFullScreen,document.addEventListener("fullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("mozfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("webkitfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("msfullscreenchange",this.onFullscreenChange.bind(this),!1)},t.prototype.onFullscreenChange=function(e){this.getGlobalEvents().trigger("fullscreen::change",e)},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(5),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[],t.axes=[],t.workVector1=new n.Vector3,t.workVector2=new n.Vector3,t.workQuaternion1=new n.Quaternion,t.workQuaternion2=new n.Quaternion,t.workEuler=new n.Euler,t.meshControlMap={},t.updateAxes=!1,t.updateButtons=[],t.gamepadDevice=null,t}return i.__extends(t,e),t.prototype.onUpdate=function(e){var t=this;this.gamepadDevice||(this.gamepadDevice=this.getGamepadDevice(),this.gamepadDevice&&(this.listenTo(this.gamepadDevice,"gamepadButtonChanged",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonTouched",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonReleased",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadAxisChanged",this.onGamepadAxisEvent))),this.updateButtons.forEach(function(e,r){e&&t.updateButtonTransform(r)}),this.updateAxes&&(this.updateAxes=!1,this.updateAxesTransforms())},t.prototype.getAxisMeshes=function(e){return this.axes[e].map(function(e){return e.mesh})},t.prototype.getButtonMeshes=function(e){return this.buttons[e].map(function(e){return e.mesh})},t.prototype.onAttributesChanged=function(e){var t=this;e.indexOf("axes")===-1&&e.indexOf("buttons")===-1||(this.meshControlMap={},this.axes.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&(t.meshControlMap[n.id]||(t.meshControlMap[n.id]={axes:[],axesMeshIdx:[],buttons:[],buttonMeshIdx:[]}),t.meshControlMap[n.id].axes.push(r),t.meshControlMap[n.id].axesMeshIdx.push(i)); +})}),this.buttons.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&t.meshControlMap[n.id]&&(t.meshControlMap[n.id].buttons.push(r),t.meshControlMap[n.id].buttonMeshIdx.push(i))})}))},t.prototype.getGamepadDevice=function(){if(this.gamepadDevice)return this.gamepadDevice;var e=this.getEntity().getAncestors(),t=e.find(function(e){return!!e.getComponentByScriptId("motion_gamepad_device")});return t?(this.gamepadDevice=t.getComponentByScriptId("motion_gamepad_device"),this.gamepadDevice):(this.gamepadDevice=null,null)},t.prototype.onGamepadButtonEvent=function(e,t){this.currentGamepadState=e,this.updateButtons[t]=!0},t.prototype.updateButtonTransform=function(e){var t=this,r=this.currentGamepadState.buttons[e].value,i=this.buttons[e];i.forEach(function(i){if(i.mesh){switch(i.movementType){case"translate":t.workVector1.copy(i.offset).multiplyScalar(r),i.mesh.setPosition(t.workVector1.x,t.workVector1.y,t.workVector1.z);break;case"rotate":t.workVector2.copy(i.rotation).multiplyScalar(r),t.workEuler.setFromVector3(t.workVector2),t.workQuaternion1.setFromEuler(t.workEuler),t.workVector1.copy(i.pivot),t.workVector2.copy(t.workVector1).multiplyScalar(-1),t.workVector2.applyQuaternion(t.workQuaternion1),t.workVector2.add(t.workVector1),i.mesh.setQuaternion(t.workQuaternion1.x,t.workQuaternion1.y,t.workQuaternion1.z,t.workQuaternion1.w),i.mesh.setPosition(t.workVector2.x,t.workVector2.y,t.workVector2.z)}i.renderOnTouchOnly&&t.currentGamepadState.buttons[e].hasOwnProperty("touched")&&i.mesh.setProperty("visible",t.currentGamepadState.buttons[e].touched)}})},t.prototype.onGamepadAxisEvent=function(e,t){this.currentGamepadState=e,this.updateAxes=!0},t.prototype.updateAxesTransforms=function(){var e=this;o.forEach(this.meshControlMap,function(t,r){var i=e.getEngine().getObjectById(r);if(i){var n=e.axes[0][t.axesMeshIdx[0]].movementType;if(e.workVector1.set(0,0,0),t.axes.reduce(function(r,i,a){var o=e.axes[i][t.axesMeshIdx[a]];if(o.movementType!==n)return log.error("Can't perform multiple types of axis transformations on same mesh."),r;if("translate"===n){var s=e.currentGamepadState.axes[i];e.workVector2.copy(o.offset).multiplyScalar(s)}else"rotate"===n&&e.workVector2.copy(o.pivot).multiplyScalar(-1);return r.lerp(e.workVector2,0===a?1:.5)},e.workVector1),e.workQuaternion1.set(0,0,0,1),"rotate"===n&&(t.axes.reduce(function(r,i,n){var a=e.axes[i][t.axesMeshIdx[n]],o=e.currentGamepadState.axes[i];return e.workVector2.copy(a.rotation).multiplyScalar(o),e.workEuler.setFromVector3(e.workVector2),e.workQuaternion2.setFromEuler(e.workEuler),r.slerp(e.workQuaternion2,0===n?1:.5)},e.workQuaternion1),e.workVector2.copy(e.workVector1),e.workVector1.applyQuaternion(e.workQuaternion1),e.workVector2.multiplyScalar(-1),e.workVector1.add(e.workVector2)),i.setQuaternion(e.workQuaternion1.x,e.workQuaternion1.y,e.workQuaternion1.z,e.workQuaternion1.w),i.setPosition(e.workVector1.x,e.workVector1.y,e.workVector1.z),t.buttons.length){var a=t.buttons[0],o=e.currentGamepadState.buttons[a].value,s=e.buttons[a][0].offset;e.workVector2.copy(s).multiplyScalar(o),e.workVector2.applyQuaternion(e.workQuaternion1),e.workVector2.add(e.workVector1),i.setPosition(e.workVector2.x,e.workVector2.y,e.workVector2.z)}}})},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.gamepadStates=[],t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&navigator.getGamepads)for(var t=navigator.getGamepads(),r=0;r":187,"<":188,_:189,".":190,"/":191,"[":219,"]":221};var d=function(e){function r(){var t=e.call(this)||this;return t.mouseButtons={left:0,middle:1,right:2},t.inputQueue=[],t.inputPool=[],t.mouseButtonState=new Array(3),t.mouseButtonStatePrevious=new Array(3),t.mousePosition=new u.Vector2,t.mousePositionPercent=new u.Vector2,t.mousePreviousPosition=new u.Vector2,t.mouseDragState=new Array(3),t.mouseDragStatePrevious=new Array(3),t.mouseDragDistance=[new u.Vector2,new u.Vector2,new u.Vector2],t.touchPosition=new u.Vector2,t.touchPositionPercent=new u.Vector2,t.touchPreviousPosition=new u.Vector2,t.touchDragState=!1,t.touchDragStatePrevious=!1,t.doubleTapHandle=null,t.doubleTapPosition=new u.Vector2,t.listenForTouchStart=!1,t.listenForTouchEnd=!1,t.touchesStart=[],t.keyState=new Array(256),t.keyStatePrevious=new Array(256),t.canvas=null,t.pointerLockEnabled=!1,t}return i.__extends(r,e),r.prototype.mouseButtonDown=function(e){if("any"===e){for(var t in this.mouseButtons)if(this.mouseButtonState[this.mouseButtons[t]])return!0;return!1}return this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonUp=function(e){return!this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonPressed=function(e){return!(!this.mouseButtonState[this.mouseButtons[e]]||this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.mouseButtonReleased=function(e){return!(this.mouseButtonState[this.mouseButtons[e]]||!this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.keyPressed=function(e){return!(!this.keyState[t.keyCodes[e]]||this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyReleased=function(e){return!(this.keyState[t.keyCodes[e]]||!this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyDown=function(e){return!!this.keyState[t.keyCodes[e]]},r.prototype.keyUp=function(e){return!this.keyState[t.keyCodes[e]]},r.prototype.getMouseDragState=function(e){return this.mouseDragState[this.mouseButtons[e||"left"]]},r.prototype.getPreviousMouseDragState=function(e){return this.mouseDragStatePrevious[this.mouseButtons[e||"left"]]},r.prototype.getTouchDragState=function(){return this.touchDragState},r.prototype.getPreviousTouchDragState=function(){return this.touchDragStatePrevious},r.prototype.enablePointerLock=function(){this.pointerLockEnabled=!0,this.canvas.requestPointerLock()},r.prototype.disablePointerLock=function(){this.pointerLockEnabled=!1,document.exitPointerLock()},r.prototype.togglePointerLock=function(){this.pointerLockEnabled?this.enablePointerLock():this.disablePointerLock()},r.prototype.onStartup=function(){this.canvas=this.getEngine().canvas,this.canvas.requestPointerLock=this.canvas.requestPointerLock||this.canvas.mozRequestPointerLock||this.canvas.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,this.clearKeyStates=this.clearKeyStates.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseWheel=this.onMouseWheel.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchLeave=this.onTouchLeave.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onDoubleTap=this.onDoubleTap.bind(this),window.addEventListener("blur",this.clearKeyStates,!1),this.isEnabled()&&(this.mouseEvents.enable&&this.enableMouseEvents(),this.keyEvents.enable&&this.enableKeyEvents(),this.touchEvents.enable&&this.enableTouchEvents())},r.prototype.onPreUpdate=function(){if(this.isEnabled())for(;this.inputQueue.length>0;)this.getEngine().trigger(this.inputQueue[0].name,this.inputQueue[0].event),this.recycleInputEvent(this.inputQueue.splice(0,1)[0])},r.prototype.onPostUpdate=function(){if(this.isEnabled()){if(this.keyEvents.enable)for(var e=0;ethis.mouseEvents.dragBufferDistance&&(this.mouseDragState[t]=!0)}else this.mouseDragState[t]=!1;this.inputQueue.push(this.getInputEvent(e,"mouseMove"))},r.prototype.onMouseDown=function(e){if(this.getScenePercent(e,e),this.mouseUpBound||(this.mouseUpBound=!0,document.addEventListener("mouseup",this.onMouseUp)),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.mouseEvents.preventDownDefault&&e.preventDefault(),this.mouseButtonState[e.button]=!0,this.inputQueue.push(this.getInputEvent(e,"mouseDown")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_down_"+t)}},r.prototype.onMouseUp=function(e){if(this.getScenePercent(e,e),this.mouseButtonState[e.button]=!1,this.mouseDragState[e.button]=!1,this.mouseDragDistance[e.button].x=0,this.mouseDragDistance[e.button].y=0,this.mouseButtonUp("left")&&this.mouseButtonUp("right")&&this.mouseButtonUp("middle")&&(this.mouseUpBound=!1,document.removeEventListener("mouseup",this.onMouseUp)),this.inputQueue.push(this.getInputEvent(e,"mouseUp")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_up_"+t)}},r.prototype.onDoubleClick=function(e){this.getScenePercent(e,e),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.inputQueue.push(this.getInputEvent(e,"doubleClick"))},r.prototype.onMouseWheel=function(e){this.mouseEvents.preventScrollDefault&&e.preventDefault();var t;t=void 0!==e.wheelDeltaY?.025*e.wheelDeltaY:s.isIE()?-e.deltaY/40:-e.deltaY,this.inputQueue.push(this.getInputEvent(t,"mouseScroll"))},r.prototype.onMouseLeave=function(e){for(var t=0,r=this.mouseButtonState;tthis.touchEvents.dragBufferDistance?void this.clearDoubleTapState():(this.listenForTouchStart||this.listenForTouchEnd?!this.listenForTouchStart&&this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0):this.listenForTouchStart&&!this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0,this.listenForTouchEnd=!0,this.canvas.addEventListener("touchend",this.onDoubleTap)):(this.clearDoubleTapState(),this.onTouchEvent(e,"doubleTap")):(this.doubleTapPosition.copy(this.touchPosition),this.clearDoubleTapState(),this.canvas.addEventListener("touchend",this.onDoubleTap),this.listenForTouchEnd=!0),void(this.doubleTapHandle=setTimeout(this.clearDoubleTapState.bind(this),p)))},r.prototype.clearDoubleTapState=function(){clearTimeout(this.doubleTapHandle),this.doubleTapHandle=null,this.listenForTouchStart=!1,this.listenForTouchEnd=!1,this.canvas.removeEventListener("touchend",this.onDoubleTap)},r.prototype.onTouchCancel=function(e){this.touchEvents.preventCancelDefault&&e.preventDefault(),this.touchDragState=!1;var t={};t.originalEvent=e,t.touches=[],this.inputQueue.push(this.getInputEvent(t,"touchCancel"))},r.prototype.onTouchLeave=function(e){this.touchEvents.preventLeaveDefault&&e.preventDefault(),this.touchDragState=!1,this.onTouchEvent(e,"touchLeave")},r.prototype.onTouchMove=function(e){this.touchEvents.preventMoveDefault&&e.preventDefault();var t={};t.originalEvent=e,t.touches=[];for(var r=0;rthis.touchEvents.dragBufferDistance&&(this.touchDragState=!0),t.touches.push(i)}t.touches.length&&(this.touchPosition.x=t.touches[t.touches.length-1].sceneX,this.touchPosition.y=t.touches[t.touches.length-1].sceneY,this.touchPositionPercent.x=t.touches[t.touches.length-1].scenePercentX,this.touchPositionPercent.y=t.touches[t.touches.length-1].scenePercentY),this.inputQueue.push(this.getInputEvent(t,"touchMove"))},r.prototype.onTouchEvent=function(e,t){var r={};r.originalEvent=e,r.touches=[];for(var i=0;i=0&&(this.sourceBoundingSphere.radius=this.boundingSphereOverrideRadius)),this.sceneRoot.isBaseLoaded()&&this.sphereMesh&&(this.sphereMesh.position.copy(this.sourceBoundingSphere.center),this.sphereMesh.scale.set(this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius)),this.previousIntersections=this.currentIntersections,this.currentIntersections={},this.firstIntersectionOnly){var i=t.find(this.intersectObject.bind(this));i&&(this.previousIntersections[i.id]||(this.trigger("beginIntersection",i),this.getEntity().trigger("beginIntersection",i)),this.currentIntersections[i.id]=i)}else{var n=t.filter(this.intersectObject.bind(this));n.forEach(function(t){e.previousIntersections[t.id]||(e.trigger("beginIntersection",t),e.getEntity().trigger("beginIntersection",t)),e.currentIntersections[t.id]=t})}return o.forEach(this.previousIntersections,function(t){e.currentIntersections[t.id]||(e.trigger("endIntersection",t),e.getEntity().trigger("endIntersection",t))}),this.currentIntersections}},t.prototype.onAttributesChanged=function(e){e.indexOf("debugVisualization")!==-1&&(this.sphereMesh.visible=this.debugVisualization)},t.prototype.onPreUpdate=function(){this.checkIntersectionAlways&&this.checkIntersection()},t.prototype.generateObjectList=function(){var e=this;if(this.objectFilter.length)return this.objectFilter;var t=[];return this.sceneRoot.traverseSome(function(r){return r===e.getEntity()||!(e.objectTypeFilter.length&&!e.objectTypeFilter.some(function(e){return r.type===e}))&&void t.push(r)}),t},t.prototype.intersectObject=function(e){var t=e.runtimeData;return!!t&&(this.workMatrix.getInverse(t.matrixWorld),this.workBoundsSphere.copy(this.sourceBoundingSphere),this.workBoundsSphere.applyMatrix4(this.workMatrix),e.getBounds(this.workBoundingBox),this.workBoundingBox.intersectsSphere(this.workBoundsSphere))},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(14),o=function(e){function t(){var t=e.call(this)||this;return t.setupMaterial=t.setupMaterial.bind(t),t}return i.__extends(t,e),t.prototype.onAwake=function(){var e=this;this.listenTo(this.getEngine(),"entityCreated",function(t){t instanceof a.default&&e.setupMaterial(t)})},t.prototype.onAttributesChanged=function(e){this.setupAllMaterials()},t.prototype.onDisable=function(){this.getEngine().getAssetsByClass(a.default).forEach(function(e){var t=e.getShader().getProperty("parameters");t.envMapIrradiance&&e.setProperty("envMapIrradiance",null),t.envMapRadianceHalfGloss&&e.setProperty("envMapRadianceHalfGloss",null),t.envMapRadiance&&e.setProperty("envMapRadiance",null)})},t.prototype.onEnable=function(){this.setupAllMaterials()},t.prototype.setupAllMaterials=function(){this.getEngine().getAssetsByClass(a.default).forEach(this.setupMaterial)},t.prototype.setupMaterial=function(e){if(e&&this.isEnabled()){var t=e.getShader().getProperty("parameters");t.envMapIrradiance&&e.setProperty("envMapIrradiance",this.getAttribute("irradianceMap")),t.envMapRadiance&&e.setProperty("envMapRadiance",this.getAttribute("radianceMap")),t.envMapRadianceHalfGloss&&e.setProperty("envMapRadianceHalfGloss",this.getAttribute("radianceMapHalfGloss"))}},t}(n.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(10),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.playing=!0,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.tempVec=new n.Vector3,this.tempMatrix=new n.Matrix4,this.tempQuaternion=new n.Quaternion},t.prototype.onAttributesChanged=function(e){if(!this.playing){var t=this.getEntity();t instanceof o.default&&(this.getRuntimeData().position.copy(t.getPosition()),this.getRuntimeData().quaternion.copy(t.getQuaternion()))}},t.prototype.onEnable=function(){this.playing=!0},t.prototype.onDisable=function(){this.playing=!1;var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()))},t.prototype.onPostUpdate=function(){var e;if(this.hasRuntimeData()&&this.playing&&this.isEnabled()&&(e=this.getRuntimeData(),this.target&&this.target.runtimeData)){this.getEngine().needsRender=!0;var t=this.target.runtimeData;if(this.tempVec.setFromMatrixPosition(t.matrixWorld),e.parent?this.tempMatrix.getInverse(e.parent.matrixWorld):this.tempMatrix.identity(),this.tempVec.applyMatrix4(this.tempMatrix),this.local){e.lookAt(this.tempVec);var r=this.getEntity();r instanceof o.default&&e.quaternion.multiply(r.getQuaternion())}else e.lookAt(this.tempVec)}},t.prototype.onShutdown=function(){},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(37),s=.5,u=36,p=1,c=80,l=function(e){function t(){var t=e.call(this)||this;return t.createScene(),t}return i.__extends(t,e),t.prototype.setLightingFromThreeScene=function(e){var t=this;this.resetSceneLighting(),e.traverse(function(e){e instanceof n.Light&&t.scene.add(e.clone())}),this.captureScene()},t.prototype.setLightingFromScene=function(e){var t=this;this.resetSceneLighting(),e.getDescendantsByClass(o.default).forEach(function(e){e.isUnloaded()&&e.loadBase(),t.scene.add(e.getRuntimeData().clone())}),this.captureScene()},t.prototype.onAwake=function(){this.listenTo(this.getEntity(),"change:properties",this.onMaterialChanges)},t.prototype.onEnable=function(){this.captureScene()},t.prototype.onEntityLoaded=function(){this.captureScene()},t.prototype.onAttributesChanged=function(e){e.indexOf("captureTexture")!==-1&&this.captureScene()},t.prototype.onMaterialChanges=function(e){this.captureScene()},t.prototype.createScene=function(){this.camera=new n.OrthographicCamera(-s,s,s,-s,p,c),this.scene=new n.Scene,this.createGeometry(),this.scene.add(this.sphereMesh),this.scene.add(this.planeMesh),this.scene.add(this.camera),this.camera.position.z=.5*c,this.camera.position.y=.25*c,this.camera.position.x=.25*c,this.camera.lookAt(new n.Vector3(0,0,0)),this.planeMesh.lookAt(this.camera.position)},t.prototype.createGeometry=function(){this.geometry=new n.SphereBufferGeometry(s,u,u),this.planeGeometry=new n.PlaneBufferGeometry(2*s,2);var e=Math.sqrt(.5),t=this.planeGeometry.attributes.normal;t.array=new Float32Array([-1,1,0,1,1,0,-1,-1,0,1,-1,0]);for(var r=0;r=1&&(n-=1);var a=1-i;if(r&&na){var x=1-(n-a)/i;f+=e*E/t*Math.max(.5*Math.cos(x*Math.PI+Math.PI)+.5,0)}else f+=e*E/t;(f>=1||f<0)&&(f%=1,h=0,s||(f=.99999999,c.playingCurveAnimation=!1,c.getEngine().off("update",c.curveAnim,c),c.curveAnim=void 0),c.getEntity().trigger("endAnimateAlongCurve"));var S=u.curve,D=S.getUtoTmapping(f);if(d.position.copy(S.getPoint(D)),"toCurve"===o){var A=S.getTangent(D);m.set(0,-1,0),y.crossVectors(A,m),g.crossVectors(A,y),m.copy(d.position),m.add(A),v.lookAt(d.position,m,g),d.quaternion.setFromRotationMatrix(v)}else if("toNode"===o){var T=u.closed?S.points.length:S.points.length-1,M=Math.floor(D*T),R=Math.ceil(D*T)%S.points.length;M!==w&&(M>0?u.controlPoints[M].getQuaternionInWorldSpace(b):u.controlPoints[0].getQuaternionInWorldSpace(b)),R!==_&&(R>0?u.controlPoints[R].getQuaternionInWorldSpace(P):u.controlPoints[0].getQuaternionInWorldSpace(P));var C=D*T-M;d.quaternion.copy(b),d.quaternion.slerp(P,C)}}};r+i>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),r=.5,i=.5),t>0&&(this.playingCurveAnimation=!0,u.isCurveInit()?(this.curveAnim=S,this.getEngine().on("update",this.curveAnim,this)):u.on("curveInit",function(){c.curveAnim=S,c.getEngine().on("update",c.curveAnim,c)},this))}},t.prototype.onPauseCurveAnimation=function(){this.playingCurveAnimation=!1},t.prototype.onUnpauseCurveAnimation=function(){this.playingCurveAnimation=!0},t.prototype.animateToObject=function(e,t,r,i,o){var s=this,u=this.getEngine(),p=function(e){var p=s.getRuntimeData(),c=new a.Matrix4,l=0,d=0;r+i>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),r=.5,i=.5);var h,f=1-r-i,m=1/(r/2+i/2+f),y=new a.Vector3;y.copy(p.position);var g=e.position,v=e.quaternion;if(v&&o&&(h=new a.Quaternion,h.copy(p.quaternion)),e.updateMatrixWorld(!0),g.setFromMatrixPosition(e.matrixWorld),c.extractRotation(e.matrixWorld),v.setFromRotationMatrix(c),t>0){var b=function(e){if(!s.getEntity()||!s.isEnabled())return void u.off("update",b,s);s.getEngine().needsRender=!0,l+=e;var n=l/t,a=1-i;if(r&&na){var f=1-(n-a)/i;d+=e*m/t*Math.max(.5*Math.cos(f*Math.PI+Math.PI)+.5,0)}else d+=e*m/t;d=Math.min(d,1),(d>=1||d<0)&&(s.getEngine().off("update",b,s),s.getEntity().trigger("endAnimateToObject")),p.position.copy(y),p.position.lerp(g,d),v&&o&&(p.quaternion.copy(h),p.quaternion.slerp(v,d))};s.getEngine().on("update",b,s)}else p.position.copy(g),v&&p.quaternion.copy(v),s.getEntity().trigger("endAnimateToObject")},c=this.getEngine().getEntityById(e);c.runtimeData?p(c.runtimeData):(c.once("loadBase",function(){p(c.runtimeData)},this),c.load())},t.prototype.animateTranslation=function(e,t,r,i,o){var s=this,u=this.getRuntimeData();u.position.copy(this.getEntity().getPosition()),u.quaternion.copy(this.getEntity().getQuaternion()),u.scale.copy(this.getEntity().getScale());var p=0,c=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var l=e*t,d=new a.Vector3,h=new a.Vector3;h.copy(i);var f=h.length();if(u.updateMatrixWorld(),h.applyQuaternion(u.quaternion),h.normalize(),o){var m=(1-t-r)*e,y=.5*(t+r)*e;"middle"===o?(d.copy(i),d.multiplyScalar(-.5*(m+y)),u.position.add(d)):"end"===o&&(d.copy(i),d.multiplyScalar(-1*(m+y)),u.position.add(d))}if(e>0){var g=function(i){if(!s.getEntity()||!s.isEnabled())return void c.off("update",g,s);d.copy(h),s.getEngine().needsRender=!0,p+=i;var n=Math.min(p/e,1),a=1-r,o=e*a;if(t&&po){var y=1-(n-a)/r;d.multiplyScalar(i*f*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0))}else d.multiplyScalar(i*f);p>=e&&(s.getEngine().off("update",g,s),s.getEntity().trigger("endAnimateTranslation")),u.position.add(d)};this.getEngine().on("update",g,this)}},t.prototype.animateRotation=function(e,t,r,i,o,s){var u=this,p=this.getRuntimeData();p.position.copy(this.getEntity().getPosition()),p.quaternion.copy(this.getEntity().getQuaternion()),p.scale.copy(this.getEntity().getScale());var c=0,l=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var d=e*t,h=new a.Quaternion,f=new a.Quaternion,m=new a.Vector3,y=new a.Euler(i.x,i.y,i.z,s);if(h.setFromEuler(y),f.copy(h),p.updateMatrixWorld(),o){var g=(1-t-r)*e,v=.5*(t+r)*e;"middle"===o?(m.copy(i),m.multiplyScalar(-.5*(g+v)),y.set(m.x,m.y,m.z),h.setFromEuler(y),p.quaternion.multiply(h)):"end"===o&&(m.copy(i),m.multiplyScalar(-1*(g+v)),y.set(m.x,m.y,m.z),h.setFromEuler(y),p.quaternion.multiply(h))}if(e>0){var b=function(i){if(!u.getEntity()||!u.isEnabled())return void l.off("update",b,u);var n=1;u.getEngine().needsRender=!0,c+=i;var a=Math.min(c/e,1),o=1-r,s=e*o;if(t&&cs){var y=1-(a-o)/r;n*=i*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0)}else n*=i;c>=e&&(u.getEngine().off("update",b,u),u.getEntity().trigger("endAnimateTranslation")),h.set(0,0,0,1),h.slerp(f,n),p.quaternion.multiply(h)};this.getEngine().on("update",b,this)}},t.prototype.animateScale=function(e,t,r,i,o){var s=this,u=this.getRuntimeData();u.position.copy(this.getEntity().getPosition()),u.quaternion.copy(this.getEntity().getQuaternion()),u.scale.copy(this.getEntity().getScale());var p=0,c=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var l=e*t,d=new a.Vector3;if(u.updateMatrixWorld(),o){var h=(1-t-r)*e,f=.5*(t+r)*e;"middle"===o?(d.copy(i),d.multiplyScalar(-.5*(h+f)),u.scale.add(d)):"end"===o&&(d.copy(i),d.multiplyScalar(-1*(h+f)),u.scale.add(d))}if(e>0){var m=function(n){if(!s.getEntity()||!s.isEnabled())return void c.off("update",m,s);d.copy(i),s.getEngine().needsRender=!0,p+=n;var a=Math.min(p/e,1),o=1-r,h=e*o;if(t&&ph){var y=1-(a-o)/r;d.multiplyScalar(n*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0))}else d.multiplyScalar(n);p>=e&&(s.getEngine().off("update",m,s),s.getEntity().trigger("endAnimateTranslation")),u.scale.add(d)};this.getEngine().on("update",m,this)}},t}(o.default);t.default=s},function(e,t,r){"use strict";function i(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1}function n(e,t,r,i){var n=e.x+(t.x-e.x)*r,a=e.y+(t.y-e.y)*r,o=e.z+(t.z-e.z)*r;i.set(n,a,o)}function a(e){return e.object.visible&&"Mesh"===e.object.type}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),s=r(1),u=r(2),p=r(22),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.speed=.8,t.zoomSteps=5,t.zoomBuffer=.1,t.time=-1,t.isMouseDown=!1,t.targetZoom=0,t.srcZoom=0,t.lastFocusPosition=new s.Vector3(-1,-1,-1),t}return o.__extends(t,e),t.prototype.onDisable=function(){this.interrupt()},t.prototype.onUpdate=function(e){if(this.isEnabled()&&!(this.time<0)){var t=this.getRuntimeData(),r=i(1-1/(this.speed/this.time));n(this.srcLook,this.targetLook,r,this.currentLook),t.lookAt(this.currentLook);var a=this.srcZoom+(this.targetZoom-this.srcZoom)*r;this.zoomComponent.lerpZoom(a),this.time-=e,this.time<=0&&this.onEnd(),this.getEngine().needsRender=!0}},t.prototype.onStartup=function(){if(this.orbitCam=this.getEntity().getComponentByScriptName("Orbit Camera"),!this.orbitCam)throw new Error("Focus component requires OrbitCamera on the entity: "+this.getId());var e=this.getEngine(),t=this.getEntity();p.isMobile()?(this.listenTo(e,"touchStart",this.onMouseDown),this.listenTo(e,"touchMove",this.onMouseMove),this.listenTo(e,"touchEnd",this.onMouseUp),this.listenTo(e,"doubleTap",this.onDoubleClick)):(this.listenTo(e,"mouseScroll",this.interrupt),this.listenTo(e,"keyDown",this.interrupt),this.listenTo(e,"mouseMove",this.onMouseMove),this.listenTo(e,"mouseDown",this.onMouseDown),this.listenTo(e,"mouseUp",this.onMouseUp),this.listenTo(e,"doubleClick",this.onDoubleClick)),this.listenTo(t,"resetOrbitCamera",this.onReset),this.zoomComponent=t.getComponentByScriptId("camera_zoom"),this.zoomComponent||(this.zoomComponent=t.addComponent("camera_zoom"))},t.prototype.onReset=function(){this.orbitCam.enable(),this.time=-1},t.prototype.onMouseDown=function(){this.isEnabled()&&(this.isMouseDown=!0)},t.prototype.onMouseUp=function(){this.isMouseDown=!1},t.prototype.onMouseMove=function(){this.isMouseDown&&this.interrupt()},t.prototype.onDoubleClick=function(e){if(this.isEnabled()&&this.hasRuntimeData()){this.raycaster||this.initializeRaycaster();var t=p.isMobile()?this.getInput().touchPositionPercent.x:e.scenePercentX,r=p.isMobile()?this.getInput().touchPositionPercent.y:e.scenePercentY;this.mouseVector.set(2*t-1,2*-r+1);var i=this.getIntersection(this.mouseVector);this.interrupt();var n=this.time>0?this.currentLook:this.orbitCam.pivotPoint.position;this.srcLook.copy(n),i?this.lookAtPoint(i.point):this.resetToOrigin(),this.time=this.speed,this.srcZoom=this.zoomComponent.getZoomLevel()}},t.prototype.lookAtPoint=function(e){this.orbitCam.disable(),this.targetLook.copy(e),this.lastFocusPosition.x===-1&&this.lastFocusPosition.copy(this.targetLook),this.targetLook.distanceTo(this.lastFocusPosition)0&&this.onEnd()},t.prototype.onEnd=function(){this.time=-1,this.orbitCam.enable(),this.orbitCam.setPivotPosition(this.currentLook),this.orbitCam.setOrbitDistance(this.getRuntimeData().position.distanceTo(this.currentLook)),this.orbitCam.resetOrbitRotation()},t.prototype.getIntersection=function(e){this.raycaster.far=this.orbitCam.getOrbitDistance()+1,this.raycaster.setFromCamera(e,this.getRuntimeData());var t=this.raycaster.intersectObjects(this.getRootThreeObject().children,!0).filter(a);return t.length>0?t[0]:void 0},t}(u.default);t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(36),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.position=new n.Vector2,t}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this.getEngine();this.listenTo(e,"mouseDown",this.onMouseDown),this.listenTo(e,"mouseMove",this.onMouseMove),this.listenTo(e,"mouseScroll",this.onMouseScroll)},t.prototype.onMouseDown=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=e.scenePercentX,this.position.y=e.scenePercentY;var r=t?o.orbitEvents.startOrbit:void 0;r&&this.trigger(r,this.position)}},t.prototype.onMouseMove=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=t?e.scenePercentX:e.scenePercentDeltaX,this.position.y=t?e.scenePercentY:e.scenePercentDeltaY;var r=this.getInput().mouseButtonDown("right"),i=r?o.orbitEvents.pan:t?o.orbitEvents.orbit:void 0;i&&this.trigger(i,this.position)}},t.prototype.onMouseScroll=function(e){this.isEnabled()&&this.trigger(o.orbitEvents.zoom,e)},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(36),s=20,u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isOrbiting=!1,t.isPanning=!1,t.isZooming=!1,t.panMidpoint=new n.Vector2,t.lastPanMidpoint=new n.Vector2,t.panDelta=new n.Vector2,t.lastZoomDistance=0,t}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this.getEngine();this.listenTo(e,"touchStart",this.cancelActions),this.listenTo(e,"touchCancel",this.cancelActions),this.listenTo(e,"touchLeave",this.cancelActions),this.listenTo(e,"touchEnd",this.cancelActions),this.listenTo(e,"touchMove",this.onTouchMove)},t.prototype.cancelActions=function(){this.isOrbiting=!1,this.isPanning=!1,this.isZooming=!1,this.panMidpoint.set(0,0),this.lastPanMidpoint.set(0,0),this.panDelta.set(0,0),this.lastZoomDistance=0},t.prototype.onTouchMove=function(e){this.isEnabled()&&e.touches.length&&(1===e.touches.length?this.onSingleTouchMove(e.touches[0]):this.onMultiTouchMove(e.touches[0],e.touches[1]))},t.prototype.onSingleTouchMove=function(e){var t=new n.Vector2(e.scenePercentX,e.scenePercentY);this.isOrbiting?this.orbit(t):(this.isOrbiting=!0,this.startOrbit(t))},t.prototype.onMultiTouchMove=function(e,t){var r=new n.Vector2(e.scenePercentX,e.scenePercentY),i=new n.Vector2(t.scenePercentX,t.scenePercentY);this.pan(r,i),this.zoom(r,i)},t.prototype.startOrbit=function(e){this.trigger(o.orbitEvents.startOrbit,e)},t.prototype.orbit=function(e){this.trigger(o.orbitEvents.orbit,e)},t.prototype.pan=function(e,t){this.panMidpoint.addVectors(e,t),this.panMidpoint.multiplyScalar(.5),this.isPanning||(this.isPanning=!0,this.lastPanMidpoint.copy(this.panMidpoint)),this.panDelta.subVectors(this.panMidpoint,this.lastPanMidpoint),this.panDelta.length()&&this.trigger(o.orbitEvents.pan,this.panDelta),this.lastPanMidpoint.copy(this.panMidpoint),this.panDelta.set(0,0)},t.prototype.zoom=function(e,t){var r=e.distanceTo(t);if(r){this.isZooming||(this.isZooming=!0,this.lastZoomDistance=r);var i=r-this.lastZoomDistance;i&&this.trigger(o.orbitEvents.zoom,i*s),this.lastZoomDistance=r}},t}(a.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.skyboxScene=void 0,t.cameras=[null,null,null,null,null,null],t}return i.__extends(t,e),t.prototype.onAttributesChanged=function(e){if(e.indexOf("inputTexture")!==-1){var t=this.getPreviousAttribute("inputTexture");this.unregisterDependency(t),this.registerDependency(this.inputTexture),this.updateTexture()}},t.prototype.onStartup=function(){this.skyboxScene=new n.Scene,this.registerDependency(this.inputTexture),this.initCameras(),this.createSkybox()},t.prototype.onEntityReady=function(){this.updateTexture()},t.prototype.onShutdown=function(){this.inputTexture&&(this.unregisterDependency(this.inputTexture),this.inputTexture.off("load",this.renderToCube,this)),this.skyboxGeometry&&this.skyboxGeometry.dispose(),this.equirectMaterial&&this.equirectMaterial.dispose(),this.skyboxScene=void 0,this.skyboxMesh=void 0,this.inputTexture=void 0},t.prototype.updateTexture=function(){this.inputTexture&&!this.getEntity().isUnloaded()&&(this.inputTexture.off("load",this.renderToCube,this),this.inputTexture.when("load",this.renderToCube,this),this.inputTexture.isBaseUnloaded()&&this.inputTexture.load())},t.prototype.createSkybox=function(){var e=n.ShaderLib.equirect;e.uniforms.tFlip.value=1,this.equirectMaterial=new n.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms,depthWrite:!1,side:n.BackSide}),this.skyboxGeometry=new n.BoxGeometry(100,100,100,1,1,1),this.skyboxMesh=new n.Mesh(this.skyboxGeometry,this.equirectMaterial),this.skyboxMesh.frustumCulled=!1,this.skyboxMesh.castShadow=!1,this.skyboxMesh.receiveShadow=!1,this.isEnabled()&&this.skyboxScene.add(this.skyboxMesh)},t.prototype.initCameras=function(){var e=90,t=1;this.cameras[0]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[0].up.set(0,-1,0),this.cameras[0].lookAt(new n.Vector3(1,0,0)),this.skyboxScene.add(this.cameras[0]),this.cameras[1]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[1].up.set(0,-1,0),this.cameras[1].lookAt(new n.Vector3(-1,0,0)),this.skyboxScene.add(this.cameras[1]),this.cameras[2]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[2].up.set(0,0,1),this.cameras[2].lookAt(new n.Vector3(0,1,0)),this.skyboxScene.add(this.cameras[2]),this.cameras[3]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[3].up.set(0,0,-1),this.cameras[3].lookAt(new n.Vector3(0,-1,0)),this.skyboxScene.add(this.cameras[3]),this.cameras[4]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[4].up.set(0,-1,0),this.cameras[4].lookAt(new n.Vector3(0,0,1)),this.skyboxScene.add(this.cameras[4]),this.cameras[5]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[5].up.set(0,-1,0),this.cameras[5].lookAt(new n.Vector3(0,0,-1)),this.skyboxScene.add(this.cameras[5])},t.prototype.renderToCube=function(){if(this.hasRuntimeData()){this.equirectMaterial.uniforms.tEquirect.value=this.inputTexture.getThreeTexture();var e=this.getRuntimeData(),t=this.getThreeRenderer();e.texture.generateMipmaps=!1,t.setViewport(0,0,e.width,e.height);for(var r=0;r<5;r++)e.activeCubeFace=r,t.render(this.skyboxScene,this.cameras[r],e);e.texture.generateMipmaps=this.getEntity().getProperty("useMipmap"),e.activeCubeFace=5,t.render(this.skyboxScene,this.cameras[5],e)}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=.0174532925,u={"+X":new a.Vector3(1,0,0),"-X":new a.Vector3(-1,0,0),"+Y":new a.Vector3(0,1,0),"-Y":new a.Vector3(0,-1,0),"+Z":new a.Vector3(0,0,1),"-Z":new a.Vector3(0,0,-1)},p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.time=0,t.target=new a.Quaternion,t.tempQuat=new a.Quaternion,t}return i.__extends(t,e),t.prototype.getRightVector=function(e){return new a.Vector3(e.elements[0],e.elements[1],e.elements[2])},t.prototype.getUpVector=function(e){return new a.Vector3(e.elements[4],e.elements[5],e.elements[6])},t.prototype.getForwardVector=function(e){return new a.Vector3(e.elements[8],e.elements[9],e.elements[10])},t.prototype.setRightVector=function(e,t){e.elements[0]=t.x,e.elements[1]=t.y,e.elements[2]=t.z},t.prototype.setUpVector=function(e,t){e.elements[4]=t.x,e.elements[5]=t.y,e.elements[6]=t.z},t.prototype.setForwardVector=function(e,t){e.elements[8]=t.x,e.elements[9]=t.y,e.elements[10]=t.z},t.prototype.setAxes=function(e,t,r){var i=u[e],o=u[t];if(!i)return n.default.error("No Up Axis available For ",e);if(!o)return n.default.error("No Forward Axis available For ",t);var s=new a.Vector3,p=new a.Matrix4;this.setUpVector(p,i),this.setForwardVector(p,o),s.crossVectors(i,o),this.setRightVector(p,s),this.target.setFromRotationMatrix(p),r?this.time=this.speed:(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete"))},t.prototype.eulerFromObject=function(e){var t=isNaN(e.x)?0:e.x*s,r=isNaN(e.y)?0:e.y*s,i=isNaN(e.z)?0:e.z*s,n=new a.Euler(t,r,i);return n.order="YXZ",n},t.prototype.rotateOnWorldAxis=function(e,t,r){if(!(this.time>0)){var i=this.getRuntimeData(),n=new a.Vector3,o=new a.Vector3;n.copy(i.position),o.copy(i.scale),i.position.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix();var u=(new a.Matrix4).makeRotationX((e.x||0)*s),p=(new a.Matrix4).makeRotationY((e.y||0)*s),c=(new a.Matrix4).makeRotationZ((e.z||0)*s);c.multiply(p),c.multiply(u),t&&c.multiply(i.matrix),this.target.setFromRotationMatrix(c),r?(this.setRotation(this.target),this.getEngine().needsRender=!0):this.time=this.speed,i.position.copy(n),i.scale.copy(o)}},t.prototype.rotateToEuler=function(e){this.target.setFromEuler(this.eulerFromObject(e)),this.time=this.speed},t.prototype.setLocalRotation=function(e){this.time=0,this.target.setFromEuler(this.eulerFromObject(e)),this.setRotation(this.target)},t.prototype.setRotation=function(e){this.getEntity().setQuaternion(e.x,e.y,e.z,e.w),this.hasRuntimeData()&&!this.getRuntimeData().quaternion.equals(e)&&this.getRuntimeData().quaternion.copy(e),this.getEngine().needsRender=!0},t.prototype.getSign=function(e){return e>0?"+":"-"},t.prototype.getAxes=function(e){var t=this.getRuntimeData().matrix,r=this.getUpVector(t).normalize(),i=this.getForwardVector(t).normalize(),n=Math.abs(r.x),a=Math.abs(r.y),o=Math.abs(r.z),s=n=0&&this.hasRuntimeData()&&(this.time-=e,this.tempQuat.copy(this.getRuntimeData().quaternion),this.tempQuat.slerp(this.target,Math.min(1,Math.max(0,1-1/(this.speed/this.time)))),this.getEntity().setQuaternion(this.tempQuat.x,this.tempQuat.y,this.tempQuat.z,this.tempQuat.w),this.getEngine().needsRender=!0,this.time<0&&(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete")))},t}(o.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.framesElapsed=0,t.reflectionNormal=new n.Vector3(0,1,0),t.reflectionPlane=new n.Plane,t.clipPlane=new n.Vector4,t.reflectionPosition=new n.Vector3,t.cameraWorldPosition=new n.Vector3,t.rotationMatrix=new n.Matrix4,t.lookAtPosition=new n.Vector3(0,0,-1),t.up=new n.Vector3(0,1,0),t.perspectiveCamera=null,t.orthoCamera=null,t}return i.__extends(t,e),t.prototype.captureScene=function(e,t){if(!t)throw new Error("Call to ReflectionCapture.captureScene without specifying a camera.");this.updateReflection(t);var r=this.captureTexture?this.captureTexture.runtimeData:null,i=r?r:this.tempRenderTexture.runtimeData;this.getRenderer().renderView(e,this.reflectionCamera,{renderTarget:i,clearDepth:!0,enableShadows:!1,enablePreRenderFunctions:!1})},t.prototype.onEntityReady=function(){this.initCameras(),this.initTexture()},t.prototype.onAttributesChanged=function(e){e.indexOf("captureTexture")!==-1&&this.initTexture()},t.prototype.onPreRenderView=function(e,t){this.isEnabled()&&(this.framesElapsed>=this.updateFrameInterval?(this.captureScene(e,t),this.framesElapsed=0):this.framesElapsed++)},t.prototype.createTempRenderTexture=function(){this.tempRenderTexture=this.getEngine().createRenderTexture2d({width:512,height:512,format:"rgba",type:"uByte"},"render_tex_reflection"),this.tempRenderTexture.load()},t.prototype.initTexture=function(){var e=this;this.captureTexture?(this.captureTexture.when("load",function(){e.tempRenderTexture&&e.tempRenderTexture.unload()}),this.captureTexture.isBaseUnloaded()&&this.captureTexture.load()):this.createTempRenderTexture()},t.prototype.initCameras=function(){this.captureTexture&&this.captureTexture.load(),this.perspectiveCamera=new n.PerspectiveCamera,this.orthoCamera=new n.OrthographicCamera(-1,1,-1,1)},t.prototype.updateReflection=function(e){if(this.isEnabled()){var t=function(e){return e<0?-1:1};this.getEntity().runtimeData.updateMatrixWorld(),e.updateMatrixWorld(!1),this.reflectionPosition.setFromMatrixPosition(this.getEntity().runtimeData.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(e.matrixWorld),this.rotationMatrix.extractRotation(this.getEntity().runtimeData.matrixWorld),this.reflectionNormal.set(0,1,0),this.reflectionNormal.applyMatrix4(this.rotationMatrix);var r=this.reflectionPosition.clone().sub(this.cameraWorldPosition),i=r.reflect(this.reflectionNormal).negate();i.add(this.reflectionPosition),this.rotationMatrix.extractRotation(e.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition);var a=this.reflectionPosition.clone().sub(this.lookAtPosition),o=a.reflect(this.reflectionNormal).negate();o.add(this.reflectionPosition),this.up.set(0,-1,0),this.up.applyMatrix4(this.rotationMatrix);var s=this.up.reflect(this.reflectionNormal).negate();if(e instanceof n.PerspectiveCamera&&this.perspectiveCamera)this.perspectiveCamera.aspect=e.aspect,this.perspectiveCamera.fov=e.fov,this.perspectiveCamera.near=e.near,this.perspectiveCamera.far=e.far,this.reflectionCamera=this.perspectiveCamera;else{if(!(e instanceof n.OrthographicCamera&&this.orthoCamera))return;this.orthoCamera.left=e.left,this.orthoCamera.right=e.right,this.orthoCamera.top=e.top,this.orthoCamera.bottom=e.bottom,this.orthoCamera.near=e.near,this.orthoCamera.far=e.far,this.reflectionCamera=this.orthoCamera}this.reflectionCamera.position.copy(i),this.reflectionCamera.up=s,this.reflectionCamera.lookAt(o),this.reflectionCamera.updateProjectionMatrix(),this.reflectionCamera.updateMatrixWorld(!1),this.reflectionCamera.matrixWorldInverse.getInverse(this.reflectionCamera.matrixWorld),this.reflectionPlane.setFromNormalAndCoplanarPoint(this.reflectionNormal,this.reflectionPosition),this.reflectionPlane.applyMatrix4(this.reflectionCamera.matrixWorldInverse),this.clipPlane.set(this.reflectionPlane.normal.x,this.reflectionPlane.normal.y,this.reflectionPlane.normal.z,this.reflectionPlane.constant);var u=new n.Vector4,p=this.reflectionCamera.projectionMatrix;p.copy(e.projectionMatrix),p.elements[8]*=-1,u.x=(t(this.clipPlane.x)+p.elements[8])/p.elements[0],u.y=(t(this.clipPlane.y)+p.elements[9])/p.elements[5],u.z=-1,u.w=(1+p.elements[10])/p.elements[14];var c=this.clipPlane.multiplyScalar(2/this.clipPlane.dot(u));p.elements[2]=c.x,p.elements[6]=c.y,p.elements[10]=c.z+1-this.clipBias,p.elements[14]=c.w}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(15),o=r(11),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.instance=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.listenTo(this.getEntity(),"createRemoteInstance",this.createRemoteInstance),this.listenTo(this.getGlobalEvents(),"createRemoteInstance",this.createRemoteInstance)},t.prototype.createRemoteInstance=function(e){var t=this;if(this.isEnabled()){var r=this.getEngine();r.fetchRemoteRepresentationsFromBox(e).then(function(i){var n=i.representations.entries[0].content.url_template.replace("{+asset_path}","entities.json");r.resourceLoader.load(n,a.default.ENTITIES,{}).on(o.default.LOAD,function(i){var n=i.filter(function(e){return"prefab"===e.type}),a=n.filter(function(e){return r.getAssetById(e.id)}).map(function(e){return r.getAssetById(e.id)});a.length||(r.addEntities(i),a=n.filter(function(e){return r.getAssetById(e.id)}).map(function(e){return r.getAssetById(e.id)})),t.recreateInstance(a,e)})})}},t.prototype.recreateInstance=function(e,t){var r=this,i=this.getEngine();if(this.instance&&(this.instance.destroy(),this.instance=null),e.length>1)this.instance=i.createNode(),e.forEach(function(e){var t=i.getAssetById(e.id);r.instance.addChild(t.createInstance())});else{var n=i.getAssetById(e[0].id);this.instance=n.createInstance()}this.instance&&this.getEntity().addChild(this.instance),this.getEntity().trigger("remoteInstanceCreated",t),this.getGlobalEvents().trigger("remoteInstanceCreated",t)},t}(n.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(3),o=r(2),s=r(22),u=r(5),p=r(190),c=r(14),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.threeRenderer=null,t.caps={},t.antialias=!1,t.preserveDrawingBuffer=!0,t.precision="highp",t.autoClear=!1,t.devicePixelRatio=1,t.shadowsEnabled=!0,t.shadowsEnabledMobile=!1,t.shadowType=n.PCFSoftShadowMap,t.shadowReverseSided=!1,t.maxTextureSize2d=Number.MAX_SAFE_INTEGER,t.maxTextureSizeCube=Number.MAX_SAFE_INTEGER,t.clearColor=new n.Color,t.clearAlpha=0,t.renderOnDemand=!0,t}return i.__extends(t,e),t.prototype.onAwake=function(){this.canvas=this.getEngine().canvas,this.initDefaultRenderer(),this.getEngine().setRenderer(this);var e=this.getThreeRenderer();e.gammaInput=!1,e.gammaOutput=!0},t.prototype.onStartup=function(){this.listenTo(this.getEngine(),"resize",this.onContainerResize),this.getEngine().renderOnDemand=this.renderOnDemand,this.shadowsEnabledMobile||(this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled),this.applyRenderSettings()},t.prototype.onShutdown=function(){this.threeRenderer&&(this.threeRenderer.context=null),this.threeRenderer=null,this.canvas=void 0},t.prototype.onAttributesChanged=function(e){var t=!1;e.indexOf("shadowsEnabledMobile")!==-1&&(t=!0),this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled,this.applyRenderSettings(),this.getEngine().renderOnDemand=this.renderOnDemand,e.indexOf("clearAlpha")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("clearColor")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("gammaOutput")!==-1&&(t=!0),e.indexOf("gammaInput")!==-1&&(t=!0),e.indexOf("shadowsEnabled")!==-1&&(t=!0),e.indexOf("shadowType")!==-1&&(this.shadowType=parseInt(String(this.shadowType),10),t=!0),e.indexOf("devicePixelRatio")!==-1&&this.onContainerResize(),t&&(a.default.info("Rebuilding materials!!!"),this.getEngine().trigger("rebuildMaterials"))},t.prototype.getGPUCapability=function(e){return this.caps[e]},t.prototype.getMaxTextureSize2d=function(){return this.maxTextureSize2d?Math.min(this.maxTextureSize2d,this.getGPUCapability("MAX_TEXTURE_SIZE")):this.getGPUCapability("MAX_TEXTURE_SIZE")},t.prototype.getMaxTextureSizeCube=function(){return this.maxTextureSizeCube?Math.min(this.maxTextureSizeCube,this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")):this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")},t.prototype.onPreRender=function(){this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(!0,!0,!0),this.threeRenderer.setViewport(0,0,this.getWidth(),this.getHeight())},t.prototype.renderView=function(e,t,r){void 0===r&&(r={});var i;if(t){r.enablePreRenderFunctions&&this.getEngine().trigger("preRenderView",e,t,r);var n=this.getCanvas().style;void 0===r.opacity||r.viewPort&&(r.viewPort.width!==this.getWidth()||r.viewPort.height!==this.getHeight())?1!==parseFloat(n.opacity)&&(n.opacity="1.0"):parseFloat(n.opacity)!==r.opacity&&(n.opacity=""+r.opacity), +r.renderTarget?this.threeRenderer.setRenderTarget(r.renderTarget):this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(r.clearColor,r.clearDepth,r.clearStencil),r.viewPort&&(i=c.default.sharedUniforms.screenDimensions,i.value.x=r.viewPort.x,i.value.y=r.viewPort.y,i.value.z=r.viewPort.width*this.devicePixelRatio,i.value.w=r.viewPort.height*this.devicePixelRatio,this.threeRenderer.setViewport(r.viewPort.x,r.viewPort.y,r.viewPort.width,r.viewPort.height));var a=r.effect?r.effect:this.threeRenderer;r.renderTarget?a.render(e,t,r.renderTarget,!1):a.render(e,t),this.getEngine().trigger("postRenderView",e,t,r)}},t.prototype.getWidth=function(){return this.canvas.clientWidth?this.canvas.clientWidth:this.canvas.width/this.devicePixelRatio},t.prototype.getHeight=function(){return this.canvas.clientHeight?this.canvas.clientHeight:this.canvas.height/this.devicePixelRatio},t.prototype.getCanvasWidth=function(){return this.canvas.width},t.prototype.getCanvasHeight=function(){return this.canvas.height},t.prototype.getCanvas=function(){return this.threeRenderer.domElement},t.prototype.onContainerResize=function(){if(this.canvas.parentElement){var e=this.canvas.parentElement.clientWidth,t=this.canvas.parentElement.clientHeight;if(this.threeRenderer.setPixelRatio(this.devicePixelRatio),s.isIOS()){var r=this.canvas;this.threeRenderer.setSize(e,t,!1),r.style.width=e+1+"px",r.style.height=t+1+"px",setTimeout(function(){r.style.width=e+"px",r.style.height=t+"px"},100)}else this.threeRenderer.setSize(e,t,!0);this.getEngine().trigger("rendererResize")}else{var i=this.canvas.width/this.devicePixelRatio,n=this.canvas.height/this.devicePixelRatio;this.threeRenderer.setPixelRatio(this.devicePixelRatio),this.threeRenderer.setSize(i,n,!0)}},t.prototype.storeGpuCaps=function(){var e=this.threeRenderer.getContext();a.default.info("WebGL VENDOR is "+e.getParameter(e.VENDOR)),a.default.info("WebGL SHADING_LANGUAGE_VERSION is "+e.getParameter(e.SHADING_LANGUAGE_VERSION)),a.default.info("WebGL RENDERER is "+e.getParameter(e.RENDERER));var t=e.FRAGMENT_SHADER,r=e.LOW_FLOAT,i=e.MEDIUM_FLOAT,n=e.HIGH_FLOAT,o=e.getShaderPrecisionFormat(t,r);if(a.default.info("Fragment Shader lowp is "+o.precision),o=e.getShaderPrecisionFormat(t,i),a.default.info("Fragment Shader mediump is "+o.precision),o=e.getShaderPrecisionFormat(t,n),a.default.info("Fragment Shader highp is "+o.precision),!navigator.isCocoonJS){this.caps.MAX_COMBINED_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_CUBE_MAP_TEXTURE_SIZE=0,this.caps.MAX_FRAGMENT_UNIFORM_VECTORS=0,this.caps.MAX_RENDERBUFFER_SIZE=0,this.caps.MAX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_TEXTURE_SIZE=0,this.caps.MAX_VARYING_VECTORS=0,this.caps.MAX_VERTEX_ATTRIBS=0,this.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_VERTEX_UNIFORM_VECTORS=0,this.caps.MAX_VIEWPORT_DIMS=0,this.caps.ALIASED_POINT_SIZE_RANGE=0,this.caps.ALIASED_LINE_WIDTH_RANGE=0,this.caps.SAMPLES=0,this.caps.SAMPLE_BUFFERS=0,this.caps.RED_BITS=0,this.caps.GREEN_BITS=0,this.caps.BLUE_BITS=0,this.caps.ALPHA_BITS=0,this.caps.DEPTH_BITS=0,this.caps.STENCIL_BITS=0,this.caps.SUBPIXEL_BITS=0,this.caps.COMPRESSED_TEXTURE_FORMATS=0,this.caps=u.map(this.caps,function(t,r){return e.getParameter(e[r])}),this.caps.EXTENSIONS=e.getSupportedExtensions();var s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");this.caps.maxAnisotropy=s?e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,a.default.info("GPU Capabilities:",this.caps)}},t.prototype.initDefaultRenderer=function(){if(!p.default.isWebGLEnabled())throw new Error("WebGL is not supported, no fallbacks available.");this.threeRenderer=new n.WebGLRenderer({canvas:this.canvas,antialias:this.antialias,preserveDrawingBuffer:this.preserveDrawingBuffer,alpha:!0,precision:this.precision,logarithmicDepthBuffer:this.logarithmicDepthBuffer}),this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(this.devicePixelRatio>0?this.devicePixelRatio:window.devicePixelRatio),this.storeGpuCaps()},t.prototype.applyRenderSettings=function(){var e=this;this.threeRenderer&&(u.forEach(this,function(t,r){void 0!==e.threeRenderer[r]&&(e.threeRenderer[r]=t)}),this.devicePixelRatio>0||(this.devicePixelRatio=window.devicePixelRatio),this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),this.shadowsEnabled&&(this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=this.shadowType,this.threeRenderer.shadowMap.renderReverseSided=this.shadowReverseSided))},t}(o.default);t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(10),s=new n.Vector3,u=new n.Euler,p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.quaternion=new n.Quaternion,t.currentGlobalQuaternion=new n.Quaternion,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.rotate=this.autoRotate,this.getEntity().on("startRotate",this.onStartRotate,this),this.getEntity().on("stopRotate",this.onStopRotate,this),this.getEntity().on("toggleRotate",this.onToggleRotate,this)},t.prototype.onShutdown=function(){this.getEntity().off("startRotate",this.onStartRotate,this),this.getEntity().off("stopRotate",this.onStopRotate,this),this.getEntity().off("toggleRotate",this.onToggleRotate,this)},t.prototype.onEnable=function(){this.rotate=this.autoRotate,this.initRotation()},t.prototype.onDisable=function(){var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()),this.rotate=!1)},t.prototype.onAttributesChanged=function(e){e.indexOf("rotation")&&this.rotation&&this.initRotation()},t.prototype.onEntityReady=function(){this.initialQuaternion=new n.Quaternion,this.initialQuaternion.copy(this.getRuntimeData().quaternion),this.initRotation()},t.prototype.onUpdate=function(e){this.rotate&&this.isEnabled()&&(this.getEngine().needsRender=!0,this.getRuntimeData()&&this.rotation&&(s.copy(this.rotation).multiplyScalar(e),u.set(s.x,s.y,s.z),this.quaternion.setFromEuler(u),this.local?this.getRuntimeData().quaternion.multiply(this.quaternion):(this.currentGlobalQuaternion.multiply(this.quaternion),this.getRuntimeData().quaternion.multiplyQuaternions(this.currentGlobalQuaternion,this.initialQuaternion))))},t.prototype.initRotation=function(){u.set(this.rotation.x,this.rotation.y,this.rotation.z),this.local?this.getRuntimeData().quaternion.copy(this.initialQuaternion):this.currentGlobalQuaternion.set(0,0,0,1)},t.prototype.onStartRotate=function(){this.rotate=!0},t.prototype.onStopRotate=function(){this.rotate=!1},t.prototype.onToggleRotate=function(){this.rotate=!this.rotate},t}(a.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.onStartup=function(){this.listenTo(this.getEntity(),"change:properties",this.onPropertiesChanged),this.isEnabled()&&this.getEntity().scaleToSize(this.size)},t.prototype.onAttributesChanged=function(e){e.indexOf("size")!==-1&&this.isEnabled()&&this.getEntity().scaleToSize(this.size)},t.prototype.onDisable=function(){this.getEntity().setScale(1,1,1)},t.prototype.onEnable=function(){this.getEntity().scaleToSize(this.size)},t.prototype.onPropertiesChanged=function(e){e.hasOwnProperty("bounds")&&this.isEnabled()&&this.getEntity().scaleToSize(this.size)},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(236),s=r(235),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.autoLoad=!0,t.uniforms=null,t.noiseMat=null,t.initialized=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.listenTo(this.getEntity(),"changeNoiseValues",this.changeNoiseValues),this.listenTo(this.getEntity(),"renderNoise",this.changeNoiseValues),this.uniforms={time:{type:"f",value:1},scale:{type:"v2",value:this.scale},offset:{type:"v2",value:this.offset},layerAmplitude:{type:"v4",value:this.layerAmplitude},layerScale:{type:"v4",value:this.layerScale}},this.noiseMat=new n.ShaderMaterial({uniforms:this.uniforms,vertexShader:o,fragmentShader:s}),this.cameraRTT=new n.OrthographicCamera(-.5,.5,.5,-.5,-10,10),this.cameraRTT.position.z=1,this.sceneRTT=new n.Scene,this.sceneRTT.add(this.cameraRTT),this.quadGeo=new n.PlaneGeometry(1,1),this.quadRTT=new n.Mesh(this.quadGeo,this.noiseMat),this.quadRTT.position.z=-5,this.sceneRTT.add(this.quadRTT),this.initialized=!0},t.prototype.onShutdown=function(){this.sceneRTT&&(this.sceneRTT.remove(this.cameraRTT),this.sceneRTT.remove(this.quadRTT)),this.sceneRTT=void 0,this.quadRTT=void 0,this.quadGeo&&this.quadGeo.dispose(),this.noiseMat&&this.noiseMat.dispose(),this.uniforms=void 0},t.prototype.onEntityReady=function(){this.autoLoad&&this.renderNoise()},t.prototype.onAttributesChanged=function(e){this.initialized&&(e.indexOf("scale")!==-1&&void 0!==this.scale.x&&(this.uniforms.scale.value.x=this.scale.x,this.uniforms.scale.value.y=this.scale.y),e.indexOf("offset")!==-1&&void 0!==this.offset.x&&(this.uniforms.offset.value.x=this.offset.x,this.uniforms.offset.value.y=this.offset.y),e.indexOf("layerScale")!==-1&&void 0!==this.layerScale.x&&(this.uniforms.layerScale.value.x=this.layerScale.x,this.uniforms.layerScale.value.y=this.layerScale.y,this.uniforms.layerScale.value.z=this.layerScale.z,this.uniforms.layerScale.value.w=this.layerScale.w),e.indexOf("layerAmplitude")!==-1&&void 0!==this.layerAmplitude.x&&(this.uniforms.layerAmplitude.value.x=this.layerAmplitude.x,this.uniforms.layerAmplitude.value.y=this.layerAmplitude.y,this.uniforms.layerAmplitude.value.z=this.layerAmplitude.z,this.uniforms.layerAmplitude.value.w=this.layerAmplitude.w),this.renderNoise())},t.prototype.renderNoise=function(){this.getThreeRenderer().render(this.sceneRTT,this.cameraRTT,this.getRuntimeData(),!0),this.getThreeRenderer().setRenderTarget(null)},t.prototype.changeNoiseValues=function(e,t,r,i){this.layerAmplitude=e,this.layerScale=t,this.scale=r,this.offset=i,this.onAttributesChanged(["layerAmplitude","layerScale","scale","offset"])},t}(a.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(12),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.skyboxTexture=null,t.stereoEnabled=!1,t.size=100,t.skyboxMesh=null,t.skyboxMeshRightEye=null,t.skyboxGeometry=null,t.skyboxGeometryRightEye=null,t.skyboxMaterialCube=null,t.skyboxUniforms=null,t.skyboxVShader=null,t.skyboxPShader=null,t.skyboxMaterial2D=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.initMaterials()},t.prototype.onShutdown=function(){this.skyboxGeometry&&this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye&&this.skyboxGeometryRightEye.dispose(),this.skyboxMaterialCube&&this.skyboxMaterialCube.dispose(),this.skyboxMaterial2D&&this.skyboxMaterial2D.dispose(),this.skyboxMesh=null,this.skyboxGeometry=null,this.skyboxGeometryRightEye=null,this.skyboxMaterialCube=null,this.skyboxMaterial2D=null,this.skyboxUniforms=null,this.skyboxTexture=null},t.prototype.getMesh=function(e){return void 0===e&&(e="left"),"left"===e?this.skyboxMesh:this.skyboxMeshRightEye},t.prototype.onAttributesChanged=function(e){if(e.indexOf("skyboxTexture")!==-1){var t=this.getPreviousAttribute("skyboxTexture");if(t){var r=this.getEngine().getEntityById(t);this.stopListening(r)}this.getEntity().unregisterDependencyById(this.getPreviousAttribute("skyboxTexture"));var i=this.getEntity().getOwnDependencyInfo(),n=this.getAttribute("skyboxTexture");i[n]||this.getEntity().registerDependencyById(this.getAttribute("skyboxTexture"))}this.getEntity().isBaseLoaded()&&(e.indexOf("skyboxTexture")===-1&&e.indexOf("stereoEnabled")===-1||this.initSkybox(),e.indexOf("size")!==-1&&this.skyboxMesh&&(this.skyboxMesh.scale.set(this.size,this.size,this.size),this.skyboxMeshRightEye.scale.set(this.size,this.size,this.size)))},t.prototype.onEnable=function(){this.getRuntimeData()&&(this.getRuntimeData().add(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().add(this.skyboxMeshRightEye),this.skyboxTexture&&this.skyboxTexture.isUnloaded()&&this.skyboxTexture.load())},t.prototype.onDisable=function(){this.getRuntimeData()&&(this.getRuntimeData().remove(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().remove(this.skyboxMeshRightEye))},t.prototype.onEntityReady=function(){this.initSkybox()},t.prototype.isStereo=function(){if(!this.skyboxTexture||!this.stereoEnabled)return!1;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:case o.ImageLayout.Stereo2dUnderOver:case o.ImageLayout.Stereo2dLeftRight:case o.ImageLayout.Stereo2dRightLeft:return this.stereoEnabled;default:return!1}},t.prototype.initGeometry=function(){this.skyboxGeometry&&(this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye.dispose()),this.skyboxGeometry=new n.SphereBufferGeometry(1,64,64),this.skyboxGeometryRightEye=this.skyboxGeometry.clone()},t.prototype.initStereoUvs=function(){if(this.skyboxTexture){var e=new n.Vector2,t=new n.Vector2,r=new n.Vector2,i=new n.Vector2;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:e.set(1,.5),t.set(0,0),r.set(1,.5),i.set(0,.5);break;case o.ImageLayout.Stereo2dUnderOver:e.set(1,.5),t.set(0,.5),r.set(1,.5),i.set(0,0);break;case o.ImageLayout.Stereo2dLeftRight:e.set(.5,1),t.set(0,0),r.set(.5,1),i.set(.5,0);break;case o.ImageLayout.Stereo2dRightLeft:e.set(.5,1),t.set(.5,0),r.set(.5,1),i.set(0,0);break;default:return}for(var a=this.skyboxGeometry.getAttribute("uv").array,s=this.skyboxGeometryRightEye.getAttribute("uv").array,u=0;un&&i>0?(e.fillText(s,r,u),s=t+" ",u+=a):s=o}),e.fillText(s,r,u)},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.standing=!0,t.userHeight=6,t.frameData=window.hasOwnProperty("VRFrameData")?new VRFrameData:{},t.standingMatrix=new n.Matrix4,t.workVector=new n.Vector3,t.scale=1,t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&this.hasRuntimeData()){var t=this.getEngine(),r=t.getVrDisplay();if(r){t.needsRender=!0,r.getFrameData(this.frameData);var i=this.frameData.pose,n=this.getRuntimeData(),a=this.getEntity();null!==i.orientation&&(a.setQuaternion(i.orientation[0],i.orientation[1],i.orientation[2],i.orientation[3]),r.capabilities.hasPosition&&i.position&&a.setPosition(i.position[0],i.position[1],i.position[2]),this.standing&&r.stageParameters?(n.updateMatrix(),this.standingMatrix.fromArray(r.stageParameters.sittingToStandingTransform),n.applyMatrix(this.standingMatrix),a.setQuaternion(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w),n.position.multiplyScalar(this.scale),a.setPosition(n.position.x,n.position.y,n.position.z)):(a.getPosition(this.workVector),this.workVector.multiplyScalar(this.scale),a.setPosition(this.workVector.x,this.workVector.y,this.workVector.z)))}}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(22),o=r(3),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.scale=1,t.isPresenting=!1,t.wasPresenting=!1,t.vrDisplays=null,t.previousPixelRatio=1,t}return i.__extends(t,e),t.prototype.getScale=function(){return this.scale},t.prototype.setScale=function(e){this.scale=e},t.prototype.getDisplays=function(){return this.vrDisplays},t.prototype.onAwake=function(){var e=this;this.listenTo(this.getEngine(),"enableVrRendering",this.onEnableVr),this.listenTo(this.getEngine(),"disableVrRendering",this.onDisableVr),this.listenTo(this.getEngine(),"toggleVrRendering",this.onToggleVr),this.onVrDisplayPresentChange=this.onVrDisplayPresentChange.bind(this),window.addEventListener("vrdisplaypresentchange",this.onVrDisplayPresentChange,!1),navigator.getVRDisplays?navigator.getVRDisplays().then(function(t){e.vrDisplays=t,e.trigger("displaysInitialized")}):this.vrDisplays=[]},t.prototype.onShutdown=function(){e.prototype.onShutdown.call(this),window.removeEventListener("vrdisplaypresentchange",this.onVrDisplayPresentChange,!1)},t.prototype.onDisable=function(){this.isPresenting&&this.onDisableVr()},t.prototype.whenDisplaysAvailable=function(e){var t=this;this.vrDisplays?e.call(this,this.vrDisplays):this.listenToOnce(this,"displaysInitialized",function(){e.call(t,t.vrDisplays)})},t.prototype.onPostRender=function(e){var t=this.getEngine().getVrDisplay();t&&this.isPresenting&&t.submitFrame()},t.prototype.onEnableVr=function(){if(this.isEnabled()){if(!this.vrDisplays)return void this.listenToOnce(this,"displaysInitialized",this.onEnableVr.bind(this));if(this.vrDisplays.length){var e=this.vrDisplays[0];this.getEngine().setVrDisplay(e);var t=this.getRenderer().getCanvas();e.requestPresent([{source:t}]).catch(function(e){o.default.error("Failed to present to VR display",e.message)})}}},t.prototype.onDisableVr=function(){if(this.isPresenting){var e=this.getEngine().getVrDisplay();e&&(e.exitPresent(),this.getEngine().setVrDisplay(null))}},t.prototype.onToggleVr=function(){this.isPresenting?this.onDisableVr():this.onEnableVr()},t.prototype.onVrDisplayPresentChange=function(){this.wasPresenting=this.isPresenting;var e=this.getEngine().getVrDisplay();this.isPresenting=e&&e.isPresenting;var t=this.getThreeRenderer();if(this.isPresenting){var r=e.getEyeParameters("left"),i=r.renderWidth,n=r.renderHeight;if(!this.wasPresenting){if(this.previousPixelRatio=t.getPixelRatio(),a.isMobile()){var o=t.capabilities.maxTextureSize,s=2*i;s*this.previousPixelRatio>o&&(this.previousPixelRatio=Math.floor(o/s)),t.setPixelRatio(this.previousPixelRatio)}else t.setPixelRatio(1);t.setSize(2*i,n,!1),this.getEngine().trigger("vrRenderingEnabled")}}else this.wasPresenting&&(t.setPixelRatio(this.previousPixelRatio),this.getEngine().setVrDisplay(null),this.getEngine().trigger("resize"),this.getEngine().trigger("vrRenderingDisabled"))},t}(n.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(65),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.enablePreRenderFunctions=!0,t.enableShadows=!0,t.eyeTranslationL=new n.Vector3,t.eyeTranslationR=new n.Vector3,t.defaultLeftBounds=[0,0,.5,1],t.defaultRightBounds=[.5,0,.5,1],t.renderRectL={x:0,y:0,width:256,height:256},t.renderRectR={x:128,y:0,width:256,height:256},t.cameraL=new n.PerspectiveCamera,t.cameraR=new n.PerspectiveCamera,t.frameData=window.hasOwnProperty("VRFrameData")?new VRFrameData:{},t.scale=1,t}return i.__extends(t,e),t.prototype.renderView=function(t){if(this.isEnabled()&&this.hasRuntimeData()){var r=this.getRootObject();if(r.isBaseLoaded()){var i=r.getRuntimeData(),n=this.getEngine().getVrDisplay();if(!n)return e.prototype.renderView.call(this,t);var a=i.autoUpdate;a&&(i.updateMatrixWorld(),i.autoUpdate=!1);var o=n.getEyeParameters("left"),s=n.getEyeParameters("right");this.eyeTranslationL.fromArray(o.offset),this.eyeTranslationR.fromArray(s.offset);var u,p,c=this.getThreeRenderer(),l=c.getSize(),d=n.getLayers();if(d.length){var h=d[0];u=null!==h.leftBounds&&4===h.leftBounds.length?h.leftBounds:this.defaultLeftBounds,p=null!==h.rightBounds&&4===h.rightBounds.length?h.rightBounds:this.defaultRightBounds}else u=this.defaultLeftBounds,p=this.defaultRightBounds;this.renderRectL={x:Math.round(l.width*u[0]),y:Math.round(l.height*u[1]),width:Math.round(l.width*u[2]),height:Math.round(l.height*u[3])},this.renderRectR={x:Math.round(l.width*p[0]),y:Math.round(l.height*p[1]),width:Math.round(l.width*p[2]),height:Math.round(l.height*p[3])};var f=this.getRuntimeData();null===f.parent&&f.updateMatrixWorld(),f.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),f.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale),this.cameraL.translateOnAxis(this.eyeTranslationL,this.scale),this.cameraR.translateOnAxis(this.eyeTranslationR,this.scale),n.depthNear=f.near,n.depthFar=f.far,n.getFrameData(this.frameData),this.cameraL.projectionMatrix.elements=this.frameData.leftProjectionMatrix,this.cameraR.projectionMatrix.elements=this.frameData.rightProjectionMatrix,c.setScissor(this.renderRectL.x,this.renderRectL.y,this.renderRectL.width,this.renderRectL.height),this.getRenderer().renderView(i,this.cameraL,{renderTarget:this.renderTarget,clearDepth:!0,clearColor:!0,viewPort:this.renderRectL,enablePreRenderFunctions:!0}),c.setScissor(this.renderRectR.x,this.renderRectR.y,this.renderRectR.width,this.renderRectR.height),this.getRenderer().renderView(i,this.cameraR,{renderTarget:this.renderTarget,clearDepth:!1,clearColor:!1,viewPort:this.renderRectR,enablePreRenderFunctions:!0}),a&&(i.autoUpdate=!0)}}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultBoxApiBase="https://api.box.com/2.0/"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(3),o=r(208),s=r(207),u=r(209),p=r(204),c=r(216),l=r(27),d=r(76),h=r(35),f=r(14),m=r(46),y=r(45),g=r(9),v=r(34),b=r(15),P=r(11),x=r(117),E=function(e){var t;return e&&e.jquery?e.get(0):"string"==typeof e?(t=document.querySelectorAll(e),t.length&&t[0]):e};t.engineMixins=y.default({},[u.default,s.default,l.default]);var w=function(e){function t(t){var r=e.call(this)||this;r.renderOnDemand=!1,r.needsRender=!0,r.container=void 0,r.globalEvents=void 0,r.engineName="Unnamed Instance of Box3D Engine",r.audioContext=void 0,r.paused=!1,r.runMode="player",r.runtimeNames={},r.nextRuntimeName=1,a.default.info("Engine Initialization"),r.globalScope=t.globalScope||window;var i=function(){if(r.globalEvents=t&&t.globalEvents||m.default,!r.globalEvents)throw new Error("No global event system supplied or found")},s=function(){r.container=r.container||E(t.container)},u=function(){if(r.canvas=r.canvas||E(t.canvas),r.canvas||(r.canvas=document.createElement("canvas"),r.container&&r.container.appendChild(r.canvas),r.canvasCreatedByEngine=!0),!(r.canvas instanceof HTMLCanvasElement))throw new Error("Failed to create canvas element")},l=function(){if(r.resourceLoader=t.resourceLoader,!r.resourceLoader)throw new Error("No resource loader passed to Engine")},y=function(){r.engineName=t.engineName||r.engineName,r.clock=new n.Clock(!0),r.frameDelta=0,r.frameDeltaAggregate=0,r.frameCount=0,r.lastFrameDelta=r.getTimeNow(),r.avgFrameTime=0,r.paused=!1,r.documentVisible=!0,r.state="initializing",r.setRunMode(t.runMode),r.entityDispatcher=t.entityDispatcher||new o.default,r.entityDispatcher.addEngine(r)},g=function(){r.scriptRegistry=new d.default(r),Object.keys(h.default.builtInAssetDescriptors).forEach(function(e){r.createEntity(h.default.builtInAssetDescriptors[e])}),Object.keys(f.default.builtInAssetDescriptors).forEach(function(e){r.createEntity(f.default.builtInAssetDescriptors[e])})},v=function(){r.materialUtilities=new c.default(r)},b=function(){r.geometryUtilities=new p.default},P=function(){r.onResize=function(){r.needsRender=!0},r.onBlur=function(){r.trigger("blur")},r.onFocus=function(){r.trigger("focus")},r.onVisibilityChange=function(){var e=document.hidden||document.mozHidden||document.msHidden||document.webkitHidden;r.documentVisible&&e?r.documentVisible=!1:r.documentVisible||(r.frameDelta=0,r.lastFrameDelta=r.getTimeNow(),r.documentVisible=!0)},window.addEventListener("blur",r.onBlur),window.addEventListener("focus",r.onFocus),r.listenTo(r,"resize",r.onResize),document.addEventListener("visibilitychange",r.onVisibilityChange)},x=function(){r.globalScope[r.engineName]=r,r.update(),r.state="initialized"};return i(),s(),u(),l(),v(),b(),y(),g(),P(),x(),r}return i.__extends(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this),a.default.info(this.engineName+" - Destroying engine."),window[this.engineName]&&delete window[this.engineName],this.baseRenderer=void 0,this.resourceLoader.destroy(),this.materialUtilities.destroy(),this.geometryUtilities.destroy(),window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),this.stopListening(this,"resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onBlur=void 0,this.onFocus=void 0,this.onResize=void 0,this.onVisibilityChange=void 0,this.trigger("shutdown"),this.state="uninitializing",this.cancelAnimationFrame(this.animationRequestID),this.canvas&&this.canvas.parentNode&&this.canvasCreatedByEngine&&this.canvas.parentNode.removeChild(this.canvas),this.entityDispatcher&&this.entityDispatcher.removeEngine(this),this.clock=void 0,this.canvas=void 0,this.container=void 0,this.threeRenderer=void 0,this.baseRenderer=void 0,this.engineName=void 0,this.entityDispatcher=void 0,this.state="uninitialized"},t.prototype.getName=function(){return this.engineName},t.prototype.addEntities=function(e){return this.entityDispatcher?this.entityDispatcher.addEntities(e):[]},t.prototype.addRemoteEntities=function(e,t){var r=this;return void 0===t&&(t={}),new Promise(function(i,n){r.resourceLoader.load(e,b.default.ENTITIES,t).on(P.default.LOAD,function(e){i(r.addEntities(e))}).on(P.default.ERROR,function(e){return n(e)})})},t.prototype.addRemoteEntitiesFromBox=function(e,t,r){var i=this;return void 0===t&&(t={}),void 0===r&&(r=x.defaultBoxApiBase),this.fetchRemoteRepresentationsFromBox(e,t,r).then(function(e){return i.addRemoteEntities(e.representations.entries[0].content.url_template.replace("{+asset_path}","entities.json"),t)})},t.prototype.fetchRemoteRepresentationsFromBox=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=x.defaultBoxApiBase);var a=r+"files/"+e+"?fields=representations";return new Promise(function(e,r){return n.resourceLoader.load(a,b.default.JSON,i.__assign({headers:{"X-Rep-Hints":"[3d]"}},t)).on(P.default.LOAD,function(t){return e(t)}).on(P.default.ERROR,function(e){return r(e)})})},t.prototype.loadEntities=function(e,t,r){var i=this;void 0===r&&(r="load"),Promise.all(e.map(function(e){var t=e instanceof g.default?e.id:e;return new Promise(function(e,n){var a=i.getEntityById(t);a?(a.when(r,function(){e()}),a.isUnloaded()&&a.load()):n(new Error("Entity can't be found."))})})).then(function(){"function"==typeof t&&t.call(i)}).catch(function(e){"function"==typeof t&&(a.default.error("loadEntities error: "+e),t.call(i,e))})},t.prototype.setVrDisplay=function(e){var t=this;this.cancelAnimationFrame(this.animationRequestID),this.vrDevice=e,this.animationRequestID=this.requestAnimationFrame(function(){t.needsRender=!0,t.update()})},t.prototype.getVrDisplay=function(){ +return this.vrDevice},t.prototype.getApplication=function(){var e=this.getAssetsByClass(v.default);return e.find(function(e){return e.isBaseLoaded()})},t.prototype.setRunMode=function(e){this.runMode="editor"===e?e:"player"},t.prototype.getRunMode=function(){return this.runMode},t.prototype.getRenderer=function(){return this.baseRenderer},t.prototype.setRenderer=function(e){this.baseRenderer&&(this.baseRenderer.onShutdown(),this.baseRenderer.stopListening()),this.baseRenderer=e,this.threeRenderer=e.threeRenderer},t.prototype.getThreeRenderer=function(){return this.threeRenderer},t.prototype.getGPUCapability=function(e){return this.baseRenderer.caps[e]},t.prototype.getAudioContext=function(){if(!this.audioContext){var e=this.globalScope.AudioContext||this.globalScope.webkitAudioContext;e&&(this.audioContext=new e,this.audioContext||a.default.warn(this.engineName+" - Failed to create Web Audio API context"))}return this.audioContext},t.prototype.getRuntimeName=function(e){return this.runtimeNames.hasOwnProperty(e)||(this.runtimeNames[e]=this.nextRuntimeName.toString(),this.nextRuntimeName++),this.runtimeNames[e]},t.prototype.pause=function(){this.paused||(this.paused=!0,this.clock.stop(),this.cancelAnimationFrame(this.animationRequestID),a.default.info(this.engineName+" engine has been paused."))},t.prototype.unpause=function(){this.paused&&(this.paused=!1,this.frameDelta=0,this.lastFrameDelta=this.getTimeNow(),this.clock.start(),a.default.info(this.engineName+" engine has been unpaused."),this.update())},t.prototype.setCurrentApp=function(e){var t=this.getAssetById(e);t&&(this.currentApplication&&(a.default.warn("Already an application running in this engine. Stop it before starting the "+t.getName()+" application."),this.currentApplication.unload()),this.currentApplication=t)},t.prototype.getTimeNow=function(){return.001*(window.performance&&window.performance.now?window.performance.now():Date.now())},t.prototype.update=function(){var e=this;this.paused||(this.animationRequestID=this.requestAnimationFrame(function(){e.update()}),this.documentVisible&&(this.frameCount++,this.frameDelta=this.getTimeNow()-this.lastFrameDelta,this.lastFrameDelta=this.getTimeNow(),this.frameDeltaAggregate+=this.frameDelta,this.avgFrameTime=this.frameDeltaAggregate/this.frameCount,this.trigger("preUpdate",this.frameDelta),this.trigger("update",this.frameDelta),this.trigger("postUpdate",this.frameDelta),this.renderOnDemand&&!this.needsRender||(this.needsRender=!1,this.trigger("preRender",this.frameDelta),this.trigger("render",this.frameDelta),this.trigger("renderGroup1",this.frameDelta),this.trigger("renderGroup2",this.frameDelta),this.trigger("renderGroup3",this.frameDelta),this.trigger("renderGroup4",this.frameDelta),this.trigger("renderGroup5",this.frameDelta),this.trigger("renderGroup6",this.frameDelta),this.trigger("renderGroup7",this.frameDelta),this.trigger("renderGroup8",this.frameDelta),this.trigger("renderGroup9",this.frameDelta),this.trigger("renderGroup10",this.frameDelta),this.trigger("postRender",this.frameDelta))))},t.prototype.requestAnimationFrame=function(e){return this.vrDevice?this.vrDevice.requestAnimationFrame(e):requestAnimationFrame(e)},t.prototype.cancelAnimationFrame=function(e){return this.vrDevice?this.vrDevice.cancelAnimationFrame(e):cancelAnimationFrame(e)},t}(t.engineMixins);t.default=w},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n={side:{displayName:"Cull Mode",description:"This controls which side of the geometry will be visible.",type:"opt",isRenderParam:!0,options:{frontOnly:i.FrontSide,backOnly:i.BackSide,doubleSided:i.DoubleSide},default:"doubleSided"},wireframe:{displayName:"Wireframe",description:"This controls whether the material displays as a wireframe.",type:"b",isRenderParam:!0,default:!1},fog:{displayName:"Enable Fog",description:"This controls whether this material is affected by fog or not.",isRenderParam:!0,forceUpdate:!0,type:"b",default:!0},depthFunc:{displayName:"Depth Function",description:"The function to use when comparing the current depth value with the one that already exists in the buffer.",isRenderParam:!0,type:"opt",options:{never:i.NeverDepth,always:i.AlwaysDepth,lessThan:i.LessDepth,lessThanOrEqual:i.LessEqualDepth,equal:i.EqualDepth,greaterThanOrEqual:i.GreaterEqualDepth,greaterThan:i.GreaterDepth,notEqual:i.NotEqualDepth},default:"lessThanOrEqual"},depthWrite:{displayName:"Enable Depth Write",description:"This controls whether the depth values of a mesh rendered with this material are recorded.",isRenderParam:!0,type:"b",default:!0},depthTest:{displayName:"Enable Depth Test",description:"This controls whether a depth check is done before this material is rendered so that it can be occluded.",isRenderParam:!0,type:"b",default:!0},blending:{displayName:"Blending Mode",description:"This controls how the material will be blended with the color behind it.",isRenderParam:!0,type:"opt",options:{none:i.NoBlending,normal:i.NormalBlending,additive:i.AdditiveBlending,subtractive:i.SubtractiveBlending,multiplicative:i.MultiplyBlending,custom:i.CustomBlending},default:"normal",transparency:"GreaterThanOne"},blendEquation:{displayName:"Blending Equation",description:"The function to use when blending the current color with the one already in the buffer.",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"}}},blendSrc:{displayName:"Blend Source",description:"",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"}}},blendDst:{displayName:"Blend Destination",description:"",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"}}},useSeparateAlphaBlend:{displayName:"Separate Blend for Alpha",description:"Use different blend values for the alpha channel.",type:"b",default:!1,displayWhen:{blending:{equals:"custom"}}},blendEquationAlpha:{displayName:"Alpha Blend Equation",description:"The function to use when blending the current alpha with the one already in the buffer.",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendSrcAlpha:{displayName:"Alpha Blend Source",description:"",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendDstAlpha:{displayName:"Alpha Blend Destination",description:"",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},polygonOffset:{displayName:"Polygon Offset",description:"Turns on rendering with polygon offsets. This can be used to work around z-fighting.",isRenderParam:!0,type:"b",default:!1},polygonOffsetFactor:{displayName:"Polygon Offset Factor",description:"Scales the maximum Z slope, with respect to X or Y of the polygon.",isRenderParam:!0,type:"f",default:1},polygonOffsetUnits:{displayName:"Polygon Offset Units",description:"Scales the minimum resolvable depth buffer value.",isRenderParam:!0,type:"f",default:1},alphaTest:{displayName:"Alpha Test",description:'Pixels with an alpha value below the given value will not be rendered. This value will only be used when this material\'s Transparency blending mode is set to "Masked"',isRenderParam:!0,forceUpdate:!0,type:"f",default:.2,min:0,max:1,step:.001}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={diffuse:{displayName:"Diffuse Color",description:"The color of light diffusely reflected by the surface.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isRenderParam:!0,uniformName:"color"},diffuseTexture:{displayName:"Diffuse Map",description:"The color reflected diffusely by the surface from lights",type:"t",default:null,isRenderParam:!0,uniformName:"map",enabledWhen:{diffuseTexture:{notEqualsDefault:!0}},transparency:"HasAlpha"},ambientFactor:{displayName:"Ambient Intensity",description:"A value to multiple the ambient color by.",type:"f",default:1,min:0,max:100,isRenderParam:!0,uniformName:"aoMapIntensity"},ambientTexture:{displayName:"Ambient Texture",description:"The color reflected by the surface from ambient lights.",type:"t",default:null,isRenderParam:!0,uniformName:"aoMap",enabledWhen:{ambientTexture:{notEqualsDefault:!0}}},emissive:{displayName:"Emissive Color",description:"A color emitted by the surface which is not affected by external lights.",type:"c",default:{r:0,g:0,b:0},min:0,max:1,isRenderParam:!0,uniformName:"emissive"},emissiveFactor:{displayName:"Emissive Intensity",description:"A value to multiple the emissive color by.",type:"f",default:1,min:0,max:100,isRenderParam:!0,uniformName:"emissiveIntensity"},emissiveTexture:{displayName:"Emissive Texture",description:"The color emitted by the surface which is not affected by external lights.",type:"t",default:null,isRenderParam:!0,uniformName:"emissiveMap",enabledWhen:{emissiveTexture:{notEqualsDefault:!0}}},bumpTexture:{displayName:"Bump Texture",description:"The height map of the surface, used to fake its shape when shading.",type:"t",default:null,isRenderParam:!0,uniformName:"bumpMap",enabledWhen:{bumpTexture:{notEqualsDefault:!0},normalMapTexture:{equalsDefault:!0}}},bumpFactor:{displayName:"Bump Scale",description:"A value to multiple the bump amount by.",type:"f",default:1,min:0,max:100,isRenderParam:!0,uniformName:"bumpScale"},normalMapTexture:{displayName:"Normal Texture",description:"The tangent-space surface directions, used to fake its shape when shading.",type:"t",default:null,isRenderParam:!0,uniformName:"normalMap",enabledWhen:{normalMapTexture:{notEqualsDefault:!0}}},normalFactor:{displayName:"Normal Scale",description:"A value to divide the normal-z amount by. i.e. lower value results in smoother surface.",type:"v2",default:{x:1,y:1},min:0,max:100,isRenderParam:!0,uniformName:"normalScale"},transparencyFactor:{displayName:"Opacity",description:"The opacity of the surface.",type:"f",default:1,min:0,max:1,isRenderParam:!0,uniformName:"opacity",transparency:"LessThanOne"},transparencyFactorTexture:{displayName:"Alpha Map",description:"The opacity of the surface.",type:"t",default:null,isRenderParam:!0,uniformName:"alphaMap",transparency:"NotFalsy",enabledWhen:{transparencyFactorTexture:{notEqualsDefault:!0}}},displacementColorTexture:{displayName:"Displacement Map",description:"A texture that stores the displacement amount at each texel.",type:"t",default:null,isRenderParam:!0,uniformName:"displacementMap",enabledWhen:{displacementColorTexture:{notEqualsDefault:!0}}},displacementFactor:{displayName:"Displacement Scale",description:"A value to multiple the displacement by.",type:"f",default:1,min:0,max:100,isRenderParam:!0,uniformName:"displacementScale"},displacementBias:{displayName:"Displacement Bias",description:"A value to bias the displacement by.",type:"f",default:0,min:-1,max:1,isRenderParam:!0,uniformName:"displacementScale"}};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"accessor",title:"AccessorDef",type:"object",description:"A typed-view into raw binary data.",properties:{componentType:{type:"string",enum:["int8","uint8","int16","int32","uint32","float32","float64"],description:"These correspond to typed arrays: Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array."},type:{type:"string",enum:["scalar","vec2","vec3","vec4","mat2","mat3","mat4"],description:"Specifies if elements are scalars, vectors or matrices."},byteOffset:{type:"integer",description:"Byte offset into the binary data."},byteStride:{type:"integer",description:"The number of bytes between successive elements (0 indicates that the elements are tightly packed)."},count:{type:"integer",description:"The number of elements, not to be confused with the number of components or bytes. For example, the number of positions, not the number of floats."}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"animationAsset",title:"AnimationAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["animation"]},properties:{$ref:"animationAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"animationAssetProperties",title:"AnimationAssetPropertiesDef",type:"object",properties:i.__assign({},n.default.properties,{clips:{type:"object",properties:{},additionalProperties:{$ref:"animationClip.json"},default:{}},layers:{type:"object",properties:{},additionalProperties:{$ref:"animationLayer.json"},defualt:{}},channels:{type:"object",properties:{},additionalProperties:{$ref:"animationChannel.json"},default:{}}}),required:["clips","layers","channels"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationChannel",title:"AnimationChannelDef",type:"object",description:"An animation channel.",properties:{name:{type:"string",description:"The channel's name."},targetObject:{type:"array",description:"The path of the object to animate.",items:{type:"string"},default:[]},targetProperty:{type:"string",description:"The path of the property to animate."},values:{type:"string",description:"The ID of the accessor for the channel values."},times:{type:"string",description:"The ID of the accessor for the channel times."},interpolation:{type:"string",enum:["linear"],description:"The interpolation type for the channel."}},required:["name","targetObject","targetProperty","values","times","interpolation"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationClip",title:"AnimationClipDef",type:"object",description:"An animation clip.",properties:{name:{type:"string",description:"The clip's name."},start:{type:"number",description:"The take's start time, in seconds.",default:0},stop:{type:"number",description:"The take's stop time, in seconds.",default:0},layers:{type:"array",items:{type:"string"},default:[]}},required:["name","start","stop","layers"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationLayer",title:"AnimationLayerDef",type:"object",description:"An animation layer.",properties:{name:{type:"string",description:"The layer's name."},blendMode:{enum:["additive"],description:"The layer's blend mode.",default:"additive"},blendWeight:{type:"number",description:"The layer's blend weight.",default:1},channels:{type:"array",items:{type:"string"},default:[]}},required:["name","blendMode","blendWeight","channels"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"applicationAsset",title:"ApplicationAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["application"]},properties:{$ref:"applicationAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"applicationAssetProperties",title:"ApplicationAssetPropertiesDef",type:"object",properties:i.__assign({},n.default.properties,{startupSceneId:{type:["string","null"],description:"#entity-PrefabAsset"}}),required:["startupSceneId"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"audioAsset",title:"AudioAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["audio"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"audioRepresentation.json"}}),properties:{$ref:"audioAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"audioAssetProperties",title:"AudioAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a=i.__assign({},n.default,{id:"audioRepresentation",title:"AudioRepresentationDef",properties:i.__assign({},n.default.properties,{bitRate:{type:"number"},sampleRate:{type:"number"},stereo:{type:"boolean"},startTime:{type:"number"},duration:{type:"number"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"boneObject",title:"BoneObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["bone"]},properties:{$ref:"boneObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"boneObjectProperties",title:"BoneObjectPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"box3",title:"Box3Def",type:"object",properties:{min:{$ref:"vector3.json"},max:{$ref:"vector3.json"}},required:["min","max"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"bufferAsset",title:"BufferAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["buffer"]},properties:{$ref:"bufferAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"bufferAssetProperties",title:"BufferAssetPropertiesDef",properties:i.__assign({},n.default.properties,{src:{type:"string",description:"The URL of the binary file."},isExternal:{type:"boolean",description:"True is the asset should be loaded from outside of the base data provider/content provider.",default:!1},contentLength:{type:"number",description:"The HTTP Content-Length."},accessors:{type:"object",properties:{},additionalProperties:{$ref:"accessor.json"},description:"Typed-views into the binary file."}}),required:["src","contentLength"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"cameraObject",title:"CameraObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["camera"]},properties:{$ref:"cameraObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"cameraObjectProperties",title:"CameraObjectPropertiesDef",properties:i.__assign({},n.default.properties,{cameraType:{type:"string",description:"",enum:["perspective","orthographic"],default:"perspective"},fov:{type:"number",default:50,dependencies:{cameraType:["perspective"]}},aspect:{type:"number",default:1.7777777777777777},near:{type:"number",default:.1},far:{type:"number",default:12e3},right:{type:"number",default:10,dependencies:{cameraType:["orthographic"]}},left:{type:"number",default:-10,dependencies:{cameraType:["orthographic"]}},top:{type:"number",default:10,dependencies:{cameraType:["orthographic"]}},bottom:{type:"number",default:-10,dependencies:{cameraType:["orthographic"]}}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"colorRgb",title:"ColorRgb",type:"object",properties:{r:{type:"number"},g:{type:"number"},b:{type:"number"}},required:["r","g","b"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"component",title:"ComponentDef",type:"object",properties:{id:{type:"string"},scriptId:{type:"string"},name:{type:"string"},enabled:{type:"boolean"},attributes:{type:"object",properties:{},additionalProperties:{$ref:"componentAttribute.json"}}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"componentAttribute",title:"ComponentAttributeDef",type:"object",properties:{type:{type:"string"},subType:{type:"object",properties:{type:{type:"string"},attributes:{}},additionalProperties:!1},attributes:{type:"array",items:{type:"object",properties:{type:{type:"string"},attributes:{}},additionalProperties:!1}}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"documentAsset",title:"DocumentAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["document"]},properties:{$ref:"documentAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"documentAssetProperties",title:"DocumentAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"dracoAttribute",title:"DracoAttributeDef",type:"object",description:"Specifies the name and ID of a Draco attribute.",properties:{name:{type:"string",description:"The name of the this attribute. For example, texture's have a uvSet property that contains the name of a UV attribute."},id:{type:"string",description:"The ID of the Draco attribute."}},required:["name","id"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(28),a=i.__assign({},n.default,{id:"dracoGeometryAsset",title:"DracoGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["dracoGeometry"]},properties:{$ref:"dracoGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(29),a=i.__assign({},n.default,{id:"dracoGeometryAssetProperties",title:"DracoGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{accessorId:{type:["string","null"],description:"The ID of the accessor containing the draco geometry: #."},attributes:{type:"object",properties:{},additionalProperties:{$ref:"dracoAttribute.json"},description:"A collection of vertex attributes. All attributes must have the same number of elements."}}),required:["accessorId"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(70),a=i.__assign({},n.default,{id:"imageAsset",title:"ImageAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["image"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"imageRepresentation.json"}}),properties:{$ref:"imageAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(41),a=i.__assign({},n.default,{id:"imageAssetProperties",title:"ImageAssetPropertiesDef",properties:i.__assign({},n.default.properties,{useCompression:{type:"boolean",description:"True if we will try to use a hardware-compressed version of the image 'instead of a regular one. This depends on the hardware capabilities of the user and the data formats available.",default:!0}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a={id:"imageRepresentation",title:"ImageRepresentationDef",properties:i.__assign({},n.default.properties,{src:{type:"string",description:"The URL of the representation."},channels:{type:"array",items:{type:"string"}},compression:{type:"string",enum:["dxt","dxt1","dxt5","jpeg","zip"]},isExternal:{type:"boolean"},width:{type:"integer",description:"The width, in pixels, of the representation."},height:{type:"integer",description:"The height, in pixels, of the representation."},colorspace:{type:"string",enum:["srgb","rgb"]}}),required:["src"],additionalProperties:!1};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"lightObject",title:"LightObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["light"]},properties:{$ref:"lightObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"lightObjectProperties",title:"LightObjectPropertiesDef",properties:i.__assign({},n.default.properties,{lightType:{type:"string",enum:["directional","point","spot","hemisphere","ambient"],default:"directional"},color:{$ref:"colorRgb.json",default:{r:.7333,g:.7333,b:.7333}},intensity:{type:"number",minimum:0,default:1},distance:{type:"number",default:0,minimum:0,dependencies:{lightType:["point","spot"]}},decay:{type:"number",default:1,minimum:0,maximum:5,dependencies:{lightType:["point","spot"]}},angle:{type:"number",default:Math.PI/3,minimum:1,maximum:Math.PI,dependencies:{lightType:["spot"]}},penumbra:{type:"number",default:Math.PI/4,minimum:.001,maximum:Math.PI/2,dependencies:{lightType:["spot"]}},groundColor:{$ref:"colorRgb.json",dependencies:{lightType:["hemisphere"]},default:{r:.033,g:.333,b:.7333}},castShadow:{type:"boolean",default:!1,description:"#read-only"},receiveShadow:{description:"#unused"},shadowCameraNear:{type:"number",default:.1,description:"#read-only"},shadowCameraFar:{type:"number",default:20,description:"#read-only"},shadowCameraLeft:{type:"number",default:-10,dependencies:{lightType:["directional"]},description:"#read-only"},shadowCameraRight:{type:"number",default:10,dependencies:{lightType:["directional"]},description:"#read-only"},shadowCameraTop:{type:"number",default:10,dependencies:{lightType:["directional"]},description:"#read-only"},shadowCameraBottom:{type:"number",default:-10,dependencies:{lightType:["directional"]},description:"#read-only"},shadowBias:{type:"number",default:-.0015,description:"#read-only"},shadowMapWidth:{type:"integer",default:1024,description:"#read-only"},shadowMapHeight:{type:"integer",default:1024,description:"#read-only"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"materialAsset",title:"MaterialAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["material"]},properties:{$ref:"materialAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"materialAssetProperties",title:"MaterialAssetPropertiesDef",properties:i.__assign({},n.default.properties,{shaderId:{type:"string",default:"fbx_surface_phong_shader"}}),additionalProperties:!0});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"meshAttribute",title:"MeshAttributeDef",type:"object",description:"Specifies a range of attribute data for the vertices of a mesh.",properties:{name:{type:"string",description:"The name of the this attribute. For example, texture's have a uvSet property that contains the name of a UV attribute."},accessorId:{type:["string","null"],description:"The ID of the buffer asset and accessor: #."}},required:["name","accessorId"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(28),a=i.__assign({},n.default,{id:"meshGeometryAsset",title:"MeshGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["meshGeometry"]},properties:{$ref:"meshGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(29),a=i.__assign({},n.default,{id:"meshGeometryAssetProperties",title:"MeshGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{attributes:{type:"object",properties:{},additionalProperties:{$ref:"meshAttribute.json"},description:"A collection of vertex attributes. All attributes must have the same number of elements."},indices:{type:["string","null"],description:"The ID of the accessor containing the vertex indices: #."},primitives:{type:"array",items:{$ref:"meshPrimitive.json"},description:"The primitives (points, lines, triangles) that make up the mesh."}}),required:["attributes","indices","primitives"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"meshObject",title:"MeshObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["mesh"]},properties:{$ref:"meshObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"meshObjectProperties",title:"MeshObjectPropertiesDef",properties:i.__assign({},n.default.properties,{customDepthMaterial:{type:["string","null"],default:null},materials:{type:"array",description:"#entity-MaterialAsset",default:["missingMaterial"]},geometryId:{type:["string","null"],description:"#entity-BaseGeometryAsset",default:null},skinId:{type:["string","null"],description:"#entity-SkinAsset",default:null}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={$schema:"http://json-schema.org/draft-04/schema",id:"meshPrimitve",title:"meshPrimitiveDef",type:"object",description:"A mesh primitive with an optional material assignment.",properties:{primitive:{enum:["points","lines","triangles"],description:"The type of primitive to render.",default:"triangles"},count:{type:"integer",description:"The number of vertices to draw.",default:0},start:{type:"integer", +description:"The index of the first vertex to draw.",default:0},offset:{type:"integer",description:"An offset to apply to each index. This can be used to overcome the 16-bit index limit imposed by WebGL. For example, the first component of a vertex attribute with a value size of 3 would be referenced as follows: values[3 * (offset + indices[start + i])].",default:0},materialIndex:{type:"integer",description:"The index of the material to apply to the primitive being rendered.",default:0}},required:["primitve","count"],additionalProperties:!1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"nodeObject",title:"NodeObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["node"]}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"nodeObjectProperties",title:"NodeObjectPropertiesDef",properties:i.__assign({},n.default.properties)});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"prefabAsset",title:"PrefabAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["prefab"]},properties:{$ref:"prefabAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"prefabAssetProperties",title:"PrefabAssetPropertiesDef",properties:i.__assign({},n.default.properties,{rootObjectId:{type:["string","null"],default:null,description:"The ID of the BaseObject that serves as the root node of a hierarchy. #entity-BaseObject"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(28),a=i.__assign({},n.default,{id:"primitiveGeometryAsset",title:"PrimitiveGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["primitiveGeometry"]},properties:{$ref:"primitiveGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(29),a=i.__assign({},n.default,{id:"primitiveGeometryAssetProperties",title:"PrimitiveGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{type:{type:"string",default:"sphere",enum:["sphere","box","plane","torus","cylinder"]},radius:{type:"number",default:.5,min:0,dependencies:{type:["sphere","torus"]}},segmentsU:{type:"integer",default:24,min:0,dependencies:{type:["torus","sphere","cylinder"]}},segmentsV:{type:"integer",default:24,min:0,dependencies:{type:["torus","sphere","cylinder"]}},sizeX:{type:"number",default:1,dependencies:{type:["box","plane"]}},sizeY:{type:"number",default:1,dependencies:{type:["box","plane"]}},sizeZ:{type:"number",default:1,dependencies:{type:["box"]}},segmentsX:{type:"integer",default:1,min:0,dependencies:{type:["box","plane"]}},segmentsY:{type:"integer",default:1,min:0,dependencies:{type:["box","plane"]}},segmentsZ:{type:"integer",default:1,min:0,dependencies:{type:["box"]}},radiusTop:{type:"number",default:.5,min:0,dependencies:{type:["cylinder"]}},radiusBottom:{type:"number",default:.5,min:0,dependencies:{type:["cylinder"]}},height:{type:"number",default:1,min:0,dependencies:{type:["cylinder"]}},open:{type:"boolean",default:!1,dependencies:{type:["cylinder"]}},tubeRadius:{type:"number",default:.1,min:0,dependencies:{type:["torus"]}},arcAngle:{type:"number",default:6.283185307179586,min:0,max:6.283185307179586,dependencies:{type:["torus"]}},phiStart:{type:"number",default:0,min:0,max:6.283185307179586,dependencies:{type:["sphere"]}},phiLength:{type:"number",default:6.283185307179586,min:0,max:6.283185307179586,dependencies:{type:["sphere"]}},thetaStart:{type:"number",default:0,min:0,max:6.283185307179586,dependencies:{type:["sphere","cylinder"]}},thetaLength:{type:"number",default:3.141592653589793,min:0,max:6.283185307179586,dependencies:{type:["sphere","cylinder"]}}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(42),a=i.__assign({},n.default,{id:"renderTexture2DAsset",title:"RenderTexture2DAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["renderTexture2D"]},properties:{$ref:"renderTexture2DAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(43),a=i.__assign({},n.default,{id:"renderTexture2DAssetProperties",title:"RenderTexture2DAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(42),a=i.__assign({},n.default,{id:"renderTextureCubeAsset",title:"RenderTextureCubeAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["renderTextureCube"]},properties:{$ref:"renderTextureCubeAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(43),a=i.__assign({},n.default,{id:"renderTextureCubeAssetProperties",title:"RenderTextureCubeAssetPropertiesDef",properties:i.__assign({},n.default.properties,{mappingType:{type:"string",description:"his value is temporarily here for compatibility with three.js. Remove it when adding a separate transform object to textures.",default:"environment"},textureUse:{type:"string",enum:["standard","sphericalReflection","sphereReflection","shadow","light","bumpNormal"],description:"Hints at the type of data that the texture contains.",default:"sphericalReflection"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(16),a=i.__assign({},n.default,{id:"sceneObject",title:"SceneObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["scene"]},properties:{$ref:"sceneObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(17),a=i.__assign({},n.default,{id:"sceneObjectProperties",title:"SceneObjectPropertiesDef",properties:i.__assign({},n.default.properties,{fogEnabled:{type:"boolean",default:!1},fogType:{type:"string",default:"FogExp2"},fogColor:{type:["number","string"],default:12303291},fogDensity:{type:"number",default:4e-4}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"scriptAsset",title:"ScriptAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["script"]},properties:{$ref:"scriptAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"scriptAssetProperties",title:"ScriptAssetPropertiesDef",properties:i.__assign({},n.default.properties,{attributes:{type:"object",default:{}},description:{type:"string",default:""},events:{type:"object",default:{}},externalDependencies:{type:"array",default:[]},filter:{type:"array",items:{type:"string"},default:[]},category:{type:"string",default:""},executeIn:{type:"string",enum:["player","editor","all"],default:"player"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"shaderAsset",title:"ShaderAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["shader"]},properties:{$ref:"shaderAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"shaderAssetProperties",title:"ShaderAssetPropertiesDef",properties:i.__assign({},n.default.properties,{parameters:{type:"object",default:{},additionalProperties:{$ref:"shaderParameter.json"}},uniforms:{type:"object",default:{}},vertexShader:{type:"string",default:""},fragmentShader:{type:"string",default:""}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={type:"object",id:"shaderConditions",title:"ShaderConditionsDef",properties:{or:{type:"array",items:{type:"object",properties:{},additionalProperties:!0}},equals:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"object"}]},notEquals:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"object"}]},equalsDefault:{type:"boolean"},notEqualsDefault:{type:"boolean"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={id:"shaderParameter",title:"ShaderParameterDef",properties:{displayName:{type:"string"},description:{type:"string"},isRenderParam:{type:"boolean"},isUniform:{type:"boolean"},uniformName:{type:"string"},type:{type:"string",enum:["b","c","f","t","opt","v2","v3","v4"]},min:{type:"number"},max:{type:"number"},options:{type:"object",properties:{},additionalProperties:!0},displayWhen:{properties:{},additionalProperties:{$ref:"shaderConditions.json"}},enabledWhen:{properties:{},additionalProperties:{$ref:"shaderConditions.json"}},defines:{properties:{},additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"}]}},derivatives:{type:"boolean"},default:{anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"},{type:"object",properties:{},additionalProperties:!0}]},transparency:{enum:["LessThanOne","GreaterThanOne","NotFalsy","HasAlpha"]},textureUsage:{enum:["bump","normal"]},forceUpdate:{type:"boolean"},textureType:{enum:["Cube"]},step:{type:"number"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"skinAsset",title:"SkinAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["skin"]},properties:{$ref:"skinAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"skinAssetProperties",title:"SkinAssetPropertiesDef",properties:i.__assign({},n.default.properties,{bindShapeMatrix:{type:"array",description:"Bind shape matrix specifying how the mesh should be transformed into the right coordinate system for use with the joints.",items:{type:"number"},minItems:16,maxItems:16,default:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},inverseBindMatrices:{type:["string","null"],description:"The ID of the accessor containing the inverse bind matrices: #."},jointNames:{type:"array",description:"Names of the joints in this skin.",items:{type:"string"},uniqueItems:!0,default:[]}}),required:["bindShapeMatrix","inverseBindMatrices","jointNames"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(30),a=i.__assign({},n.default,{id:"texture2DAsset",title:"Texture2DAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["texture2D"]},properties:{$ref:"texture2DAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(21),a=i.__assign({},n.default,{id:"texture2DAssetProperties",title:"Texture2DAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(30),a=i.__assign({},n.default,{id:"textureCubeAsset",title:"TextureCubeAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["textureCube"]},properties:{$ref:"textureCubeAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(21),a=i.__assign({},n.default,{id:"textureCubeAssetProperties",title:"TextureCubeAssetPropertiesDef",properties:i.__assign({},n.default.properties,{mappingType:{type:"string",default:"environment"},textureUse:{type:"string",enum:["standard","sphericalReflection","sphereReflection","shadow","light","bumpNormal"],description:"Hints at the type of data that the texture contains.",default:"sphericalReflection"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector2",title:"Vector2Def",type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector3",title:"Vector3Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}},required:["x","y","z"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector4",title:"Vector4Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"},w:{type:"number"}},required:["x","y","z","w"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"videoAsset",title:"VideoAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["video"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"videoRepresentation.json"}}),properties:{$ref:"videoAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(41),a=r(21),o=i.__assign({},n.default,a.default,{id:"videoAssetProperties",title:"VideoAssetPropertiesDef",properties:i.__assign({},n.default.properties,a.default.properties,{autoPlay:{type:"boolean",default:!0},muted:{type:"boolean",default:!0},state:{type:"string",default:"play"},loop:{type:"boolean",default:!0},querySelector:{type:"string"}})});t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a=i.__assign({},n.default,{id:"videoRepresentation",title:"VideoRepresentationDef",properties:i.__assign({},n.default.properties,{video:{type:"object",properties:{height:{type:"integer"},width:{type:"integer"}}}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e;try{e=window.WebGLRenderingContext?document.createElement("canvas").getContext("experimental-webgl"):void 0}catch(e){}var t=!!e,r=!!t&&!!e.getExtension("OES_texture_float"),i=!!t&&!(0===e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS));return e=void 0,{isWebGLEnabled:function(){return t},isFloatingPointTexturesEnabeled:function(){return r},isVertexTexturesEnabeled:function(){return i}}}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=function(e){return"node"===e.type||"camera"===e.type||"scene"===e.type||"light"===e.type||"mesh"===e.type||"bone"===e.type},t.isAsset=function(e){return!t.isObject(e)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,r){var i=r(245);e.exports=function(e,t,r){if(i(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,i){return e.call(t,r,i)};case 3:return function(r,i,n){return e.call(t,r,i,n)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,r){var i=r(260)("wks"),n=r(195),a=r(33).Symbol,o="function"==typeof a,s=e.exports=function(e){return i[e]||(i[e]=o&&a[e]||(o?a:n)("Symbol."+e))};s.store=i},function(e,t){function r(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=r},function(e,t,r){(function(t){var r,i=t.crypto||t.msCrypto;if(i&&i.getRandomValues){var n=new Uint8Array(16);r=function(){return i.getRandomValues(n),n}}if(!r){var a=new Array(16);r=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),a[t]=e>>>((3&t)<<3)&255;return a}}e.exports=r}).call(t,r(74))},function(e,t,r){function i(e){return r(n(e))}function n(e){var t=a[e];if(!(t+1))throw new Error("Cannot find module '"+e+"'.");return t}var a={"./accessor":121,"./accessor.ts":121,"./animationAsset":122,"./animationAsset.ts":122,"./animationAssetProperties":123,"./animationAssetProperties.ts":123,"./animationChannel":124,"./animationChannel.ts":124,"./animationClip":125,"./animationClip.ts":125,"./animationLayer":126,"./animationLayer.ts":126,"./applicationAsset":127,"./applicationAsset.ts":127,"./applicationAssetProperties":128,"./applicationAssetProperties.ts":128,"./audioAsset":129,"./audioAsset.ts":129,"./audioAssetProperties":130,"./audioAssetProperties.ts":130,"./audioRepresentation":131,"./audioRepresentation.ts":131,"./baseAsset":7,"./baseAsset.ts":7,"./baseAssetProperties":8,"./baseAssetProperties.ts":8,"./baseEntity":39,"./baseEntity.ts":39,"./baseEntityProperties":40,"./baseEntityProperties.ts":40,"./baseGeometryAsset":28,"./baseGeometryAsset.ts":28,"./baseGeometryAssetProperties":29,"./baseGeometryAssetProperties.ts":29,"./baseImageAsset":70,"./baseImageAsset.ts":70,"./baseImageAssetProperties":41,"./baseImageAssetProperties.ts":41,"./baseObject":16,"./baseObject.ts":16,"./baseObjectProperties":17,"./baseObjectProperties.ts":17,"./baseRenderTextureAsset":42,"./baseRenderTextureAsset.ts":42,"./baseRenderTextureAssetProperties":43,"./baseRenderTextureAssetProperties.ts":43,"./baseTextureAsset":30,"./baseTextureAsset.ts":30,"./baseTextureAssetProperties":21,"./baseTextureAssetProperties.ts":21,"./boneObject":132,"./boneObject.ts":132,"./boneObjectProperties":133,"./boneObjectProperties.ts":133,"./box3":134,"./box3.ts":134,"./bufferAsset":135,"./bufferAsset.ts":135,"./bufferAssetProperties":136,"./bufferAssetProperties.ts":136,"./cameraObject":137,"./cameraObject.ts":137,"./cameraObjectProperties":138,"./cameraObjectProperties.ts":138,"./colorRgb":139,"./colorRgb.ts":139,"./commonImageProperties":44,"./commonImageProperties.ts":44,"./component":140,"./component.ts":140,"./componentAttribute":141,"./componentAttribute.ts":141,"./documentAsset":142,"./documentAsset.ts":142,"./documentAssetProperties":143,"./documentAssetProperties.ts":143,"./dracoAttribute":144,"./dracoAttribute.ts":144,"./dracoGeometryAsset":145,"./dracoGeometryAsset.ts":145,"./dracoGeometryAssetProperties":146,"./dracoGeometryAssetProperties.ts":146,"./imageAsset":147,"./imageAsset.ts":147,"./imageAssetProperties":148,"./imageAssetProperties.ts":148,"./imageRepresentation":149,"./imageRepresentation.ts":149,"./index":4,"./index.ts":4,"./lightObject":150,"./lightObject.ts":150,"./lightObjectProperties":151,"./lightObjectProperties.ts":151,"./materialAsset":152,"./materialAsset.ts":152,"./materialAssetProperties":153,"./materialAssetProperties.ts":153,"./meshAttribute":154,"./meshAttribute.ts":154,"./meshGeometryAsset":155,"./meshGeometryAsset.ts":155,"./meshGeometryAssetProperties":156,"./meshGeometryAssetProperties.ts":156,"./meshObject":157,"./meshObject.ts":157,"./meshObjectProperties":158,"./meshObjectProperties.ts":158,"./meshPrimitive":159,"./meshPrimitive.ts":159,"./nodeObject":160,"./nodeObject.ts":160,"./nodeObjectProperties":161,"./nodeObjectProperties.ts":161,"./prefabAsset":162,"./prefabAsset.ts":162,"./prefabAssetProperties":163,"./prefabAssetProperties.ts":163,"./primitiveGeometryAsset":164,"./primitiveGeometryAsset.ts":164,"./primitiveGeometryAssetProperties":165,"./primitiveGeometryAssetProperties.ts":165,"./renderTexture2DAsset":166,"./renderTexture2DAsset.ts":166,"./renderTexture2DAssetProperties":167,"./renderTexture2DAssetProperties.ts":167,"./renderTextureCubeAsset":168,"./renderTextureCubeAsset.ts":168,"./renderTextureCubeAssetProperties":169,"./renderTextureCubeAssetProperties.ts":169,"./representation":31,"./representation.ts":31,"./sceneObject":170,"./sceneObject.ts":170,"./sceneObjectProperties":171,"./sceneObjectProperties.ts":171,"./scriptAsset":172,"./scriptAsset.ts":172,"./scriptAssetProperties":173,"./scriptAssetProperties.ts":173,"./shaderAsset":174,"./shaderAsset.ts":174,"./shaderAssetProperties":175,"./shaderAssetProperties.ts":175,"./shaderConditions":176,"./shaderConditions.ts":176,"./shaderParameter":177,"./shaderParameter.ts":177,"./skinAsset":178,"./skinAsset.ts":178,"./skinAssetProperties":179,"./skinAssetProperties.ts":179,"./texture2DAsset":180,"./texture2DAsset.ts":180,"./texture2DAssetProperties":181,"./texture2DAssetProperties.ts":181,"./textureCubeAsset":182,"./textureCubeAsset.ts":182,"./textureCubeAssetProperties":183,"./textureCubeAssetProperties.ts":183,"./vector2":184,"./vector2.ts":184,"./vector3":185,"./vector3.ts":185,"./vector4":186,"./vector4.ts":186,"./videoAsset":187,"./videoAsset.ts":187,"./videoAssetProperties":188,"./videoAssetProperties.ts":188,"./videoRepresentation":189,"./videoRepresentation.ts":189};i.keys=function(){return Object.keys(a)},i.resolve=n,e.exports=i,i.id=199},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n="0.0.0-semantic-release";t.version=n;var a=r(1);t.THREE=a;var o=r(231);t.Components=o;var s=r(117);t.Constants=s;var u=r(4);t.Schemas=u.default;var p=r(118);t.Engine=p.default;var c=r(76);t.ScriptRegistry=c.default;var l=r(9);t.BaseEntity=l.default;var d=r(48);t.AnimationAsset=d.default;var h=r(34);t.ApplicationAsset=h.default;var f=r(49);t.AudioAsset=f.default;var m=r(6);t.BaseAsset=m.default;var y=r(23);t.BaseGeometryAsset=y.default;var g=r(12);t.BaseImageAsset=g.default;var v=r(50);t.BaseRenderTextureAsset=v.default;var b=r(19);t.BaseTextureAsset=b.default;var P=r(20);t.BufferAsset=P.default;var x=r(75);t.DocumentAsset=x.default;var E=r(51);t.DracoGeometryAsset=E.default;var w=r(52);t.ImageAsset=w.default;var _=r(14);t.MaterialAsset=_.default;var S=r(53);t.MeshGeometryAsset=S.default;var D=r(54);t.PrefabAsset=D.default;var A=r(55);t.PrimitiveGeometryAsset=A.default;var T=r(56);t.RenderTexture2DAsset=T.default;var M=r(57);t.RenderTextureCubeAsset=M.default;var R=r(58);t.ScriptAsset=R.default;var C=r(35);t.ShaderAsset=C.default;var O=r(59);t.SkinAsset=O.default;var I=r(60);t.Texture2DAsset=I.default;var j=r(61);t.TextureCubeAsset=j.default;var k=r(24);t.VideoAsset=k.default;var L=r(10);t.BaseObject=L.default;var B=r(68);t.NodeObject=B.default;var N=r(66);t.BoneObject=N.default;var V=r(67);t.CameraObject=V.default;var U=r(37);t.LightObject=U.default;var z=r(25);t.MeshObject=z.default;var F=r(38);t.SceneObject=F.default;var G=r(15);t.LoadingType=G.default;var q=r(11);t.LoadingEvent=q.default;var H=r(69);t.LoadingState=H.default;var $=r(2);t.BaseComponent=$.default;var W=r(63);t.Handedness=W.Handedness;var X=r(64);t.RenderMode=X.RenderMode;var Q=r(3);t.log=Q.default;var Z=r(228);t.XhrResourceLoader=Z.default,i.__exportStar(r(22),t);var Y=r(46);t.globalEvents=Y.default;var K=r(190);t.browserCaps=K.default},function(e,t,r){r(265),e.exports=r(32).Array.find},function(e,t,r){r(266),e.exports=r(32).Math.log10},function(e,t,r){r(267),e.exports=r(32).Math.log2},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(){var e=this;this.defaultGeometry=new i.BufferGeometry,this.defaultGeometry.setIndex(new i.BufferAttribute(new Uint16Array(0),1));var t={position:new i.BufferAttribute(new Float32Array(0),3),normal:new i.BufferAttribute(new Float32Array(0),3,!0),skinWeight:new i.BufferAttribute(new Float32Array(0),4,!0),skinIndex:new i.BufferAttribute(new Uint16Array(0),4,!0)};Object.keys(t).forEach(function(r){var i=t[r];e.defaultGeometry.addAttribute(r,i)})}return e.prototype.destroy=function(){this.defaultGeometry&&(this.defaultGeometry.dispose(),this.defaultGeometry=void 0)},e.prototype.getDefaultGeometry=function(){return this.defaultGeometry},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(5),a=function(){function e(){this.components=[]}return e.prototype.initializeComponents=function(){this.listenTo(this.engine,"scriptDeleted",this.onScriptDeleted),this.listenTo(this,"change:component",this.onComponentChanged),this.listenTo(this,"remove:component",this.onComponentRemoved),this.listenTo(this,"add:component",this.onComponentAdded)},e.prototype.getComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.components;return n.deepClone(r.find(function(r){return t||e(r)}))},e.prototype.getPreviousComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.previousComponents;return n.deepClone(r.find(function(r){return t||e(r)}))},e.prototype.getComponentDescriptors=function(e){var t="function"!=typeof e,r=this.sharedData.components;return r.filter(function(r){return t||e(r)}).map(function(e){return n.deepClone(e)})},e.prototype.getComponentDescriptorById=function(e){return this.getComponentDescriptor(function(t){return t.id===e})},e.prototype.getPreviousComponentDescriptorById=function(e){return this.getPreviousComponentDescriptor(function(t){return t.id===e})},e.prototype.addComponent=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="");var i={scriptId:"string"==typeof e?e:e.id,attributes:t,enabled:!0,name:r},n=this.engine.entityDispatcher;return n.dispatchComponentAdded(this.id,i),this.components[this.components.length-1]},e.prototype.removeComponent=function(e){var t=e.getIndex();return t>=0&&(this.engine.entityDispatcher.dispatchComponentRemoved(this.id,t),!0)},e.prototype.getComponentByIndex=function(e){return this.components[e]||null},e.prototype.getComponentByName=function(e){return this.getComponent(function(t){return t.getName()===e})},e.prototype.getComponentsByName=function(e){return this.getComponents(function(t){return t.getName()===e})},e.prototype.getComponentByScriptId=function(e){return this.getComponent(function(t){return t.getScriptId()===e})},e.prototype.getComponentsByScriptId=function(e){return this.getComponents(function(t){return t.getScriptId()===e})},e.prototype.getComponentByScriptName=function(e){return this.getComponent(function(t){return t.getScriptName()===e})},e.prototype.getComponentsByScriptName=function(e){return this.getComponents(function(t){return t.getScriptName()===e})},e.prototype.getComponent=function(e){var t="function"!=typeof e;return this.components.find(function(r){return t||e(r)})},e.prototype.getComponentById=function(e){return this.getComponent(function(t){return t.getId()===e})},e.prototype.getComponents=function(e){var t="function"!=typeof e;return this.components.filter(function(r){return t||e(r)})},e.prototype.setComponents=function(e,t){var r=this;void 0===t&&(t=!1);for(var i=this.engine.entityDispatcher,n=this.sharedData.components.length;n>=0;n--)i.dispatchComponentRemoved(this.id,n);e.forEach(function(e){i.dispatchComponentAdded(r.id,e)})},e.prototype.startComponents=function(){var e=this;this.components.forEach(function(t){return e.startComponent(t)})},e.prototype.stopComponents=function(){var e=this;this.components.forEach(function(t){return e.stopComponent(t)})},e.prototype.onScriptDeleted=function(e){var t=this,r=this.getComponentsByScriptId(e);r.forEach(function(e){t.removeComponent(e)})},e.prototype.onComponentChanged=function(e,t){var r=this.getComponentByIndex(e);if(!r)throw new Error("Don't have a component at index "+e);if(t.attributes){this.assignAttributeValues(r,t.attributes);var i=Object.keys(t.attributes);r.trigger("attributesChanged",i)}t.name&&(r.name=t.name)},e.prototype.onComponentAdded=function(e){var t=this.createComponentObject(e);t.trigger("awake"),this.assignAttributeValues(t);var r=t.getScriptAsset(),i=Object.keys(r.getProperty("attributes"));t.trigger("attributesChanged",i),this.isBaseUnloaded()||this.startComponent(t)},e.prototype.onComponentRemoved=function(e){var t=this.components[e];if(!t)throw new Error("Can't find component at index "+e+" to remove.");this.stopComponent(t),this.components.splice(e,1)},e.prototype.translateAttributeValue=function(e,t,r,n){var a=this,o=this.engine;if(!r)throw new Error("Attribute "+t+" does not exist for this component.");switch(r.type){case"asset":e[t]=o.getAssetById(n);break;case"object":e[t]=o.getObjectById(n);break;case"custom":e[t]=e[t]||{},Object.keys(n).forEach(function(i){a.translateAttributeValue(e[t],i,r.attributes[i],n[i])});break;case"c":e[t]=e[t]||new i.Color,e[t].setRGB(n.r,n.g,n.b);break;case"a":e[t]=e[t]||[];var s;switch(r.subType.type){case"asset":n.forEach(function(r,i){e[t][i]=o.getAssetById(r)});break;case"object":n.forEach(function(r,i){e[t][i]=o.getObjectById(r)});break;case"custom":n.forEach(function(i,o){e[t][o]=e[t][o]||{},Object.keys(i).forEach(function(i){a.translateAttributeValue(e[t][o],i,r.subType.attributes[i],n[o][i])})});break;case"a":n.forEach(function(i,o){e[t][o]=e[t][o]||[],i.forEach(function(i,s){a.translateAttributeValue(e[t][o],s.toString(10),r.subType.subType,n[o][s])})});break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,n.forEach(function(r,i){e[t][i]=e[t][i]||new s,e[t][i].copy(r)});break;default:n.forEach(function(r,i){e[t][i]=r})}break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,e[t]=e[t]||new s,e[t].copy(n);break;default:e[t]=n}},e.prototype.assignAttributeValues=function(e,t){var r=this,i="object"!=typeof t,n=e.getScriptAsset(),a=n.getProperty("attributes")||{};Object.keys(a).forEach(function(n){if(i||t.hasOwnProperty(n)){var o=a[n],s=e.getAttribute(o.name);r.translateAttributeValue(e,o.name,o,s)}})},e.prototype.createComponentObject=function(e){var t=e.scriptId,r=this.engine.getAssetById(t);if(!r)throw new Error("Unable to find script asset for "+t);r.isUnloaded()&&r.load();var i=new r.sharedData.classConstructor;return this.components.push(i),Object.assign(i,{id:e.id,name:e.name,scriptName:r.getName(),scriptId:t,enabled:!!e.enabled,entity:this}),i.bindSelfEvents(),i},e.prototype.startComponent=function(e){e.trigger("startup")},e.prototype.stopComponent=function(e){e.trigger("shutdown")},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(9),n=r(3),a=function(){function e(){this.ownDependencies={},this.dependencies={}}return e.prototype.getOwnDependencies=function(){var e=this;return Object.keys(this.ownDependencies).map(function(t){return e.engine.getEntityById(t)}).filter(function(e){return e})},e.prototype.getOwnDependencyInfo=function(){return this.ownDependencies},e.prototype.getDependencies=function(e){var t=this,r="function"!=typeof e;return Object.keys(this.dependencies).map(function(e){return t.engine.getEntityById(e)}).filter(function(t){return r||e(t)})},e.prototype.getDependenciesByClass=function(e){return this.getDependencies(function(t){return t instanceof e})},e.prototype.getDependenciesByType=function(e){return this.getDependencies(function(t){return t.type===e})},e.prototype.getDependencyInfo=function(){return this.dependencies},e.prototype.registerDependencyById=function(e){this.registerDependency(this.engine.getEntityById(e))},e.prototype.registerDependency=function(e){var t=this;if(!e)return void n.default.warn("Trying to register invalid entity as a dependency.");var r=this.getOwnDependencyInfo(),a=e.id;r[a]?r[a].count++:(r[a]={count:1},r[a].onSubDependencyChange=function(e,i){if(r[a])for(var n=0;n=r.components.length-1)){var i=Math.min(Math.max(t,0),r.components.length-1);i<0||(r.previousComponents=r.components?r.components.slice():[],r.components.splice(i,1),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("remove:component",i)}))}},e.prototype.dispatchComponentAdded=function(e,t){var r=this.entities[e];if(r){r.previousComponents=r.components?r.components.slice():[];var i=a.deepClone(t);i.id=i.id||n.v4(),i.name=i.name||"unnamed component",i.attributes=i.attributes||{},i.enabled=i.enabled!==!1,r.components.push(i),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("add:component",i)})}},e.prototype.fireExternalUpdate=function(e,t,r){var i=new u.default;i.type=r?r:"updateEntity",i.entityId=e,i.entityData=t,o.default.trigger("EntityUpdates",i)},e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(48),n=r(34),a=r(49),o=r(6),s=r(66),u=r(20),p=r(67),c=r(75),l=r(51),d=r(52),h=r(37),f=r(14),m=r(25),y=r(53),g=r(68),v=r(54),b=r(55),P=r(56),x=r(57),E=r(38),w=r(58),_=r(35),S=r(59),D=r(60),A=r(61),T=r(24),M=function(){function e(){this.objects={},this.assets={}}return e.prototype.destroy=function(){var e=this;this.getAssets().forEach(function(t){return e.unregisterEntity(t)}),this.getObjects().forEach(function(t){return e.unregisterEntity(t)})},e.prototype.getAsset=function(e){return this.getEntity(e,this.assets)},e.prototype.getAssets=function(e){return this.getEntities(e,this.assets)},e.prototype.getAssetById=function(e){return this.assets[e]||null},e.prototype.getAssetByName=function(e){return this.getAsset(function(t){return t.getName()===e})},e.prototype.getAssetsByName=function(e){return this.getAssets(function(t){return t.getName()===e})},e.prototype.getAssetByClass=function(e){return this.getAsset(function(t){return t instanceof e})},e.prototype.getAssetByType=function(e){return this.getAsset(function(t){return t.type===e})},e.prototype.getAssetsByClass=function(e){return this.getAssets(function(t){return t instanceof e})},e.prototype.getAssetsByType=function(e){return this.getAssets(function(t){return t.type===e})},e.prototype.getObject=function(e){return this.getEntity(e,this.objects)},e.prototype.getObjects=function(e){return this.getEntities(e,this.objects)},e.prototype.getObjectById=function(e){return this.objects[e]||null},e.prototype.getObjectByName=function(e){return this.getObject(function(t){return t.getName()===e})},e.prototype.getObjectsByName=function(e){return this.getObjects(function(t){return t.getName()===e})},e.prototype.getObjectByClass=function(e){return this.getObject(function(t){return t instanceof e})},e.prototype.getObjectByType=function(e){return this.getObject(function(t){return t.type===e})},e.prototype.getObjectsByType=function(e){return this.getObjects(function(t){return t.type===e})},e.prototype.getObjectsByClass=function(e){return this.getObjects(function(t){return t instanceof e})},e.prototype.getEntity=function(e,t){if(!t)return this.getAsset(e)||this.getObject(e);var r=Object.keys(t).find(function(r){return e(t[r])});return t[r]},e.prototype.getEntities=function(e,t){if(!t)return this.getObjects(e).concat(this.getAssets(e));var r="function"!=typeof e;return Object.keys(t).filter(function(i){return r||e(t[i])}).map(function(e){return t[e]})},e.prototype.getEntityById=function(e){return this.assets[e]||this.objects[e]||null},e.prototype.getEntityByClass=function(e){return this.getEntity(function(t){return t instanceof e})},e.prototype.getEntityByType=function(e){return this.getEntity(function(t){return t.type===e})},e.prototype.getEntitiesByClass=function(e){return this.getEntities(function(t){return t instanceof e})},e.prototype.getEntitiesByType=function(e){return this.getEntities(function(t){return t.type===e})},e.prototype.getEntityByName=function(e){return this.getEntity(function(t){return t.getName()===e})},e.prototype.getEntitiesByName=function(e){return this.getEntities(function(t){return t.getName()===e})},e.prototype.unregisterEntityById=function(e){this.unregisterEntity(this.getEntityById(e))},e.prototype.unregisterEntity=function(e){e&&(e.uninitialize(),this.objects[e.id]?delete this.objects[e.id]:(e.off("load",this.onAssetLoaded,this),e.off("unload",this.onAssetUnloaded,this),delete this.assets[e.id]))},e.prototype.getClassType=function(e){switch(e){case i.default:return"animation";case n.default:return"application";case a.default:return"audio";case s.default:return"bone";case u.default:return"buffer";case p.default:return"camera";case c.default:return"document";case l.default:return"dracoGeometry";case d.default:return"image";case h.default:return"light";case f.default:return"material";case m.default:return"mesh";case y.default:return"meshGeometry";case g.default:return"node";case v.default:return"prefab";case b.default:return"primitiveGeometry";case P.default:return"renderTexture2D";case x.default:return"renderTextureCube";case E.default:return"scene";case w.default:return"script";case _.default:return"shader";case S.default:return"skin";case D.default:return"texture2D";case A.default:return"textureCube";case T.default:return"video";default:return null}},e.prototype.getEntityClass=function(t){return e.entityNameTypeMap[t]?e.entityNameTypeMap[t]:null},e.prototype.registerEntity=function(e){var t=new(this.getEntityClass(e.type))(e);t.engine=this,t instanceof o.default?(this.assets[t.id]=t,t.on("load",this.onAssetLoaded,this),t.on("unload",this.onAssetUnloaded,this)):this.objects[t.id]=t},e.prototype.onAssetLoaded=function(e){this.trigger("assetLoaded",e)},e.prototype.onAssetUnloaded=function(e){this.trigger("assetUnloaded",e)},e.entityNameTypeMap={animation:i.default,application:n.default,audio:a.default,bone:s.default,buffer:u.default,camera:p.default,document:c.default,dracoGeometry:l.default,image:d.default,light:h.default,material:f.default,mesh:m.default,meshGeometry:y.default,node:g.default,prefab:v.default,primitiveGeometry:b.default,renderTexture2D:P.default,renderTextureCube:x.default,scene:E.default,script:w.default,shader:_.default,skin:S.default,texture2D:D.default,textureCube:A.default,video:T.default},e}();t.default=M},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.type="updateEntity",this.entityId="",this.entityData={}}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(213),a=r(238),o=r(237),s={id:"box3d_pbr_shader",type:"shader",properties:{name:"PBR Shader",vertexShader:a,fragmentShader:o,parameters:n.default,uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.lights,{time:{value:1},emissive:{value:new i.Color(0)},specular:{value:new i.Color(1118481)},roughness:{value:0},metalness:{value:0},clearCoat:{value:0},clearCoatRoughness:{value:0},envMapIntensity:{value:1}}])}};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={albedoColor:{displayName:"Base Albedo",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"diffuse"},albedoMap:{displayName:"Albedo Map",description:"A texture that modifies the diffuse color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,uniformName:"map",enabledWhen:{albedoMap:{notEqualsDefault:!0}}},opacity:{displayName:"Opacity",description:"This option controls the total opacity of the material.",type:"f",default:1,min:0,max:1,isUniform:!0,isRenderParam:!0,transparency:"LessThanOne"},alphaMap:{displayName:"Alpha Map",description:"A texture that stores the transparency info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,transparency:"NotFalsy",enabledWhen:{alphaMap:{notEqualsDefault:!0}}},specularColor:{displayName:"Specular Color",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"specular"},specularMap:{displayName:"Specular Map",description:"A texture that contains the specular color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{specularMap:{notEqualsDefault:!0}}},metalness:{displayName:"Metalness",description:"How metallic the surface appears (multiplied by the metalness texture).",type:"f",min:0,max:1,default:0,isUniform:!0,enabledWhen:{metalness:{notEqualsDefault:!0}}},metalnessMap:{displayName:"Metalness Map",description:"A texture that contains the metalness of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{metalnessMap:{notEqualsDefault:!0}}},glossMap:{displayName:"Gloss Map",description:"A texture that stores the gloss info of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{glossMap:{notEqualsDefault:!0},roughnessMap:{equalsDefault:!0}}},roughness:{displayName:"Roughness",description:"How rough the surface appears.",type:"f",min:0,max:1,default:0,isUniform:!0,isRenderParam:!0},roughnessMap:{displayName:"Roughness Map",description:"A texture that stores the roughness info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{roughnessMap:{notEqualsDefault:!0}}},reflectivity:{displayName:"Reflectivity",description:"Reflectivity at normal incidence. i.e. when viewing the surface directly.",type:"f",min:0,max:1,default:.02,isUniform:!0,isRenderParam:!0,uniformName:"reflectivity"},normalMap:{displayName:"Normal Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"normal",enabledWhen:{normalMap:{notEqualsDefault:!0}}},normalScale:{displayName:"Normal Scale",description:"blah",type:"v2",default:{x:1,y:1},isUniform:!0,isRenderParam:!0},bumpMap:{displayName:"Bump Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"bump",enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}}},bumpScale:{displayName:"Bump Scale",description:"blah",type:"f",min:0,max:20,default:1,isUniform:!0,isRenderParam:!0,enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}},displayWhen:{useBump:{equals:!0}}},clearCoat:{displayName:"Clear Coat",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0,enabledWhen:{clearCoat:{notEquals:0}}},clearCoatRoughness:{displayName:"Clear Coat Roughness",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0,enabledWhen:{clearCoat:{notEquals:0}}},envMapRadiance:{displayName:"Radiance Light Map",description:"A map that represents the surrounding environment. Used for reflections.",type:"t",default:null,isUniform:!0,forceUpdate:!0,enabledWhen:{envMapRadiance:{notEqualsDefault:!0}}},envMapRadianceHalfGloss:{displayName:"Half Radiance Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0},envMapRadiance:{notEqualsDefault:!0},envMapRadianceHalfGloss:{notEqualsDefault:!0}}},envMapIrradiance:{displayName:"Irradiance Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0}},displayWhen:{envMapIrradiance:{notEqualsDefault:!0}}},envMapGlossVariance:{displayName:"Environment Map Gloss Variance",description:"Turn on multi-sampling of environment map based on varying glossiness of surface.",type:"b",default:!0,forceUpdate:!0,enabledWhen:{envMapGlossVariance:{equals:!0}}},emissiveColor:{displayName:"Emissive Color",description:"A color that represents the light emitted by the material.",type:"c",default:{r:0,g:0,b:0},isUniform:!0,isRenderParam:!0,uniformName:"emissive",enabledWhen:{emissiveColor:{notEqualsDefault:!0}}},emissiveMap:{displayName:"Emissive Map",description:"A texture that modifies the emissive color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{emissiveMap:{notEqualsDefault:!0}}},aoMap:{displayName:"AO Map",description:"The ambient occlusion of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{aoMap:{notEqualsDefault:!0}}}};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(120),a=r(119),o={id:"fbx_surface_lambert_shader",type:"shader",properties:{name:"FBX Surface Lambert Shader",vertexShader:"MeshLambertMaterial",fragmentShader:"MeshLambertMaterial",parameters:i.__assign({},n.default,a.default)}};t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(120),a=r(119),o={id:"fbx_surface_phong_shader",type:"shader",properties:{name:"FBX Surface Phong Shader",vertexShader:"MeshPhongMaterial",fragmentShader:"MeshPhongMaterial",parameters:i.__assign({},n.default,{specular:{displayName:"Specular Color",description:"The color reflected specularly by the surface from lights",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isRenderParam:!0,uniformName:"specular"},specularTexture:{displayName:"Specular Map",description:"The color reflected specularly by the surface from lights",type:"t",default:null,isRenderParam:!0,uniformName:"specularMap",enabledWhen:{specularTexture:{notEqualsDefault:!0}}},shininess:{displayName:"Shininess",description:"The shininess exponent of the surface. Higher is glossier.",type:"f",default:30,min:0,max:512,isRenderParam:!0,uniformName:"shininess"},reflectionFactor:{displayName:"Reflectivity",description:"A value to scale the reflectivity by.",type:"f",default:1,min:0,max:100,isRenderParam:!0,uniformName:"reflectivity"},reflectionTexture:{displayName:"Reflection Texture",description:"A texture that represents the environment around the surface.",type:"t",default:null,isRenderParam:!0,uniformName:"envMap",enabledWhen:{reflectionTexture:{notEqualsDefault:!0}}}},a.default)}};t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),n=r(19),a=function(){function e(e){this.engine=e,this.standInTextures=[],this.engine=e,this.engine.on("rebuildMaterials",this.rebuildAll,this),this.engine.on("rendererResize",this.onResize,this),this.engine.on("update",this.update,this),this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE]={texture:null,color:[255,255,255]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE_CUBE]={texture:null,color:[255,255,255],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK]={texture:null,color:[0,0,0]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK_CUBE]={texture:null,color:[0,0,0],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_NORMAL]={texture:null,color:[127,127,255]}}return e.prototype.destroy=function(){this.engine.off("rebuildMaterials",this.rebuildAll,this),this.engine.off("rendererResize",this.onResize,this),this.engine.off("update",this.update,this),this.standInTextures.forEach(function(e){e.texture&&e.texture.dispose()})},e.prototype.getMissingMaterial=function(){return this.engine.getAssetById("missingMaterial")},e.prototype.getStandInTexture=function(e){if(!this.standInTextures[e])return null;if(!this.standInTextures[e].texture){var t=this.standInTextures[e].color;"Cube"===this.standInTextures[e].type?this.standInTextures[e].texture=n.default.createColorTextureCube(t[0],t[1],t[2]):this.standInTextures[e].texture=n.default.createColorTexture(t[0],t[1],t[2])}return this.standInTextures[e].texture},e.prototype.update=function(e){i.default.timeValueInUse&&(this.engine.needsRender=!0),i.default.sharedUniforms.time.value=e},e.prototype.rebuildAll=function(){var e=this.engine.getAssetsByClass(i.default);e.forEach(function(e){e.runtimeData&&Object.keys(i.default.materialObjectTypes).forEach(function(t){e.runtimeData[t].needsUpdate=!0})})},e.prototype.onResize=function(){var e=i.default.sharedUniforms.screenDimensions;e.value.x=0,e.value.y=0;var t=this.engine.getRenderer();t?(e.value.z=t.getCanvasWidth(),e.value.w=t.getCanvasHeight()):(e.value.z=128,e.value.w=128)},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(e,t){void 0===t&&(t="tDiffuse"),this.enabled=!0,this.needsSwap=!0,this.renderToScreen=!1,this.clear=!1,this.textureId=t,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.material=new i.ShaderMaterial({blending:i.NormalBlending,transparent:!0,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.camera=new i.OrthographicCamera(-1,1,1,-1,0,1), +this.scene=new i.Scene,this.quad=new i.Mesh(new i.PlaneGeometry(2,2),null),this.scene.add(this.quad),this.prevViewPort=new i.Vector4}return e.prototype.render=function(e,t,r){this.uniforms[this.textureId]&&(this.uniforms[this.textureId].value=r),this.quad.material=this.material,this.renderToScreen?(this.viewPort&&e.setViewport(this.viewPort.x,this.viewPort.y,this.viewPort.width,this.viewPort.height),(this.clearColor||this.clearDepth)&&e.clear(!!this.clearColor,!!this.clearDepth,!1),e.render(this.scene,this.camera)):this.renderToTexture?((this.clearColor||this.clearDepth)&&e.clear(this.clearColor,this.clearDepth,!1),e.render(this.scene,this.camera,this.renderToTexture)):e.render(this.scene,this.camera,t,this.clear)},e.prototype.dispose=function(){this.quad.geometry.dispose(),this.quad=void 0,this.camera=void 0,this.scene=void 0,this.material.dispose(),this.material=void 0,this.uniforms=void 0},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={uniforms:{tDiffuse:{type:"t",value:null},rgbmMultiplier:{type:"f",value:9}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","#ifdef FLIP_Y","vUv.y = 1.0 - vUv.y;","#endif","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float rgbmMultiplier;","const mat3 InverseLogLuvMatrix = mat3(","6.0014, -2.7008, -1.7996,","-1.3320, 3.1029, -5.7721,","0.3008, -1.0882, 5.6268);","vec3 HDRDecodeLOGLUV(in vec4 vLogLuv)","{","float Le = vLogLuv.z * 255.0 + vLogLuv.w;","vec3 Xp_Y_XYZp;","Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);","Xp_Y_XYZp.z = Xp_Y_XYZp.y / vLogLuv.y;","Xp_Y_XYZp.x = vLogLuv.x * Xp_Y_XYZp.z;","vec3 vRGB = InverseLogLuvMatrix * Xp_Y_XYZp;","return vRGB;","}","vec3 HDRDecodeRGBM( vec4 rgbm ) {","return rgbmMultiplier * rgbm.rgb * rgbm.a;","}","vec3 HDRDecodeRGBD( vec4 rgbd ) {","return rgbd.rgb / max(rgbd.a, 0.003);","}","vec3 HDRDecodeRGBE( vec4 rgbe ) {","float f = exp2( rgbe.w * 255.0 - (128.0 + 0.0) );","return rgbe.rgb * f;","}","varying vec2 vUv;","void main() {","vec3 hdrColour;","#ifdef HDR_RGBM","hdrColour = HDRDecodeRGBM( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBD)","hdrColour = HDRDecodeRGBD( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBE)","hdrColour = HDRDecodeRGBE( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_LOGLUV)","hdrColour = HDRDecodeLOGLUV( texture2D( tDiffuse, vUv ) );","#else","hdrColour = texture2D( tDiffuse, vUv ).xyz;","#endif","gl_FragColor = vec4( hdrColour, 1.0 );","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(27),a=r(69),o=r(11),s=r(227),u=r(45);t.loadableResourceMixins=u.default({},[n.default]);var p=function(e){function t(t,r,i){void 0===i&&(i={});var n=e.call(this)||this;if(n.path=t,n.type=r,n.params=i,n.state=a.default.STARTING,n.error=void 0,n.data=void 0,n.loaderData={},!t)throw new Error("Missing required `path` argument");if(!r)throw new Error("Missing required `type` argument");return n}return i.__extends(t,e),t.prototype.setState=function(e){switch(e){case a.default.STARTING:throw new s.default(this.state,e);case a.default.LOADING:if(this.state!==a.default.STARTING&&this.state!==a.default.LOADING)throw new s.default(this.state,e);break;case a.default.PROCESSING:if(this.state!==a.default.LOADING)throw new s.default(this.state,e);break;case a.default.COMPLETE:if(this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.CANCELLED:if(this.state!==a.default.STARTING&&this.state!==a.default.LOADING&&this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.ERROR:break;default:throw new Error("Unknown state: "+e)}return this.state=e,this.trigger(o.default.STATE_CHANGE,e),e},t.prototype.setLoading=function(){this.setState(a.default.LOADING)},t.prototype.setProcessing=function(){this.setState(a.default.PROCESSING)},t.prototype.setComplete=function(e){this.setState(a.default.COMPLETE),this.data=e,this.trigger(o.default.LOAD,e),this.done()},t.prototype.setError=function(e){this.setState(a.default.ERROR),this.error=e,this.trigger(o.default.ERROR,e),this.done()},t.prototype.setCancelled=function(){this.setState(a.default.CANCELLED),this.trigger(o.default.CANCEL),this.done()},t.prototype.isCancelled=function(){return this.state===a.default.CANCELLED},t.prototype.done=function(){this.trigger(o.default.DONE,this.state),this.off()},t}(t.loadableResourceMixins);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(26),n=function(e){return e.setProcessing(),e.setComplete(e.loaderData.xhr.response),Promise.resolve(e)};t.default=function(e,t){return i.retry(function(e){return 202===e.loaderData.xhr.status},[i.unlessCancelled(i.makeXhr(t)),i.unlessCancelled(i.setResponseType("arraybuffer")),i.unlessCancelled(i.setCustomHeaders),i.unlessCancelled(i.loadXhr)])(e).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(240),n=r(191),a=r(26),o=function(e){e.setProcessing();var t="string"==typeof e.loaderData.xhr.response?JSON.parse(e.loaderData.xhr.response):e.loaderData.xhr.response,r=e.path.indexOf("?"),a=r>=0?r:e.path.length,o=e.path.slice(0,e.path.lastIndexOf("/",a)+1);if(void 0===t||void 0===t.version||t.version.major>4)return Promise.reject(new Error("Unsupported data version"));var s=new RegExp(/^(?:[a-z]+:)?\/\//i),u=new RegExp(/^\//),p=function(e){return!e.match(s)&&!e.match(u)},c=i.mapEntities(t.entities,t.version);return c.forEach(function(e){if(n.isAsset(e)&&e.representations&&e.representations.forEach(function(e){e.src&&p(e.src)&&(e.src=o+e.src)}),"buffer"===e.type){var t=e.properties;t.src&&p(t.src)&&(t.src=o+t.src)}}),e.setComplete(c),Promise.resolve(e)};t.default=function(e,t){return a.retry(function(e){return 202===e.loaderData.xhr.status},[a.unlessCancelled(a.makeXhr(t)),a.unlessCancelled(a.setResponseType("json")),a.unlessCancelled(a.setCustomHeaders),a.unlessCancelled(a.loadXhr)])(e).then(a.unlessCancelled(a.requireStatus(function(e){return 200===e}))).then(a.unlessCancelled(o)).catch(a.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(26),n=function(e){return new Promise(function(t){if(e.setProcessing(),e.loaderData.xhr.response instanceof Blob){var r=URL.createObjectURL(e.loaderData.xhr.response),i=new Image;i.onload=function(){e.setComplete(i),t(e)},i.src=r}else e.setComplete(e.loaderData.xhr.response),t(e)})};t.default=function(e,t){return i.retry(function(e){return 202===e.loaderData.xhr.status},[i.unlessCancelled(i.makeXhr(t)),i.unlessCancelled(i.setResponseType("blob")),i.unlessCancelled(i.setCustomHeaders),i.unlessCancelled(i.loadXhr)])(e).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(26),n=function(e){e.setProcessing();var t="string"==typeof e.loaderData.xhr.response?JSON.parse(e.loaderData.xhr.response):e.loaderData.xhr.response;return e.setComplete(t),Promise.resolve(e)};t.default=function(e,t){return i.retry(function(e){return 202===e.loaderData.xhr.status},[i.unlessCancelled(i.makeXhr(t)),i.unlessCancelled(i.setResponseType("json")),i.unlessCancelled(i.setCustomHeaders),i.unlessCancelled(i.loadXhr)])(e).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(26),n=function(e){return new Promise(function(t,r){e.setProcessing();var i=URL.createObjectURL(e.loaderData.xhr.response),n=document.createElement("video");n.addEventListener("loadeddata",function(){e.setComplete(n),t(e)}),n.addEventListener("error",function(){return r(new Error("Failed to load video"))}),n.src=i,n.load()})};t.default=function(e,t){return i.retry(function(e){return 202===e.loaderData.xhr.status},[i.unlessCancelled(i.makeXhr(t)),i.unlessCancelled(i.setResponseType("blob")),i.unlessCancelled(i.setCustomHeaders),i.unlessCancelled(i.loadXhr)])(e).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),n=r(11),a=r(9),o=function(){function e(){this.loadingResources=[]}return e.prototype.loadResource=function(e,t,r,o){var s=this;void 0===o&&(o={});var u=this.engine.resourceLoader.load(e,t,o);return this.loadingResources.push(u),u.on(n.default.ERROR,function(e){i.default.error(s.engine.getName()+(" - ResourceLifecycle: Error loading "+s.type+",")+(s.getName()+", "+e.toString())),s.setState(a.StateType.Base,a.State.Failed)}),u.on(n.default.DONE,function(){s.loadingResources=s.loadingResources.filter(function(e){return e!==u}),"function"==typeof r&&r()}),u},e.prototype.abortRequests=function(){this.loadingResources.forEach(function(e){return e.setCancelled()})},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(69),a=function(e){function t(t,r){var i=e.call(this,'Illegal state transition "'+n.default[t]+'" -> "'+n.default[r]+'"')||this;return i.from=t,i.to=r,i}return i.__extends(t,e),t}(Error);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(220),n=r(230),a=r(221),o=r(223),s=r(224),u=r(225),p=r(222),c=r(11),l=r(15),d=4,h=function(e,t){var r=new XMLHttpRequest;return r.open("GET",e),Promise.resolve(r)},f=[];f[l.default.BUFFER]=a.default,f[l.default.IMAGE]=o.default,f[l.default.VIDEO]=u.default,f[l.default.ENTITIES]=p.default,f[l.default.JSON]=s.default;var m=function(){function e(e,t){if(void 0===e&&(e=h),void 0===t&&(t=f),this.xhrPromise=e,this.strategies=t,this.resources={},!e)throw new Error("Must provide argument `xhrPromise`!");if(!t)throw new Error("Must provide argument `strategies`!");this.queue=n.default(d)}return e.prototype.destroy=function(){this.queue.destroy()},e.prototype.load=function(e,t,r){var n=this;if(!this.strategies[t])throw new Error("Unsupported type: "+t);if(this.resources[e])return this.resources[e];var a=this.resources[e]=new i.default(e,t,r);return this.queue.add(function(){return new Promise(function(r){var i=function(){delete n.resources[e],a.off(c.default.LOAD,i),a.off(c.default.ERROR,i),a.off(c.default.CANCEL,i),r(a)};a.once(c.default.LOAD,i),a.once(c.default.ERROR,i),a.once(c.default.CANCEL,i),n.strategies[t](a,n.xhrPromise)})},r.priority),a},e}();t.default=m},function(e,t,r){"use strict";function i(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z])([a-z])/,"$1_$2$3").toUpperCase()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="string"==typeof e?e:"";return t=t.replace(/_([a-z])/gi,function(e,t){return"_"+t.toUpperCase()}),t=t.replace(/\s+/g,"_"),t=t.replace(/([a-z])([0-9])/g,"$1_$2"),t=i(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=4,n=5,a=function(e,t){void 0===e&&(e=i),void 0===t&&(t=n);var r=[],a=[],o=!0,s=function(){for(var t=function(){var e=r.pop();a.push(e),e.fn().then(function(){var t=a.indexOf(e);t>=0&&(a.splice(t,1),s())})};r.length>0&&a.length=1&&r<=12&&i>=1&&i<=m[r]}function a(e,t){var r=e.match(y);if(!r)return!1;var i=r[1],n=r[2],a=r[3],o=r[5];return i<=23&&n<=59&&a<=59&&(!t||o)}function o(e){var t=e.split(E);return 2==t.length&&n(t[0])&&a(t[1],!0)}function s(e){return e.length<=255&&g.test(e)}function u(e){return w.test(e)&&v.test(e)}function p(e){try{return new RegExp(e),!0}catch(e){return!1}}function c(e,t){if(e&&t)return e>t?1:et?1:e=0?{index:i,compiling:!0}:(i=this._compilations.length,this._compilations[i]={schema:e,root:t,baseId:r},{index:i,compiling:!1})}function o(e,t,r){var i=s.call(this,e,t,r);i>=0&&this._compilations.splice(i,1)}function s(e,t,r){for(var i=0;i=55296&&t<=56319&&n=t)throw new Error("Cannot access property/index "+i+" levels up, current level is "+t);return r[t-i]}if(i>t)throw new Error("Cannot access data "+i+" levels up, current level is "+t);if(a="data"+(t-i||""),!n)return a}for(var s=a,p=n.split("/"),c=0;c",_="result"+n,S=e.opts.v5&&o&&o.$data;if(S?(i+=" var schema"+n+" = "+e.util.getData(o.$data,a,e.dataPathArr)+"; ",v="schema"+n):v=o,E){var D=e.util.getData(x.$data,a,e.dataPathArr),A="exclusive"+n,T="op"+n,M="' + "+T+" + '";i+=" var schemaExcl"+n+" = "+D+"; ",D="schemaExcl"+n,i+=" if (typeof "+D+" != 'boolean' && "+D+" !== undefined) { "+l+" = false; ";var r=P,R=R||[];R.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"_formatExclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+P+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var C=i;i=R.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+C+"]); ":" validate.errors = ["+C+"]; return false; ":" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",p&&(f+="}",i+=" else { "),S&&(i+=" if ("+v+" === undefined) "+l+" = true; else if (typeof "+v+" != 'string') "+l+" = false; else { ",f+="}"),h&&(i+=" if (!"+g+") "+l+" = true; else { ",f+="}"),i+=" var "+_+" = "+g+"("+c+", ",i+=S?""+v:""+e.util.toQuotedString(o),i+=" ); if ("+_+" === undefined) "+l+" = false; var "+A+" = "+D+" === true; if ("+l+" === undefined) { "+l+" = "+A+" ? "+_+" "+w+" 0 : "+_+" "+w+"= 0; } if (!"+l+") var op"+n+" = "+A+" ? '"+w+"' : '"+w+"=';"}else{var A=x===!0,M=w;A||(M+="=");var T="'"+M+"'";S&&(i+=" if ("+v+" === undefined) "+l+" = true; else if (typeof "+v+" != 'string') "+l+" = false; else { ",f+="}"),h&&(i+=" if (!"+g+") "+l+" = true; else { ",f+="}"),i+=" var "+_+" = "+g+"("+c+", ",i+=S?""+v:""+e.util.toQuotedString(o),i+=" ); if ("+_+" === undefined) "+l+" = false; if ("+l+" === undefined) "+l+" = "+_+" "+w,A||(i+="="),i+=" 0;"}i+=""+f+"if (!"+l+") { ";var r=t,R=R||[];R.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"_formatLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+T+", limit: ",i+=S?""+v:""+e.util.toQuotedString(o),i+=" , exclusive: "+A+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+M+' "',i+=S?"' + "+v+" + '":""+e.util.escapeQuotes(o),i+="\"' "),e.opts.verbose&&(i+=" , schema: ",i+=S?"validate.schema"+s:""+e.util.toQuotedString(o),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var C=i;return i=R.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+C+"]); ":" validate.errors = ["+C+"]; return false; ":" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="}"}},{}],14:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var h="maximum"==t,f=h?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[f],y=e.opts.v5&&m&&m.$data,g=h?"<":">",v=h?">":"<";if(y){var b=e.util.getData(m.$data,o,e.dataPathArr),P="exclusive"+a,x="op"+a,E="' + "+x+" + '";n+=" var schemaExcl"+a+" = "+b+"; ",b="schemaExcl"+a,n+=" var exclusive"+a+"; if (typeof "+b+" != 'boolean' && typeof "+b+" != 'undefined') { ";var r=f,w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var _=n;n=w.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+_+"]); ":" validate.errors = ["+_+"]; return false; ":" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if( ",d&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" ((exclusive"+a+" = "+b+" === true) ? "+l+" "+v+"= "+i+" : "+l+" "+v+" "+i+") || "+l+" !== "+l+") { var op"+a+" = exclusive"+a+" ? '"+g+"' : '"+g+"=';"}else{var P=m===!0,E=g;P||(E+="=");var x="'"+E+"'";n+=" if ( ",d&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+l+" "+v,P&&(n+="="),n+=" "+i+" || "+l+" !== "+l+") {"}var r=t,w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { comparison: "+x+", limit: "+i+", exclusive: "+P+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+E+" ",n+=d?"' + "+i:""+s+"'"),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var _=n;return n=w.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+_+"]); ":" validate.errors = ["+_+"]; return false; ":" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c&&(n+=" else { "),n}},{}],15:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var h="maxItems"==t?">":"<";n+="if ( ",d&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+l+".length "+h+" "+i+") { "; +var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",n+="maxItems"==t?"more":"less",n+=" than ",n+=d?"' + "+i+" + '":""+s,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],16:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var h="maxLength"==t?">":"<";n+="if ( ",d&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=e.opts.unicode===!1?" "+l+".length ":" ucs2length("+l+") ",n+=" "+h+" "+i+") { ";var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",n+="maxLength"==t?"longer":"shorter",n+=" than ",n+=d?"' + "+i+" + '":""+s,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],17:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var h="maxProperties"==t?">":"<";n+="if ( ",d&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" Object.keys("+l+").length "+h+" "+i+") { ";var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",n+="maxProperties"==t?"more":"less",n+=" than ",n+=d?"' + "+i+" + '":""+s,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],18:[function(e,t,r){"use strict";t.exports=function(e,t){var r=" ",i=e.schema[t],n=e.schemaPath+e.util.getProperty(t),a=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,s=e.util.copy(e),u="";s.level++;var p="valid"+s.level,c=s.baseId,l=!0,d=i;if(d)for(var h,f=-1,m=d.length-1;f "+D+") { ";var T=c+"["+D+"]";h.schema=S,h.schemaPath=s+"["+D+"]",h.errSchemaPath=u+"/"+D,h.errorPath=e.util.getPathExpr(e.errorPath,D,e.opts.jsonPointers,!0),h.dataPathArr[g]=D;var M=e.validate(h);h.baseId=b,i+=e.util.varOccurences(M,v)<2?" "+e.util.varReplace(M,v,T)+" ":" var "+v+" = "+T+"; "+M+" ",i+=" } ",p&&(i+=" if ("+m+") { ",f+="}")}if("object"==typeof P&&e.util.schemaHasRules(P,e.RULES.all)){h.schema=P,h.schemaPath=e.schemaPath+".additionalItems",h.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+m+" = true; if ("+c+".length > "+o.length+") { for (var "+y+" = "+o.length+"; "+y+" < "+c+".length; "+y+"++) { ",h.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var T=c+"["+y+"]";h.dataPathArr[g]=y;var M=e.validate(h);h.baseId=b,i+=e.util.varOccurences(M,v)<2?" "+e.util.varReplace(M,v,T)+" ":" var "+v+" = "+T+"; "+M+" ",p&&(i+=" if (!"+m+") break; "),i+=" } } ",p&&(i+=" if ("+m+") { ",f+="}")}}else if(e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=s,h.errSchemaPath=u,i+=" for (var "+y+" = 0; "+y+" < "+c+".length; "+y+"++) { ",h.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var T=c+"["+y+"]";h.dataPathArr[g]=y;var M=e.validate(h);h.baseId=b,i+=e.util.varOccurences(M,v)<2?" "+e.util.varReplace(M,v,T)+" ":" var "+v+" = "+T+"; "+M+" ",p&&(i+=" if (!"+m+") break; "),i+=" } ",p&&(i+=" if ("+m+") { ",f+="}")}return p&&(i+=" "+f+" if ("+d+" == errors) {"),i=e.util.cleanUpCode(i)}},{}],26:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s,n+="var division"+a+";if (",d&&(n+=" "+i+" !== undefined && ( typeof "+i+" != 'number' || "),n+=" (division"+a+" = "+l+" / "+i+", ",n+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",d&&(n+=" ) "),n+=" ) { ";var h=h||[];h.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"multipleOf")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { multipleOf: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",n+=d?"' + "+i:""+s+"'"),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var f=n;return n=h.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],27:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i=" ",n=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,c="data"+(a||""),l="errs__"+n,d=e.util.copy(e);d.level++;var h="valid"+d.level;if(e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" var "+l+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),i+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=f,i+=" if ("+h+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var g=i;i=y.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(r||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(i+=" if (false) { ");return i}},{}],28:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i=" ",n=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,c="data"+(a||""),l="valid"+n,d="errs__"+n,h=e.util.copy(e),f="";h.level++;var m="valid"+h.level;i+="var "+d+" = errors;var prevValid"+n+" = false;var "+l+" = false;";var y=h.baseId,g=e.compositeRule;e.compositeRule=h.compositeRule=!0;var v=o;if(v)for(var b,P=-1,x=v.length-1;P5)i+=" || validate.schema"+s+"["+y+"] ";else{var j=b;if(j)for(var k,L=-1,B=j.length-1;L= "+me+"; ",u=e.errSchemaPath+"/patternGroups/minimum",i+=" if (!"+l+") { ";var X=X||[];X.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { reason: '"+ve+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(G)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have "+be+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(G)+"\"' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var Q=i;i=X.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+Q+"]); ":" validate.errors = ["+Q+"]; return false; ":" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",void 0!==ye&&(i+=" else ")}if(void 0!==ye){var ge=ye,ve="maximum",be="more";i+=" "+l+" = pgPropCount"+n+" <= "+ye+"; ",u=e.errSchemaPath+"/patternGroups/maximum",i+=" if (!"+l+") { ";var X=X||[];X.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { reason: '"+ve+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(G)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have "+be+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(G)+"\"' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var Q=i;i=X.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+Q+"]); ":" validate.errors = ["+Q+"]; return false; ":" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}u=W,p&&(i+=" if ("+l+") { ",f+="}")}}}}return p&&(i+=" "+f+" if ("+d+" == errors) {"),i=e.util.cleanUpCode(i)}},{}],32:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,a=" ",o=e.level,s=e.dataLevel,u=e.schema[t],p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(s||""),d="valid"+o;if("#"==u||"#/"==u)e.isRoot?(i=e.async,n="validate"):(i=e.root.schema.$async===!0,n="root.refVal[0]");else{var h=e.resolveRef(e.baseId,u,e.isRoot);if(void 0===h){var f="can't resolve reference "+u+" from id "+e.baseId;if("fail"==e.opts.missingRefs){console.log(f);var m=m||[];m.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(r||"$ref")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { ref: '"+e.util.escapeQuotes(u)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(u)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(u)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),a+=" } "):a+=" {} ";var y=a;a=m.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs){var g=new Error(f);throw g.missingRef=e.resolve.url(e.baseId,u),g.missingSchema=e.resolve.normalizeId(e.resolve.fullPath(g.missingRef)),g}console.log(f),c&&(a+=" if (true) { ")}}else if(h.inline){var v=e.util.copy(e);v.level++;var b="valid"+v.level;v.schema=h.schema,v.schemaPath="",v.errSchemaPath=u;var P=e.validate(v).replace(/validate\.schema/g,h.code);a+=" "+P+" ",c&&(a+=" if ("+b+") { ")}else i=h.$async===!0,n=h.code}if(n){var m=m||[];m.push(a),a="",a+=e.opts.passContext?" "+n+".call(this, ":" "+n+"( ",a+=" "+l+", (dataPath || '')",'""'!=e.errorPath&&(a+=" + "+e.errorPath);var x=s?"data"+(s-1||""):"parentData",E=s?e.dataPathArr[s]:"parentDataProperty";a+=" , "+x+" , "+E+", rootData) ";var w=a;if(a=m.pop(),i){if(!e.async)throw new Error("async schema referenced by sync schema");a+=" try { ",c&&(a+="var "+d+" ="),a+=" "+e.yieldAwait+" "+w+"; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ",c&&(a+=" if ("+d+") { ")}else a+=" if (!"+w+") { if (vErrors === null) vErrors = "+n+".errors; else vErrors = vErrors.concat("+n+".errors); errors = vErrors.length; } ",c&&(a+=" else { ")}return a}},{}],33:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),d="valid"+a,h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var f="schema"+a;if(!h)if(s.length=e.opts.loopRequired;if(c)if(n+=" var missing"+a+"; ",E){h||(n+=" var "+f+" = validate.schema"+u+"; ");var w="i"+a,_="schema"+a+"["+w+"]",S="' + "+_+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,_,e.opts.jsonPointers)),n+=" var "+d+" = true; ",h&&(n+=" if (schema"+a+" === undefined) "+d+" = true; else if (!Array.isArray(schema"+a+")) "+d+" = false; else {"),n+=" for (var "+w+" = 0; "+w+" < "+f+".length; "+w+"++) { "+d+" = "+l+"["+f+"["+w+"]] !== undefined; if (!"+d+") break; } ",h&&(n+=" } "),n+=" if (!"+d+") { ";var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"required")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(n+=" , message: '",n+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var A=n;n=D.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var T=m;if(T)for(var M,w=-1,R=T.length-1;w 1) { var i = "+l+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+l+"[i], "+l+"[j])) { "+d+" = false; break outer; } } } } ",h&&(n+=" } "),n+=" if (!"+d+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"uniqueItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c&&(n+=" else { ")}else c&&(n+=" if (true) { ");return n}},{}],36:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){for(var t=0;t1&&(i=r[0]+"@",e=r[1]),e=e.replace(I,".");var n=e.split("."),a=o(n,t).join(".");return i+a}function u(e){for(var t,r,i=[],n=0,a=e.length;n=55296&&t<=56319&&n65535&&(e-=65536,t+=B(e>>>10&1023|55296),e=56320|1023&e),t+=B(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:w}function l(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,r){var i=0;for(e=r?L(e/A):e>>1,e+=L(e/t);e>k*S>>1;i+=w)e=L(e/k);return L(i+(k+1)*e/(e+D))}function h(e){var t,r,i,n,o,s,u,l,h,f,m=[],y=e.length,g=0,v=M,b=T;for(r=e.lastIndexOf(R),r<0&&(r=0),i=0;i=128&&a("not-basic"),m.push(e.charCodeAt(i));for(n=r>0?r+1:0;n=y&&a("invalid-input"),l=c(e.charCodeAt(n++)),(l>=w||l>L((E-g)/s))&&a("overflow"),g+=l*s,h=u<=b?_:u>=b+S?S:u-b,!(lL(E/f)&&a("overflow"),s*=f;t=m.length+1,b=d(g-o,t,0==o),L(g/t)>E-v&&a("overflow"),v+=L(g/t),g%=t,m.splice(g++,0,v)}return p(m)}function f(e){var t,r,i,n,o,s,p,c,h,f,m,y,g,v,b,P=[];for(e=u(e),y=e.length,t=M,r=0,o=T,s=0;s=t&&mL((E-r)/g)&&a("overflow"),r+=(p-t)*g,t=p,s=0;sE&&a("overflow"),m==t){for(c=r,h=w;f=h<=o?_:h>=o+S?S:h-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=w-_,L=Math.floor,B=String.fromCharCode;if(P={version:"1.4.1",ucs2:{decode:u,encode:p},decode:h,encode:f,toASCII:y,toUnicode:m},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e("punycode",function(){return P});else if(g&&v)if(i.exports==g)v.exports=P;else for(x in P)P.hasOwnProperty(x)&&(g[x]=P[x]);else r.punycode=P})(this)}).call(this,"undefined"!=typeof t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],42:[function(e,t,r){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,a){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var p=e.length;u>0&&p>u&&(p=u);for(var c=0;c=0?(l=m.substr(0,y),d=m.substr(y+1)):(l=m,d=""),h=decodeURIComponent(l),f=decodeURIComponent(d),i(o,h)?n(o[h])?o[h].push(f):o[h]=[o[h],f]:o[h]=f}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],43:[function(e,t,r){"use strict";function i(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(h),m=["'"].concat(f),y=["%","/","?",";","#"].concat(m),g=["/","?","#"],v=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,P=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=e("querystring");i.prototype.parse=function(e,t,r){if(!p.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=i!==-1&&i127?"x":j[L];if(!k.match(b)){var N=O.slice(0,A),V=O.slice(A+1),U=j.match(P);U&&(N.push(U[1]),V.unshift(U[2])),V.length&&(s="/"+V.join(".")+s),this.hostname=N.join(".");break}}}this.hostname.length>v?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=u.toASCII(this.hostname));var z=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+z,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!x[f])for(var A=0,I=m.length;A0)&&r.host.split("@");S&&(r.auth=S.shift(),r.host=r.hostname=S.shift())}return r.search=e.search,r.query=e.query,p.isNull(r.pathname)&&p.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var D=x.slice(-1)[0],A=(r.host||e.host||x.length>1)&&("."===D||".."===D)||""===D,T=0,M=x.length;M>=0;M--)D=x[M],"."===D?x.splice(M,1):".."===D?(x.splice(M,1),T++):T&&(x.splice(M,1),T--);if(!b&&!P)for(;T--;T)x.unshift("..");!b||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),A&&"/"!==x.join("/").substr(-1)&&x.push("");var R=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(_){r.hostname=r.host=R?"":x.length?x.shift():"";var S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");S&&(r.auth=S.shift(),r.host=r.hostname=S.shift())}return b=b||r.host&&x.length,b&&!R&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),p.isNull(r.pathname)&&p.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=l.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":46,punycode:41,querystring:44}],46:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],47:[function(e,t,r){function i(e){var t=this,r=d.call(arguments,1);return new Promise(function(i,a){function o(t){var r;try{r=e.next(t)}catch(e){return a(e)}p(r)}function s(t){var r;try{r=e.throw(t)}catch(e){return a(e)}p(r)}function p(e){if(e.done)return i(e.value);var r=n.call(t,e.value);return r&&u(r)?r.then(o,s):s(new TypeError('You may only yield a function, promise, generator, array, or object, but the following object was passed: "'+String(e.value)+'"'))}return"function"==typeof e&&(e=e.apply(t,r)),e&&"function"==typeof e.next?void o():i(e)})}function n(e){return e?u(e)?e:c(e)||p(e)?i.call(this,e):"function"==typeof e?a.call(this,e):Array.isArray(e)?o.call(this,e):l(e)?s.call(this,e):e:e}function a(e){var t=this;return new Promise(function(r,i){e.call(t,function(e,t){return e?i(e):(arguments.length>2&&(t=d.call(arguments,1)),void r(t))})})}function o(e){return Promise.all(e.map(n,this))}function s(e){function t(e,t){r[t]=void 0,a.push(e.then(function(e){r[t]=e}))}for(var r=new e.constructor,i=Object.keys(e),a=[],o=0;o="0"&&n<="9";)t+=n,p();if("."===n)for(t+=".";p()&&n>="0"&&n<="9";)t+=n;if("e"===n||"E"===n)for(t+=n,p(),"-"!==n&&"+"!==n||(t+=n,p());n>="0"&&n<="9";)t+=n,p();return e=+t,isFinite(e)?e:void u("Bad number")},l=function(){var e,t,r,i="";if('"'===n)for(;p();){if('"'===n)return p(),i;if("\\"===n)if(p(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(p(),16),isFinite(e));t+=1)r=16*r+e;i+=String.fromCharCode(r)}else{if("string"!=typeof s[n])break;i+=s[n]}else i+=n}u("Bad string")},d=function(){for(;n&&n<=" ";)p()},h=function(){switch(n){case"t":return p("t"),p("r"),p("u"),p("e"),!0;case"f":return p("f"),p("a"),p("l"),p("s"),p("e"),!1;case"n":return p("n"),p("u"),p("l"),p("l"),null}u("Unexpected '"+n+"'")},f=function(){var e=[];if("["===n){if(p("["),d(),"]"===n)return p("]"),e;for(;n;){if(e.push(o()),d(),"]"===n)return p("]"),e;p(","),d()}}u("Bad array")},m=function(){var e,t={};if("{"===n){if(p("{"),d(),"}"===n)return p("}"),t;for(;n;){if(e=l(),d(),p(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=o(),d(),"}"===n)return p("}"),t;p(","),d()}}u("Bad object")};o=function(){switch(d(),n){case"{":return m();case"[":return f();case'"':return l();case"-":return c();default:return n>="0"&&n<="9"?c():h()}},t.exports=function(e,t){var r;return a=e,i=0,n=" ",r=o(),d(),n&&u("Syntax error"),"function"==typeof t?function e(r,i){var n,a,o=r[i];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(a=e(o,n),void 0!==a?o[n]=a:delete o[n]);return t.call(r,i,o)}({"":r},""):r}},{}],51:[function(e,t,r){function i(e){return u.lastIndex=0,u.test(e)?'"'+e.replace(u,function(e){var t=p[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function n(e,t){var r,u,p,c,l,d=a,h=t[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),"function"==typeof s&&(h=s.call(t,e,h)),typeof h){case"string":return i(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(a+=o,l=[],"[object Array]"===Object.prototype.toString.apply(h)){for(c=h.length,r=0;rt.major?e:t.major>e.major?t:e.minor>t.minor?e:t}function n(e){var t=[];if(e.major<=1){var r=i(e,{major:1,minor:0});t.push(function(e){return h.mapToV2Entity(e,r)})}if(e.major<=2){var n=i(e,{major:2,minor:0});t.push(function(e){return f.mapToV3Entity(e,n)})}if(e.major<=3){var a=i(e,{major:3,minor:0});t.push(function(e){return m.mapToV4Entity(e,a)})}if(e.major<=4){var o=i(e,{major:4,minor:0});t.push(function(e){return y.mapToV5Entity(e,o)})}return t}function a(e,t){var r=n(t);r.forEach(function(t){e=b(e,t)});var i=v(e,"id");return b(e,function(e){return({material:o,prefab:l}[e.type]||g)(e,i)})}function o(e,t){var r=e.properties;return r.shadingModel&&("phong"===r.shadingModel?r.shaderId="fbx_surface_phong_shader":r.shaderId="fbx_surface_lambert_shader",delete r.shadingModel),s(r,"diffuse"),u(r,"ambient"),u(r,"emissive"),s(r,"specular"),p(r),c(r.normalMapTexture,"linear",t),c(r.bumpTexture,"linear",t),c(r.displacementTexture,"linear",t),c(r.transparencyFactorTexture,"linear",t),r.normalScale&&void 0===r.normalScale.x&&(r.normalScale={x:r.normalScale,y:r.normalScale}),e}function s(e,t){var r=t+"Factor",i=t+"Texture",n=t+"FactorTexture";e[t]&&(e[i]?e[t]={r:e[r],g:e[r],b:e[r]}:e[n]?e[i]=e[n]:(e[t].r*=e[r],e[t].g*=e[r],e[t].b*=e[r]),delete e[r],delete e[n])}function u(e,t){var r=t+"Texture",i=t+"FactorTexture";e[i]&&(e[r]=e[i],delete e[i])}function p(e){var t=0;(e.transparencyFactor||e.transparencyFactorTexture)&&e.transparentColor&&e.transparentColor.r?e.transparencyFactorTexture||e.transparentColorTexture?e.transparencyFactor=0:(t=(e.transparentColor.r+e.transparentColor.g+e.transparentColor.b)/3,e.transparencyFactor*=t):e.transparencyFactor=0,e.transparencyFactor=Math.max(Math.min(1-e.transparencyFactor,1),0),delete e.transparentColor,delete e.transparentColorTexture}function c(e,t,r){var i=r[e];if(i){var n=r[i.properties.imageId];n&&(n.properties.encoding=t)}}function l(e){var t=d.v4(),r={type:"node",id:t,parentAssetId:e.id,sid:t,children:e.children,properties:{name:(e.properties.name||"Prefab")+"_root"}};return delete e.children,e.properties.rootObjectId=t,[e,r]}var d=r(18),h=r(241),f=r(242),m=r(243),y=r(244),g=r(13).identity,v=r(13).indexBy,b=r(13).flatMap;e.exports={mapEntities:a}},function(e,t,r){"use strict";function i(e){return e.payload&&(e.properties=e.payload,delete e.payload),e}function n(e){return e=i(e),({material:a}[e.type]||o)(e)}function a(e){return e.properties&&e.properties.properties&&(s(e.properties.properties,function(t,r){e.properties[r]=t}),delete e.properties.properties),e}var o=r(13).identity,s=r(13).each;e.exports={mapToV2Entity:n}},function(e,t,r){"use strict";function i(e){var t=e.split(new RegExp(/\\|\//));return 0===t.length?e:t[t.length-1]}function n(e){return e.name&&(e.sid=e.name,e.properties||(e.properties={}),e.properties.name=e.name,delete e.name),e}function a(e){return e=n(e),({texture2D:o}[e.type]||u)(e)}function o(e){var t=i(e.properties.filename),r={type:"document",id:s.v4(),sid:t,properties:{name:t,filename:e.properties.filename}};return e.properties.imageId=r.id+"#"+t,delete e.properties.filename,[e,r]}var s=r(18),u=r(13).identity;e.exports={mapToV3Entity:a}},function(e,t,r){"use strict";function i(e){return({meshGeometry:n}[e.type]||o)(e)}function n(e){var t={type:"buffer",id:a.v4(),sid:e.sid+"-buffer",properties:{name:e.sid+"-buffer",src:"geometry.bin",accessors:{}}};return s(e.properties.attributes,function(e,r){t.properties.accessors[r]={type:e.type,componentType:e.componentType,byteOffset:e.byteOffset,byteStride:0,count:e.count},e.accessorId=t.id+"#"+r,delete e.type,delete e.componentType,delete e.byteOffset,delete e.byteStride,delete e.count}),t.properties.accessors.indices={type:e.properties.indices.type,componentType:e.properties.indices.componentType,byteOffset:e.properties.indices.byteOffset,byteStride:0,count:e.properties.indices.count},e.properties.indices=t.id+"#indices",[e,t]}var a=r(18),o=r(13).identity,s=r(13).each;e.exports={mapToV4Entity:i}},function(e,t,r){"use strict";function i(e,t){return({image:n}[e.type]||a)(e,t)}function n(e,t){return t.minor<3&&e.hasOwnProperty("representations")&&(e.representations=e.representations.filter(function(e){return e.width<=4096&&e.height<=4096})),e}var a=r(13).identity;e.exports={mapToV5Entity:i}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){var i=r(196)("unscopables"),n=Array.prototype;void 0==n[i]&&r(73)(n,i,{}),e.exports=function(e){n[i][e]=!0}},function(e,t,r){var i=r(47);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){var i=r(193),n=r(255),a=r(263),o=r(262),s=r(250);e.exports=function(e,t){var r=1==e,u=2==e,p=3==e,c=4==e,l=6==e,d=5==e||l,h=t||s;return function(t,s,f){for(var m,y,g=a(t),v=n(g),b=i(s,f,3),P=o(v.length),x=0,E=r?h(t,P):u?h(t,0):void 0;P>x;x++)if((d||x in v)&&(m=v[x],y=b(m,x,g),e))if(r)E[x]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:E.push(m)}else if(c)return!1;return l?-1:p||c?c:E}}},function(e,t,r){var i=r(47),n=r(256),a=r(196)("species");e.exports=function(e){var t;return n(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!n(t.prototype)||(t=void 0),i(t)&&(t=t[a],null===t&&(t=void 0))),void 0===t?Array:t}},function(e,t,r){var i=r(249);e.exports=function(e,t){return new(i(e))(t)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){var i=r(47),n=r(33).document,a=i(n)&&i(n.createElement);e.exports=function(e){return a?n.createElement(e):{}}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){e.exports=!r(71)&&!r(194)(function(){return 7!=Object.defineProperty(r(252)("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){var i=r(192);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,r){var i=r(192);e.exports=Array.isArray||function(e){return"Array"==i(e)}},function(e,t,r){ +var i=r(247),n=r(254),a=r(264),o=Object.defineProperty;t.f=r(71)?Object.defineProperty:function(e,t,r){if(i(e),t=a(t,!0),i(r),n)try{return o(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){var i=r(33),n=r(73),a=r(253),o=r(195)("src"),s="toString",u=Function[s],p=(""+u).split(s);r(32).inspectSource=function(e){return u.call(e)},(e.exports=function(e,t,r,s){var u="function"==typeof r;u&&(a(r,"name")||n(r,"name",t)),e[t]!==r&&(u&&(a(r,o)||n(r,o,e[t]?""+e[t]:p.join(String(t)))),e===i?e[t]=r:s?e[t]?e[t]=r:n(e,t,r):(delete e[t],n(e,t,r)))})(Function.prototype,s,function(){return"function"==typeof this&&this[o]||u.call(this)})},function(e,t,r){var i=r(33),n="__core-js_shared__",a=i[n]||(i[n]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t){var r=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},function(e,t,r){var i=r(261),n=Math.min;e.exports=function(e){return e>0?n(i(e),9007199254740991):0}},function(e,t,r){var i=r(251);e.exports=function(e){return Object(i(e))}},function(e,t,r){var i=r(47);e.exports=function(e,t){if(!i(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!i(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!i(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!i(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")}},function(e,t,r){"use strict";var i=r(72),n=r(248)(5),a="find",o=!0;a in[]&&Array(1)[a](function(){o=!1}),i(i.P+i.F*o,"Array",{find:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}}),r(246)(a)},function(e,t,r){var i=r(72);i(i.S,"Math",{log10:function(e){return Math.log(e)/Math.LN10}})},function(e,t,r){var i=r(72);i(i.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,r){var i,n;(function(a,o){"use strict";i=o,n="function"==typeof i?i.call(t,r,t,e):i,!(void 0!==n&&(e.exports=n))})(this,function(){"use strict";function e(e){return typeof console!==s&&(void 0!==console[e]?t(console,e):void 0!==console.log?t(console,"log"):o)}function t(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function r(e,t,r){return function(){typeof console!==s&&(i.call(this,t,r),this[e].apply(this,arguments))}}function i(e,t){for(var r=0;r=0&&t<=c.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(p=t,r!==!1&&a(t),i.call(c,t,e),typeof console===s&&to+1e3&&(u.update(1e3*s/(e-o),100),o=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:n,setMode:r}};return e.Panel=function(e,t,r){var i=1/0,n=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,u=48*o,p=3*o,c=2*o,l=3*o,d=15*o,h=74*o,f=30*o,m=document.createElement("canvas");m.width=s,m.height=u,m.style.cssText="width:80px;height:48px";var y=m.getContext("2d");return y.font="bold "+9*o+"px Helvetica,Arial,sans-serif",y.textBaseline="top",y.fillStyle=r,y.fillRect(0,0,s,u),y.fillStyle=t,y.fillText(e,p,c),y.fillRect(l,d,h,f),y.fillStyle=r,y.globalAlpha=.9,y.fillRect(l,d,h,f),{dom:m,update:function(u,g){i=Math.min(i,u),n=Math.max(n,u),y.fillStyle=r,y.globalAlpha=1,y.fillRect(0,0,s,d),y.fillStyle=t,y.fillText(a(u)+" "+e+" ("+a(i)+"-"+a(n)+")",p,c),y.drawImage(m,l+o,d,h-o,f,l,d,h-o,f),y.fillRect(l+h-o,d,o,f),y.fillStyle=r,y.globalAlpha=.9,y.fillRect(l+h-o,d,o,a((1-u/g)*f))}}},e})},function(e,t,r){function i(e,t,r){var i=t&&r||0,n=t||[];e=e||{};var o=void 0!==e.clockseq?e.clockseq:u,l=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:c+1,h=l-p+(d-c)/1e4;if(h<0&&void 0===e.clockseq&&(o=o+1&16383),(h<0||l>p)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=l,c=d,u=o,l+=122192928e5;var f=(1e4*(268435455&l)+d)%4294967296;n[i++]=f>>>24&255,n[i++]=f>>>16&255,n[i++]=f>>>8&255,n[i++]=255&f;var m=l/4294967296*1e4&268435455;n[i++]=m>>>8&255,n[i++]=255&m,n[i++]=m>>>24&15|16,n[i++]=m>>>16&255,n[i++]=o>>>8|128,n[i++]=255&o;for(var y=e.node||s,g=0;g<6;++g)n[i+g]=y[g];return t?t:a(n)}var n=r(198),a=r(197),o=n(),s=[1|o[0],o[1],o[2],o[3],o[4],o[5]],u=16383&(o[6]<<8|o[7]),p=0,c=0;e.exports=i},function(e,t,r){function i(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var o=e.random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[i+s]=o[s];return t||a(o)}var n=r(198),a=r(197);e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);r(201),r(203),r(202),i.__exportStar(r(200),t)}])}); +//# sourceMappingURL=box3d-runtime.min.js.map \ No newline at end of file diff --git a/src/third-party/model3d/1.1.1/boxsdk.min.js b/src/third-party/model3d/1.1.1/boxsdk.min.js new file mode 100644 index 000000000..b8a2a8a86 --- /dev/null +++ b/src/third-party/model3d/1.1.1/boxsdk.min.js @@ -0,0 +1,2 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];e.hasOwnProperty("token")?this.representationLoader=new u["default"](e):this.representationLoader=new a["default"](e),this.metadata=null,this.apiBase=e.apiBase,this.token=e.token,this.sharedLink=e.sharedLink}var i=n(7),a=r(i),s=n(8),u=r(s),l=n(6),c=r(l);o.prototype.loadRepresentation=function(e,t,n,r){return this.representationLoader.load(e,t,n,r)},o.prototype.getMetadataClient=function(e,t,n){return this.metadata||(this.metadata=new c["default"](e||this.token,t||this.apiBase,n||this.sharedLink)),this.metadata},o.prototype.destroy=function(){this.representationLoader.destroy(),delete this.representationLoader,delete this.metadata},t.BoxSDK=o,e.exports=o}).call(t,function(){return this}())},function(e,t,n){(function(r){"use strict";function o(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,r.browser||(this.handled=b),e!==o&&l(this,e)}function a(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function s(e,t,n){v(function(){var r;try{r=t(n)}catch(o){return y.reject(e,o)}r===e?y.reject(e,new TypeError("Cannot resolve promise with itself")):y.resolve(e,r)})}function u(e){var t=e&&e.then;return e&&"object"==typeof e&&"function"==typeof t?function(){t.apply(e,arguments)}:void 0}function l(e,t){function n(t){i||(i=!0,y.reject(e,t))}function r(t){i||(i=!0,y.resolve(e,t))}function o(){t(r,n)}var i=!1,a=c(o);"error"===a.status&&n(a.value)}function c(e,t){var n={};try{n.value=e(t),n.status="success"}catch(r){n.status="error",n.value=r}return n}function f(e){return e instanceof this?e:y.resolve(new this(o),e)}function h(e){var t=new this(o);return y.reject(t,e)}function d(e){function t(e,t){function o(e){a[t]=e,++s!==r||i||(i=!0,y.resolve(l,a))}n.resolve(e).then(o,function(e){i||(i=!0,y.reject(l,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var a=new Array(r),s=0,u=-1,l=new this(o);++ur;++r){o+=(r>0?"&":"")+t[r]+"=";var a=e[t[r]];"object"===("undefined"==typeof a?"undefined":i(a))&&(a=JSON.stringify(a)),o+=encodeURIComponent(a)}return o}},{key:"getContentLength",value:function(e){var t=e.getResponseHeader("Content-Length");return parseInt(t,10)}},{key:"getLoadStatus",value:function(e){var t={total:0,loaded:0,xhr:e};return e.lengthComputable&&e.target&&(t.total=this.getContentLength(e.target)),t.loaded=e.loaded,t}},{key:"getCurrentRequests",value:function(){return this.requests}},{key:"setAuthToken",value:function(e){this.token=e}}]),e}();t["default"]=l},function(e,t){function n(){l=!1,a.length?u=a.concat(u):c=-1,u.length&&r()}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=u.length;t;){for(a=u,u=[];++c1)for(var n=1;n0?"&":"?";return e+t+"shared_name="+this.sharedName}},{key:"destroy",value:function(){u(Object.getPrototypeOf(t.prototype),"destroy",this).call(this),delete this.sharedName}}]),t}(h["default"]);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=Object.assign||function(e){for(var t=1;t-1?"\\":"/";return e=e.replace(/^\W*/,""),e.split(t)}},{key:"countPathMatches",value:function(e,t){if(!e.length)throw new Error("No entries");for(var n=0,r=e.length,o=r-1,i=e[o],a=t.length,s=a-1,u=t[s];u&&i&&s>=0&&o>=0;)u===i.name&&n++,o--,i=e[o],s--,u=t[s];return n}},{key:"searchForFileIds",value:function(e,t){var n=this,r=this.extractDirectoryNames(e),o=r.pop();return new f["default"](function(e,i){var a=o.split(".");o=a[0];var s={type:"file"};a[1]&&(s.file_extensions=a[1]),t?s.ancestor_folder_ids=t:console.warn("No ancestorFolderId provided. Be warned, this can be slow w/ Search API"),n.search.search(o,s).then(function(t){var o=t.response,i=null;return 1===o.entries.length?i=o.entries[0]:!function(){var e=-1;o.entries.forEach(function(t){var o=n.countPathMatches(t.path_collection.entries,r);o>e&&(e=o,i=t)})}(),i?void e({fileId:i.id,fileVersionId:i.file_version.id}):e(null)})["catch"](i)})}},{key:"getFileIds",value:function(e,t){var n=this;if(!e)return f["default"].reject(new Error("No File Path Passed to getFileIds()!"));var r=this.getFromCache(e);return r?f["default"].resolve(r):new f["default"](function(r,o){n.searchForFileIds(e,t).then(function(t){return t?(n.addToCache(e,t.fileId,t.fileVersionId),void r(n.getFromCache(e))):o(new Error("No file and file version ids for "+e))})["catch"](o)})}},{key:"getRepresentationUrl",value:function(e,t){var n=this,r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],o=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];if(!t)return f["default"].reject("No validator supplied to find content for "+e);var i=r?"?"+this.xhr.encodeToUri(r):"";return this.contentBaseCache[e]||!function(){var t=n.apiBase+"/2.0/files/"+e+"?fields=representations";n.contentBaseCache[e]=new f["default"](function(r,i){n.get(t,s({responseType:"json"},o)).then(function(t){if(200!==t.status)throw new Error("Failed to find file representation info for: "+e);var n=t.response;if(!n.representations)throw new Error("No representations for "+e);r(n.representations.entries)})["catch"](i)})}(),this.contentBaseCache[e].then(function(r){if(!r)throw new Error("No representation entries for "+e);for(var o=r.length,i=0;o>i;++i){var a=r[i];if(t(a))return n.getContentUrl(a)}throw new Error("No valid representation found for "+e)}).then(function(e){return""+e+i})}},{key:"getContentUrl",value:function(e){var t=this,n=e.links;return new f["default"](function(r,o){switch(e.status){case g.success:r(n.content.url);break;case g.none:case g.pending:t.pollInfoStatus(n.info.url).then(function(){t.clearPollCount(n.info.url),r(n.content.url)})["catch"](function(e){t.clearPollCount(n.info.url),o(e)});break;case g.error:default:o(new Error("Error converting representation"+e.name))}})}},{key:"pollInfoStatus",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=this.incrementPollCount(e);return r>=m?f["default"].reject(new Error("Max poll time exceeded for "+e)):new f["default"](function(r,o){t.get(e,{responseType:"json"}).then(function(i){if(200!==i.status)throw new Error("Info not available for "+e);var a=i.response;switch(a.status){case g.success:r();break;case g.none:case g.pending:window.setTimeout(function(){t.pollInfoStatus(e,w).then(r)["catch"](function(){o(new Error("Error getting info @ "+e))})},n);break;case g.error:default:throw new Error("Error getting info @ "+e)}})["catch"](o)})}},{key:"incrementPollCount",value:function(e){return this.pollRetries[e]=++this.pollRetries[e]||0,this.pollRetries[e]}},{key:"clearPollCount",value:function(e){delete this.pollRetries[e]}},{key:"destroy",value:function(){l(Object.getPrototypeOf(t.prototype),"destroy",this).call(this),delete this.search,delete this.contentBaseCache}}]),t}(v["default"]);e.exports=b},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n= +d||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +v.compileShader(M);v.compileShader(O);v.attachShader(Q,M);v.attachShader(Q,O);v.linkProgram(Q);F=Q;w=v.getAttribLocation(F,"position");y=v.getAttribLocation(F,"uv");c=v.getUniformLocation(F,"uvOffset");d=v.getUniformLocation(F,"uvScale");e=v.getUniformLocation(F,"rotation");f=v.getUniformLocation(F,"scale");g=v.getUniformLocation(F,"color");h=v.getUniformLocation(F,"map");m=v.getUniformLocation(F,"opacity");k=v.getUniformLocation(F,"modelViewMatrix");t=v.getUniformLocation(F,"projectionMatrix");p= +v.getUniformLocation(F,"fogType");n=v.getUniformLocation(F,"fogDensity");u=v.getUniformLocation(F,"fogNear");l=v.getUniformLocation(F,"fogFar");r=v.getUniformLocation(F,"fogColor");A=v.getUniformLocation(F,"alphaTest");Q=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");Q.width=8;Q.height=8;M=Q.getContext("2d");M.fillStyle="white";M.fillRect(0,0,8,8);da=new ea(Q);da.needsUpdate=!0}v.useProgram(F);E.initAttributes();E.enableAttribute(w);E.enableAttribute(y);E.disableUnusedAttributes(); +E.disable(v.CULL_FACE);E.enable(v.BLEND);v.bindBuffer(v.ARRAY_BUFFER,L);v.vertexAttribPointer(w,2,v.FLOAT,!1,16,0);v.vertexAttribPointer(y,2,v.FLOAT,!1,16,8);v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,C);v.uniformMatrix4fv(t,!1,D.projectionMatrix.elements);E.activeTexture(v.TEXTURE0);v.uniform1i(h,0);M=Q=0;(O=q.fog)?(v.uniform3f(r,O.color.r,O.color.g,O.color.b),O.isFog?(v.uniform1f(u,O.near),v.uniform1f(l,O.far),v.uniform1i(p,1),M=Q=1):O.isFogExp2&&(v.uniform1f(n,O.density),v.uniform1i(p,2),M=Q=2)):(v.uniform1i(p, +0),M=Q=0);for(var O=0,P=b.length;O +c&&(c=a[b]);return c}function T(){Object.defineProperty(this,"id",{value:Vd++});this.uuid=N.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate= +!1}function I(){Object.defineProperty(this,"id",{value:Vd++});this.uuid=N.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function Aa(a,b){x.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new Ka({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function Ib(a,b,c,d,e,f){T.call(this); +this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new kb(a,b,c,d,e,f));this.mergeVertices()}function kb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,L,C,F){var da=f/L,H=g/C,aa=f/2,x=g/2,D=l/2;g=L+1;var z=C+1,Q=f=0,M,O,P=new q;for(O=0;O/g,function(a,c){var d=Z[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return Xd(d)})}function Qe(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);cb||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+ +d.width+"x"+d.height,a);return d}return a}function m(a){return N.isPowerOfTwo(a.width)&&N.isPowerOfTwo(a.height)}function k(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function t(b){b=b.target;b.removeEventListener("dispose",t);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d["delete"](b)}q.textures--}function p(b){b=b.target;b.removeEventListener("dispose", +p);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d["delete"](b.texture);d["delete"](b)}q.textures--}function n(b,g){var k=d.get(b);if(0< +b.version&&k.__version!==b.version){var n=b.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",b);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",b);else{void 0===k.__webglInit&&(k.__webglInit=!0,b.addEventListener("dispose",t),k.__webglTexture=a.createTexture(),q.textures++);c.activeTexture(a.TEXTURE0+g);c.bindTexture(a.TEXTURE_2D,k.__webglTexture);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, +b.flipY);a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha);a.pixelStorei(a.UNPACK_ALIGNMENT,b.unpackAlignment);var p=h(b.image,e.maxTextureSize);if((1001!==b.wrapS||1001!==b.wrapT||1003!==b.minFilter&&1006!==b.minFilter)&&!1===m(p))if(n=p,n instanceof HTMLImageElement||n instanceof HTMLCanvasElement){var l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");l.width=N.nearestPowerOfTwo(n.width);l.height=N.nearestPowerOfTwo(n.height);l.getContext("2d").drawImage(n,0,0, +l.width,l.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+l.width+"x"+l.height,n);p=l}else p=n;var n=m(p),l=f(b.format),G=f(b.type);u(a.TEXTURE_2D,b,n);var r=b.mipmaps;if(b.isDepthTexture){r=a.DEPTH_COMPONENT;if(1015===b.type){if(!w)throw Error("Float Depth Texture only supported in WebGL2.0");r=a.DEPTH_COMPONENT32F}else w&&(r=a.DEPTH_COMPONENT16);1026===b.format&&r===a.DEPTH_COMPONENT&&1012!==b.type&&1014!==b.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), +b.type=1012,G=f(b.type));1027===b.format&&(r=a.DEPTH_STENCIL,1020!==b.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),b.type=1020,G=f(b.type)));c.texImage2D(a.TEXTURE_2D,0,r,p.width,p.height,0,l,G,null)}else if(b.isDataTexture)if(0r;r++)l[r]=n||p?p?b.image[r].image:b.image[r]:h(b.image[r],e.maxCubemapSize);var G=m(l[0]),w=f(b.format),aa=f(b.type);u(a.TEXTURE_CUBE_MAP,b,G);for(r=0;6>r;r++)if(n)for(var x,D=l[r].mipmaps,z=0,Q=D.length;zk;k++)e.__webglFramebuffer[k]=a.createFramebuffer()}else e.__webglFramebuffer= +a.createFramebuffer();if(g){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);u(a.TEXTURE_CUBE_MAP,b.texture,h);for(k=0;6>k;k++)l(e.__webglFramebuffer[k],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+k);b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_CUBE_MAP);c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),u(a.TEXTURE_2D,b.texture,h),l(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_2D), +c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&& +b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);n(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format"); +}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),r(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),r(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER,null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture;e.generateMipmaps&&m(b)&&1003!==e.minFilter&&1006!==e.minFilter&&(b=b&&b.isWebGLRenderTargetCube? +a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,e=d.get(e).__webglTexture,c.bindTexture(b,e),a.generateMipmap(b),c.bindTexture(b,null))}}function Qf(){var a={};return{get:function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c},"delete":function(b){delete a[b.uuid]},clear:function(){a={}}}}function Rf(a,b,c){function d(b,c,d){var e=new Uint8Array(4),f=a.createTexture();a.bindTexture(b,f);a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST);for(b=0;b=la.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ +la.maxTextures);ea+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);ta.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);ta.setTexture2D(b,c)}}();this.setTextureCube=function(){var a= +!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?ta.setTextureCube(b,c):ta.setTextureCubeDynamic(b,c)}}();this.getCurrentRenderTarget=function(){return W};this.setRenderTarget=function(a){(W=a)&&void 0===ha.get(a).__webglFramebuffer&&ta.setupRenderTarget(a);var b=a&&a.isWebGLRenderTargetCube, +c;a?(c=ha.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,X.copy(a.scissor),Sa=a.scissorTest,Z.copy(a.viewport)):(c=null,X.copy(ga).multiplyScalar(Ra),Sa=ka,Z.copy(ia).multiplyScalar(Ra));N!==c&&(B.bindFramebuffer(B.FRAMEBUFFER,c),N=c);Y.scissor(X);Y.setScissorTest(Sa);Y.viewport(Z);b&&(b=ha.get(a.texture),B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels= +function(a,b,c,d,e,f){if(!1===(a&&a.isWebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=ha.get(a).__webglFramebuffer;if(g){var h=!1;g!==N&&(B.bindFramebuffer(B.FRAMEBUFFER,g),h=!0);try{var k=a.texture,m=k.format,n=k.type;1023!==m&&w(m)!==B.getParameter(B.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009=== +n||w(n)===B.getParameter(B.IMPLEMENTATION_COLOR_READ_TYPE)||1015===n&&(ja.get("OES_texture_float")||ja.get("WEBGL_color_buffer_float"))||1016===n&&ja.get("EXT_color_buffer_half_float")?B.checkFramebufferStatus(B.FRAMEBUFFER)===B.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&B.readPixels(b,c,d,e,w(m),w(n),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&& +B.bindFramebuffer(B.FRAMEBUFFER,N)}}}}}function Kb(a,b){this.name="";this.color=new J(a);this.density=void 0!==b?b:2.5E-4}function Lb(a,b,c){this.name="";this.color=new J(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function mb(){x.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function Zd(a,b,c,d,e){x.call(this);this.lensFlares=[];this.positionScreen=new q;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}function nb(a){X.call(this); +this.type="SpriteMaterial";this.color=new J(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(a)}function Dc(a){x.call(this);this.type="Sprite";this.material=void 0!==a?a:new nb}function Ec(){x.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function od(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new S;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=N.nextPowerOfTwo(Math.ceil(a)), +this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new eb(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,1023,1015)):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b= +0,a=this.bones.length;b=a.HAVE_CURRENT_DATA&&(t.needsUpdate=!0)}ea.call(this,a,b,c,d,e,f,g,h,m);this.generateMipmaps=!1;var t=this;k()}function Nb(a,b,c,d,e,f,g,h,m,k,t,p){ea.call(this,null,f,g,h,m,k,d,e,t,p);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function sd(a,b,c,d,e,f,g,h,m){ea.call(this,a,b,c,d,e,f,g,h,m);this.needsUpdate=!0}function Gc(a,b,c,d,e,f,g, +h,m,k){k=void 0!==k?k:1026;if(1026!==k&&1027!==k)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===k&&(c=1012);void 0===c&&1027===k&&(c=1020);ea.call(this,null,d,e,f,g,h,k,c,m);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Ob(a){function b(a,b){return a-b}I.call(this);this.type="WireframeGeometry";var c=[],d,e,f,g,h=[0,0],m={},k,t=["a","b", +"c"];if(a&&a.isGeometry){var p=a.faces;d=0;for(f=p.length;de;e++)h[0]=n[t[e]],h[1]=n[t[(e+1)%3]],h.sort(b),k=h.toString(),void 0===m[k]&&(m[k]={index1:h[0],index2:h[1]})}for(k in m)d=m[k],t=a.vertices[d.index1],c.push(t.x,t.y,t.z),t=a.vertices[d.index2],c.push(t.x,t.y,t.z)}else if(a&&a.isBufferGeometry){var l,t=new q;if(null!==a.index){p=a.attributes.position;n=a.index;l=a.groups;0===l.length&&a.addGroup(0,n.count);a=0;for(g=l.length;ae;e++)h[0]=n.getX(d+e),h[1]=n.getX(d+(e+1)%3),h.sort(b),k=h.toString(),void 0===m[k]&&(m[k]={index1:h[0],index2:h[1]});for(k in m)d=m[k],t.fromBufferAttribute(p,d.index1),c.push(t.x,t.y,t.z),t.fromBufferAttribute(p,d.index2),c.push(t.x,t.y,t.z)}else for(p=a.attributes.position,d=0,f=p.count/3;de;e++)m=3*d+e,t.fromBufferAttribute(p,m),c.push(t.x,t.y,t.z),m=3*d+(e+1)%3,t.fromBufferAttribute(p,m),c.push(t.x,t.y,t.z)}this.addAttribute("position",new z(c,3))} +function Hc(a,b,c){T.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Pb(a,b,c));this.mergeVertices()}function Pb(a,b,c){I.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g,h,m=b+1;for(g=0;g<=c;g++){var k=g/c;for(h=0;h<=b;h++){var t=h/b,p=a(t,k);e.push(p.x,p.y,p.z);f.push(t,k)}}for(g=0;gd&&1===a.x&&(m[b]=a.x-1);0===c.x&&0===c.z&&(m[b]=d/2/Math.PI+ +.5)}I.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;var h=[],m=[];(function(a){for(var c=new q,d=new q,g=new q,h=0;he&&(.2>b&&(m[a+0]+=1),.2>c&&(m[a+2]+=1),.2>d&&(m[a+4]+=1))})();this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(h.slice(),3));this.addAttribute("uv", +new z(m,2));this.normalizeNormals()}function Jc(a,b){T.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qb(a,b));this.mergeVertices()}function Qb(a,b){Ba.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Kc(a,b){T.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ob(a,b));this.mergeVertices()} +function ob(a,b){Ba.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Lc(a,b){T.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Rb(a,b));this.mergeVertices()}function Rb(a,b){var c=(1+Math.sqrt(5))/2;Ba.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11, +5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Mc(a,b){T.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Sb(a,b));this.mergeVertices()}function Sb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;Ba.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0, +d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Nc(a,b,c,d,e,f){T.call(this);this.type="TubeGeometry";this.parameters={path:a, +tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Tb(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Tb(a,b,c,d,e){function f(e){var f=a.getPointAt(e/b),k=g.normals[e];e=g.binormals[e];for(p=0;p<=d;p++){var t=p/d*Math.PI*2,r=Math.sin(t),t=-Math.cos(t);m.x=t*k.x+r*e.x;m.y=t*k.y+r*e.y;m.z=t*k.z+r*e.z;m.normalize();l.push(m.x, +m.y,m.z);h.x=f.x+c*m.x;h.y=f.y+c*m.y;h.z=f.z+c*m.z;n.push(h.x,h.y,h.z)}}I.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new q,m=new q,k=new D,t,p,n=[],l=[],G=[],r=[];for(t=0;tq;q++)f[0]=l[m[q]],f[1]=l[m[(q+1)%3]],f.sort(c),h=f.toString(),void 0===g[h]?g[h]={index1:f[0],index2:f[1],face1:p,face2:void 0}:g[h].face2=p;for(h in g)if(f=g[h],void 0===f.face2||k[f.face1].normal.dot(k[f.face2].normal)<= +e)m=t[f.index1],d.push(m.x,m.y,m.z),m=t[f.index2],d.push(m.x,m.y,m.z);this.addAttribute("position",new z(d,3))}function qb(a,b,c,d,e,f,g,h){T.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new Va(a,b,c,d,e,f,g,h));this.mergeVertices()}function Va(a,b,c,d,e,f,g,h){function m(c){var e,f,m,r=new D,C=new q,F=0,x=!0===c?a:b,H=!0===c?1:-1;f=G;for(e=1;e<=d;e++)p.push(0, +A*H,0),n.push(0,H,0),l.push(.5,.5),G++;m=G;for(e=0;e<=d;e++){var aa=e/d*h+g,z=Math.cos(aa),aa=Math.sin(aa);C.x=x*aa;C.y=A*H;C.z=x*z;p.push(C.x,C.y,C.z);n.push(0,H,0);r.x=.5*z+.5;r.y=.5*aa*H+.5;l.push(r.x,r.y);G++}for(e=0;ethis.duration&&this.resetDuration();this.optimize()}function Hd(a){this.manager= +void 0!==a?a:ta;this.textures={}}function ce(a){this.manager=void 0!==a?a:ta}function zb(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function de(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:ta;this.withCredentials=!1}function Se(a){this.manager=void 0!==a?a:ta;this.texturePath=""}function Te(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2* +c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function Ab(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function Bb(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function ua(){}function Ta(a,b){this.v1=a;this.v2=b}function ad(){this.curves=[];this.autoClose=!1}function Wa(a,b,c,d,e,f,g,h){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g;this.aRotation=h||0}function Cb(a){this.points=void 0===a?[]:a}function fc(a,b,c, +d){this.v0=a;this.v1=b;this.v2=c;this.v3=d}function gc(a,b,c){this.v0=a;this.v1=b;this.v2=c}function bd(a){ad.call(this);this.currentPoint=new D;a&&this.fromPoints(a)}function Db(){bd.apply(this,arguments);this.holes=[]}function ee(){this.subPaths=[];this.currentPath=null}function fe(a){this.data=a}function Ue(a){this.manager=void 0!==a?a:ta}function ge(a){this.manager=void 0!==a?a:ta}function he(a,b,c,d){ma.call(this,a,b);this.type="RectAreaLight";this.position.set(0,1,0);this.updateMatrix();this.width= +void 0!==c?c:10;this.height=void 0!==d?d:10}function Ve(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new Fa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Fa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Id(a,b,c){x.call(this);this.type="CubeCamera";var d=new Fa(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new q(1,0,0));this.add(d);var e=new Fa(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new q(-1,0,0));this.add(e);var f=new Fa(90, +1,a,b);f.up.set(0,0,1);f.lookAt(new q(0,1,0));this.add(f);var g=new Fa(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new q(0,-1,0));this.add(g);var h=new Fa(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new q(0,0,1));this.add(h);var m=new Fa(90,1,a,b);m.up.set(0,-1,0);m.lookAt(new q(0,0,-1));this.add(m);this.renderTarget=new Gb(c,c,{format:1022,magFilter:1006,minFilter:1006});this.updateCubeMap=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,n=c.texture.generateMipmaps;c.texture.generateMipmaps= +!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.texture.generateMipmaps=n;c.activeCubeFace=5;a.render(b,m,c);a.setRenderTarget(null)}}function ie(){x.call(this);this.type="AudioListener";this.context=je.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function hc(a){x.call(this);this.type="Audio";this.context= +a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function ke(a){hc.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function le(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount); +a.getOutput().connect(this.analyser)}function Jd(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function ka(a,b,c){this.path=b;this.parsedPath=c||ka.parseTrackName(b);this.node=ka.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function me(a){this.uuid=N.generateUUID(); +this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}function ne(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks; +b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled= +!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function cd(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Kd(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Eb(){I.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function oe(a,b,c,d){this.uuid=N.generateUUID();this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0=== +d}function ic(a,b){this.uuid=N.generateUUID();this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function jc(a,b,c){ic.call(this,a,b);this.meshPerAttribute=c||1}function kc(a,b,c){U.call(this,a,b);this.meshPerAttribute=c||1}function pe(a,b,c,d){this.ray=new cb(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params, +{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function We(a,b){return a.distance-b.distance}function qe(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32* +Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new z(b,3));b=new ia({fog:!1});this.cone=new ga(a,b);this.add(this.cone);this.update()}function mc(a){this.bones=this.getBoneList(a);for(var b=new I,c=[],d=[],e=new J(0,0,1),f=new J(0,1,0),g=0;ga?-1:0e;e++)8===e||13===e||18===e||23===e?b[e]="-":14===e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19===e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a, +b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*N.DEG2RAD},radToDeg:function(a){return a*N.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2, +Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};D.prototype={constructor:D,isVector2:!0,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break; +case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x; +this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x= +a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x, +Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new D,b=new D);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x); +this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())}, +angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b, +a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=this.x- +a.x,f=this.y-a.y;this.x=e*c-f*d+a.x;this.y=e*d+f*c+a.y;return this}};var Ze=0;ea.DEFAULT_IMAGE=void 0;ea.DEFAULT_MAPPING=300;ea.prototype={constructor:ea,isTexture:!0,set needsUpdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format; +this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.encoding=a.encoding;return this},toJSON:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x, +this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=N.generateUUID());if(void 0===a.images[c.uuid]){var d=a.images,e=c.uuid,f=c.uuid,g;void 0!==c.toDataURL?g=c:(g=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),g.width=c.width,g.height=c.height,g.getContext("2d").drawImage(c,0,0,c.width,c.height));g=2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}};Object.assign(ea.prototype,pa.prototype);fa.prototype={constructor:fa,isVector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this}, +setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w? +a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b; +return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z= +this.y=this.x=0;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this}, +setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],m=a[9];c=a[2];b=a[6];var k=a[10];if(.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(m-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(m+b)&&.1>Math.abs(e+h+k-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;m=(m+b)/4;e>h&&e>k?.01>e?(b=0,d=c=.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>k?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h), +b=d/c,d=m/c):.01>k?(c=b=.707106781,d=0):(d=Math.sqrt(k),b=f/d,c=m/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-m)*(b-m)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&&(a=1);this.x=(b-m)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+k-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z); +this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new fa,b=new fa);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w); +return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w); +return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())}, +setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a= +[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}};Ya.prototype={constructor:Ya,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a, +b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};Object.assign(Ya.prototype,pa.prototype);Gb.prototype=Object.create(Ya.prototype);Gb.prototype.constructor=Gb;Gb.prototype.isWebGLRenderTargetCube=!0; +ca.prototype={constructor:ca,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= +a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!1===(a&&a.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2),m=a.order;"XYZ"===m?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===m?(this._x=f*d*e+c*g*h,this._y=c*g* +e-f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===m?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===m?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===m?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===m&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){var c= +b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],m=b[6],b=b[10],k=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(m-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c, +this._z=(g+m)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+m)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new q);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*=-1;this._y*= +-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a, +b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,m=b._z,k=b._w;this._x=c*k+f*g+d*m-e*h;this._y=d*k+f*h+e*g-c*m;this._z=e*k+f*m+c*h-d*g;this._w=f*k-c*g-d*h-e*m;this.onChangeCallback();return this},slerp:function(a, +b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.sqrt(1-g*g);if(.001>Math.abs(h))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var m=Math.atan2(h,g),g=Math.sin((1-b)*m)/h,h=Math.sin(b*m)/h;this._w=f*g+this._w*h;this._x= +c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this}, +onChangeCallback:function(){}};Object.assign(ca,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],m=c[d+1],k=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],p=e[f+2];e=e[f+3];if(c!==e||h!==d||m!==l||k!==p){f=1-g;var n=h*d+m*l+k*p+c*e,u=0<=n?1:-1,q=1-n*n;q>Number.EPSILON&&(q=Math.sqrt(q),n=Math.atan2(q,n*u),f=Math.sin(f*n)/q,g=Math.sin(g*n)/q);u*=g;h=h*f+d*u;m=m*f+l*u;k=k*f+p*u;c=c*f+e*u;f===1-g&&(g=1/Math.sqrt(h*h+m*m+k*k+c*c),h*=g,m*=g,k*=g,c*=g)}a[b]=h;a[b+ +1]=m;a[b+2]=k;a[b+3]=c}});q.prototype={constructor:q,isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; +case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this}, +addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z= +a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===(b&& +b.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new ca);return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new ca);return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b= +this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this.divideScalar(a[3]*b+a[7]*c+a[11]*d+a[15])},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,m=a*c+g*b-e*d,k=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+m*-g-k*-f;this.y=m*a+b*-f+k*-e-h*-g;this.z=k*a+b*-g+h*-f-m*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new S);a.multiplyMatrices(b.projectionMatrix, +a.getInverse(b.matrixWorld));return this.applyMatrix4(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new S);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyMatrix4(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ +a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new q,b=new q);a.set(c,c,c);b.set(d,d,d);return this.clamp(a, +b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x); +this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())}, +setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y- +d*a.x;return this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new q);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new q);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a= +this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(N.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius;this.x=b*Math.sin(a.theta);this.y=Math.cos(a.phi)*a.radius;this.z=b*Math.cos(a.theta);return this}, +setFromCylindrical:function(a){this.x=a.radius*Math.sin(a.theta);this.y=a.y;this.z=a.radius*Math.cos(a.theta);return this},setFromMatrixPosition:function(a){return this.setFromMatrixColumn(a,3)},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){if("number"===typeof a){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."); +var c=a;a=b;b=c}return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b); +return this}};S.prototype={constructor:S,isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,m,k,l,p,n,u,q,r){var A=this.elements;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=m;A[6]=k;A[10]=l;A[14]=p;A[3]=n;A[7]=u;A[11]=q;A[15]=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new S).fromArray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyPosition:function(a){var b=this.elements;a=a.elements; +b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a;return function(b){void 0===a&&(a=new q);var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length(); +c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;return this}}(),makeRotationFromEuler:function(a){!1===(a&&a.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var m=f*e,k=c*h,l=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=m+ +k*d;b[5]=a-l*d;b[9]=-c*g;b[2]=l-a*d;b[6]=k+m*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,m=g*e,k=d*h,l=d*e,b[0]=a+l*c,b[4]=k*c-m,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=m*c-k,b[6]=l+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,m=g*e,k=d*h,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=k+m*c,b[1]=m+k*c,b[5]=f*h,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,m=f*e,k=c*h,l=c*e,b[0]=g*h,b[4]=k*d-m,b[8]=a*d+l,b[1]=g*e,b[5]=l*d+a,b[9]=m*d-k,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,m=f*d,k=c*g,l=c*d,b[0]= +g*h,b[4]=l-a*e,b[8]=k*e+m,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=m*e+k,b[10]=a-l*e):"XZY"===a.order&&(a=f*g,m=f*d,k=c*g,l=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+l,b[5]=f*h,b[9]=m*e-k,b[2]=k*e-m,b[6]=c*h,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,m=e+e;a=c*g;var k=c*h,c=c*m,l=d*h,d=d*m,e=e*m,g=f*g,h=f*h,f=f*m;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]= +d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new q,b=new q,c=new q);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.z+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!== +b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],m=c[12],k=c[1],l=c[5],p=c[9],n=c[13],u=c[2],q=c[6],r=c[10],A=c[14],w=c[3],y=c[7],K=c[11],c=c[15],v=d[0],E=d[4],L=d[8],C=d[12],F=d[1],x=d[5],H=d[9],D=d[13],z=d[2],J=d[6], +I=d[10],Q=d[14],M=d[3],O=d[7],P=d[11],d=d[15];e[0]=f*v+g*F+h*z+m*M;e[4]=f*E+g*x+h*J+m*O;e[8]=f*L+g*H+h*I+m*P;e[12]=f*C+g*D+h*Q+m*d;e[1]=k*v+l*F+p*z+n*M;e[5]=k*E+l*x+p*J+n*O;e[9]=k*L+l*H+p*I+n*P;e[13]=k*C+l*D+p*Q+n*d;e[2]=u*v+q*F+r*z+A*M;e[6]=u*E+q*x+r*J+A*O;e[10]=u*L+q*H+r*I+A*P;e[14]=u*C+q*D+r*Q+A*d;e[3]=w*v+y*F+K*z+c*M;e[7]=w*E+y*x+K*J+c*O;e[11]=w*L+y*H+K*I+c*P;e[15]=w*C+y*D+K*Q+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]= +d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a;return function(b){void 0===a&&(a=new q);for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,k=1/m;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=k;b.elements[9]*=k;b.elements[10]*=k;d.setFromRotationMatrix(b); +e.x=g;e.y=h;e.z=m;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),m=1/(c-d),k=1/(f-e);g[0]= +2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*m;g[9]=0;g[13]=-((c+d)*m);g[2]=0;g[6]=0;g[10]=-2*k;g[14]=-((f+e)*k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; +a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}};Za.prototype=Object.create(ea.prototype);Za.prototype.constructor=Za;Za.prototype.isCubeTexture=!0;Object.defineProperty(Za.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var Ee=new ea,Fe=new Za,Be=[],De=[];Je.prototype.setValue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setValue(a, +b[f.id])}};var Rd=/([\w\d_]+)(\])?(\[|\.)?/g;$a.prototype.setValue=function(a,b,c){b=this.map[b];void 0!==b&&b.setValue(a,c,this.renderer)};$a.prototype.set=function(a,b,c){var d=this.map[c];void 0!==d&&d.setValue(a,b[c],this.renderer)};$a.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};$a.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}};$a.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!== +e;++d){var f=a[d];f.id in b&&c.push(f)}return c};var Ja={merge:function(a){for(var b={},c=0;c 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", +bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n", +clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n", +clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", +color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n", +cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", +defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n", +emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n", +envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n", +envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n", +envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n", +fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n", +gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n", +lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n", +lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n", +lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n", +lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n", +lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n", +lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n", +logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n", +map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n", +metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n", +morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n", +normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n", +normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n", +packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n", +premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n", +roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", +shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n", +shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n", +shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n", +skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", +skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n", +specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", +uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n", +uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", +uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", +cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", +depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n", +equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n", +linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n", +meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n", +normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n", +normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n", +points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};J.prototype={constructor:J, +isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, +c,d){b=N.euclideanModulo(b,1);c=N.clamp(c,0,1);d=N.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= +Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(c[1])/ +360,e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^\#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0=h?m/(e+f): +m/(2-e-f);switch(e){case b:g=(c-d)/m+(cthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){return(b||new D).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y- +this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new D).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new D;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a); +this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};var Af=0;X.prototype={constructor:X,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."): +d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]="overdraw"===b?Number(c):c}}},toJSON:function(a){function b(a){var b=[],c;for(c in a){var d=a[c];delete d.metadata;b.push(d)}return b}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};d.uuid=this.uuid;d.type=this.type;""!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness); +void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex());this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap= +this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid);this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(a).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale,d.displacementBias= +this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity=this.reflectivity); +this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(a).uuid);void 0!==this.size&&(d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&&(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc; +d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0e&&(e=k);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,m=a.count;he&&(e=k);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a, +b){return(b||new q).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a;return function(b){void 0===a&&(a=new q);this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b, +c;0=a.constant},clampPoint:function(a,b){return(b||new q).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new q; +return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new q;return function(b){b=b||new Na;this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new q,new q,new q,new q,new q,new q,new q,new q];return function(b){if(this.isEmpty())return this; +a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(), +translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};Na.prototype={constructor:Na,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a;return function(b,c){void 0===a&&(a=new Pa);var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=0,f=0,g=b.length;f=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)- +a.constant)<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new q;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new Pa;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&& +a.radius===this.radius}};ya.prototype={constructor:ya,isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,m){var k=this.elements;k[0]=a;k[1]=d;k[2]=g;k[3]=b;k[4]=e;k[5]=h;k[6]=c;k[7]=f;k[8]=m;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9], +a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a;return function(b){void 0===a&&(a=new q);for(var c=0,d=b.count;cc;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}};la.prototype={constructor:la,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, +b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new q,b=new q;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this}, +negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b||new q).copy(this.normal).multiplyScalar(c)},intersectLine:function(){var a=new q;return function(b,c){var d=c||new q,e=b.delta(a),f=this.normal.dot(e); +if(0===f){if(0===this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],m=c[6],k=c[7],l=c[8],p=c[9],n=c[10],u=c[11],q=c[12],r=c[13],A=c[14],c=c[15];b[0].setComponents(f-a,k-g,u-l,c-q).normalize();b[1].setComponents(f+a,k+g,u+l,c+q).normalize();b[2].setComponents(f+d,k+h,u+p,c+r).normalize();b[3].setComponents(f- +d,k-h,u-p,c-r).normalize();b[4].setComponents(f-e,k-m,u-n,c-A).normalize();b[5].setComponents(f+e,k+m,u+n,c+A).normalize();return this},intersectsObject:function(){var a=new Na;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Na;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(), +intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0 +g&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}};cb.prototype={constructor:cb,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new q).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize(); +return this},recast:function(){var a=new q;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new q;c.subVectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new q;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b); +a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new q,b=new q,c=new q;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),m=-this.direction.dot(b),k=c.dot(this.direction),l=-c.dot(b),p=c.lengthSq(),n=Math.abs(1-m*m),u;0=-u?e<=u?(h=1/n,d*=h,e*=h,m=d*(d+m*e+2*k)+e*(m*d+e+2*l)+p):(e=h,d=Math.max(0,-(m* +e+k)),m=-d*d+e*(e+2*l)+p):(e=-h,d=Math.max(0,-(m*e+k)),m=-d*d+e*(e+2*l)+p):e<=-u?(d=Math.max(0,-(-m*h+k)),e=0f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a, +b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e; +if(fg||e>d)return null;if(e>c||c!==c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectsBox:function(){var a=new q;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new q,b=new q,c=new q,d=new q;return function(e,f,g,h,m){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h= +-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,m)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}};db.RotationOrders= +"XYZ YZX ZXY XZY YXZ ZYX".split(" ");db.DefaultOrder="XYZ";db.prototype={constructor:db,isEuler:!0,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this}, +clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=N.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],m=e[5],k=e[9],l=e[2],p=e[6],e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-k,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(p,m),this._z=0)):"YXZ"=== +b?(this._x=Math.asin(-d(k,-1,1)),.99999>Math.abs(k)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,m)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-l,e),this._z=Math.atan2(-f,m)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(p,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,m))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x= +Math.atan2(-k,m),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(p,m),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-k,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new S);a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a, +c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ca;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]= +this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new q(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};nd.prototype={constructor:nd,set:function(a){this.mask=1<=b.x+b.y}}();za.prototype={constructor:za,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this}, +area:function(){var a=new q,b=new q;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new q).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return za.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new la).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return za.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return za.containsPoint(a, +this.a,this.b,this.c)},closestPointToPoint:function(){var a,b,c,d;return function(e,f){void 0===a&&(a=new la,b=[new hb,new hb,new hb],c=new q,d=new q);var g=f||new q,h=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,c);if(!0===this.containsPoint(c))g.copy(c);else{b[0].set(this.a,this.b);b[1].set(this.b,this.c);b[2].set(this.c,this.a);for(var m=0;md;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;cb.far?null:{distance:c,point:w.clone(),object:a}}function c(c,d,e,f,k,l,p,t){g.fromBufferAttribute(f,l);h.fromBufferAttribute(f,p);m.fromBufferAttribute(f,t);if(c=b(c,d,e,g,h,m,A))k&&(n.fromBufferAttribute(k,l),u.fromBufferAttribute(k,p),G.fromBufferAttribute(k,t),c.uv=a(A,g,h,m,n,u,G)),c.face= +new ha(l,p,t,za.normal(g,h,m)),c.faceIndex=l;return c}var d=new S,e=new cb,f=new Na,g=new q,h=new q,m=new q,k=new q,l=new q,p=new q,n=new D,u=new D,G=new D,r=new q,A=new q,w=new q;return function(q,r){var v=this.geometry,w=this.material,L=this.matrixWorld;if(void 0!==w&&(null===v.boundingSphere&&v.computeBoundingSphere(),f.copy(v.boundingSphere),f.applyMatrix4(L),!1!==q.ray.intersectsSphere(f)&&(d.getInverse(L),e.copy(q.ray).applyMatrix4(d),null===v.boundingBox||!1!==e.intersectsBox(v.boundingBox)))){var C; +if(v.isBufferGeometry){var F,x,w=v.index,H=v.attributes.position,L=v.attributes.uv,D,z;if(null!==w)for(D=0,z=w.count;Dthis.scale.x*this.scale.y/4||c.push({distance:Math.sqrt(d),point:this.position, +face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});Ec.prototype=Object.assign(Object.create(x.prototype),{constructor:Ec,copy:function(a){x.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e- +1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applyMatrix4(this.matrixWorld), +r=d.ray.origin.distanceTo(l),rd.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(g=0,G=u.length/3-1;gf||(l.applyMatrix4(this.matrixWorld),r=d.ray.origin.distanceTo(l),rd.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(m=g.vertices, +k=m.length,g=0;gf||(l.applyMatrix4(this.matrixWorld),r=d.ray.origin.distanceTo(l),rd.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});ga.prototype=Object.assign(Object.create(Ua.prototype),{constructor:ga,isLineSegments:!0});Oa.prototype=Object.create(X.prototype);Oa.prototype.constructor= +Oa;Oa.prototype.isPointsMaterial=!0;Oa.prototype.copy=function(a){X.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;return this};Mb.prototype=Object.assign(Object.create(x.prototype),{constructor:Mb,isPoints:!0,raycast:function(){var a=new S,b=new cb,c=new Na;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);if(fd.far||e.push({distance:k,distanceToRay:Math.sqrt(f),point:h.clone(),index:c,face:null,object:g})}}var g=this,h=this.geometry,m=this.matrixWorld,k=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(m);if(!1!==d.ray.intersectsSphere(c)){a.getInverse(m);b.copy(d.ray).applyMatrix4(a);var k=k/((this.scale.x+this.scale.y+this.scale.z)/3),l=k*k,k=new q;if(h.isBufferGeometry){var p=h.index,h=h.attributes.position.array;if(null!==p)for(var n= +p.array,p=0,u=n.length;pc)return null;var d=[],e=[],f=[],g,h,m;if(0=k--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);m=h+1;c<=m&&(m=0);var l;a:{var p,n,q,G,r,A,w,y;p=a[e[g]].x;n=a[e[g]].y;q=a[e[h]].x;G=a[e[h]].y;r=a[e[m]].x;A=a[e[m]].y;if(0>=(q- +p)*(A-n)-(G-n)*(r-p))l=!1;else{var K,v,E,x,C,F,D,H,z,J;K=r-q;v=A-G;E=p-r;x=n-A;C=q-p;F=G-n;for(l=0;l=-Number.EPSILON&&H>=-Number.EPSILON&&D>=-Number.EPSILON)){l=!1;break a}l=!0}}if(l){d.push([a[e[g]],a[e[h]],a[e[m]]]);f.push([e[g],e[h],e[m]]);g=h;for(m=h+1;mNumber.EPSILON){if(0t||t>p)return[];k=m*l-k*n;if(0>k||k>p)return[]}else{if(0c?[]:k===c?f?[]:[g]:a<=c?[g,h]:[g,m]}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0e&&(e=d);var g=a+1;g>d&&(g=0);d=f(h[a],h[e],h[g],k[b]);if(!d)return!1;d=k.length-1;e=b-1;0>e&&(e=d);g=b+1;g>d&&(g=0);return(d=f(k[b],k[e],k[g],h[a]))?!0:!1}function d(a,b){var c,f;for(c=0;cQ){console.log("Infinite Loop! Holes left:"+m.length+", Probably Hole outside Shape!");break}for(n=D;nm;m++)l=k[m].x+":"+k[m].y,l=p[l],void 0!==l&&(k[m]=l);return n.concat()},isClockWise:function(a){return 0>Ia.area(a)}};La.prototype=Object.create(T.prototype);La.prototype.constructor=La;La.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;dNumber.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(d*d+g*g),h=b.x-f/k;b=b.y+e/k;g=((c.x-g/m-h)*g-(c.y+d/m-b)*d)/(e*g-f*d);d=h+e*g-a.x;e=b+f*g-a.y;f=d*d+e*e;if(2>=f)return new D(d,e);f=Math.sqrt(f/2)}else a=!1,e>Number.EPSILON?d>Number.EPSILON&&(a=!0):e<-Number.EPSILON?d<-Number.EPSILON&&(a=!0):Math.sign(f)===Math.sign(g)&&(a=!0),a?(d=-f,f=Math.sqrt(h)):(d=e,e=f,f=Math.sqrt(h/2));return new D(d/f,e/f)} +function e(a,b){var c,d;for(R=a.length;0<=--R;){c=R;d=R-1;0>d&&(d=a.length-1);var e,f=u+2*l;for(e=0;eMath.abs(b.y-c.y)?[new D(b.x,1-b.z),new D(c.x,1-c.z),new D(d.x,1-d.z),new D(e.x,1-e.z)]:[new D(b.y,1-b.z),new D(c.y,1-c.z),new D(d.y,1-d.z),new D(e.y,1-e.z)]}};Qc.prototype=Object.create(La.prototype);Qc.prototype.constructor=Qc;Rc.prototype=Object.create(T.prototype);Rc.prototype.constructor=Rc;pb.prototype=Object.create(I.prototype);pb.prototype.constructor=pb;Sc.prototype=Object.create(T.prototype);Sc.prototype.constructor= +Sc;Wb.prototype=Object.create(I.prototype);Wb.prototype.constructor=Wb;Tc.prototype=Object.create(T.prototype);Tc.prototype.constructor=Tc;Xb.prototype=Object.create(I.prototype);Xb.prototype.constructor=Xb;Yb.prototype=Object.create(T.prototype);Yb.prototype.constructor=Yb;Zb.prototype=Object.create(I.prototype);Zb.prototype.constructor=Zb;$b.prototype=Object.create(I.prototype);$b.prototype.constructor=$b;qb.prototype=Object.create(T.prototype);qb.prototype.constructor=qb;Va.prototype=Object.create(I.prototype); +Va.prototype.constructor=Va;Uc.prototype=Object.create(qb.prototype);Uc.prototype.constructor=Uc;Vc.prototype=Object.create(Va.prototype);Vc.prototype.constructor=Vc;Wc.prototype=Object.create(T.prototype);Wc.prototype.constructor=Wc;ac.prototype=Object.create(I.prototype);ac.prototype.constructor=ac;var Ma=Object.freeze({WireframeGeometry:Ob,ParametricGeometry:Hc,ParametricBufferGeometry:Pb,TetrahedronGeometry:Jc,TetrahedronBufferGeometry:Qb,OctahedronGeometry:Kc,OctahedronBufferGeometry:ob,IcosahedronGeometry:Lc, +IcosahedronBufferGeometry:Rb,DodecahedronGeometry:Mc,DodecahedronBufferGeometry:Sb,PolyhedronGeometry:Ic,PolyhedronBufferGeometry:Ba,TubeGeometry:Nc,TubeBufferGeometry:Tb,TorusKnotGeometry:Oc,TorusKnotBufferGeometry:Ub,TorusGeometry:Pc,TorusBufferGeometry:Vb,TextGeometry:Qc,SphereGeometry:Rc,SphereBufferGeometry:pb,RingGeometry:Sc,RingBufferGeometry:Wb,PlaneGeometry:Ac,PlaneBufferGeometry:lb,LatheGeometry:Tc,LatheBufferGeometry:Xb,ShapeGeometry:Yb,ShapeBufferGeometry:Zb,ExtrudeGeometry:La,EdgesGeometry:$b, +ConeGeometry:Uc,ConeBufferGeometry:Vc,CylinderGeometry:qb,CylinderBufferGeometry:Va,CircleGeometry:Wc,CircleBufferGeometry:ac,BoxGeometry:Ib,BoxBufferGeometry:kb});bc.prototype=Object.create(Ha.prototype);bc.prototype.constructor=bc;bc.prototype.isShadowMaterial=!0;cc.prototype=Object.create(Ha.prototype);cc.prototype.constructor=cc;cc.prototype.isRawShaderMaterial=!0;Xc.prototype={constructor:Xc,isMultiMaterial:!0,toJSON:function(a){for(var b={metadata:{version:4.2,type:"material",generator:"MaterialExporter"}, +uuid:this.uuid,type:this.type,materials:[]},c=this.materials,d=0,e=c.length;d=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),d=this.getValueSize(),this.times=na.arraySlice(c,e,f),this.values=na.arraySlice(this.values,e*d,f*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("track is empty", +this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("time is not a valid number",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&na.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("value is not a valid number",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1, +f=a.length-1,g=1;gk.opacity&&(k.transparent=!0);d.setTextures(m);return d.parse(k)}}()};zb.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;cg;g++)n=y[m++],w=A[2*n],n=A[2*n+1],w=new D(w,n),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);p&&(p=3*y[m++],u.normal.set(x[p++],x[p++],x[p]), +r.normal.copy(u.normal));if(G)for(d=0;4>d;d++)p=3*y[m++],G=new q(x[p++],x[p++],x[p]),2!==d&&u.vertexNormals.push(G),0!==d&&r.vertexNormals.push(G);l&&(l=y[m++],l=v[l],u.color.setHex(l),r.color.setHex(l));if(b)for(d=0;4>d;d++)l=y[m++],l=v[l],2!==d&&u.vertexColors.push(new J(l)),0!==d&&r.vertexColors.push(new J(l));c.faces.push(u);c.faces.push(r)}else{u=new ha;u.a=y[m++];u.b=y[m++];u.c=y[m++];h&&(h=y[m++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)n=y[m++],w=A[2*n],n=A[2*n+1],w=new D(w,n),c.faceVertexUvs[d][h].push(w);p&&(p=3*y[m++],u.normal.set(x[p++],x[p++],x[p]));if(G)for(d=0;3>d;d++)p=3*y[m++],G=new q(x[p++],x[p++],x[p]),u.vertexNormals.push(G);l&&(l=y[m++],u.color.setHex(v[l]));if(b)for(d=0;3>d;d++)l=y[m++],u.vertexColors.push(new J(v[l]));c.faces.push(u)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dm)g=d+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(N.clamp(d[m-1].dot(d[m]),-1,1)),e[m].applyMatrix4(h.makeRotationAxis(g,c))),f[m].crossVectors(d[m],e[m]);if(!0===b)for(c=Math.acos(N.clamp(e[0].dot(e[a]),-1,1)),c/=a,0=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate= +!0;this.cacheLengths=null;this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cc;)c+=b;for(;c>b;)c-=b;cb.length-2?b.length-1:a+1],b=b[a>b.length-3?b.length-1:a+2];return new D(Te(c,d.x,e.x,f.x,b.x),Te(c,d.y,e.y,f.y,b.y))};fc.prototype=Object.create(ua.prototype);fc.prototype.constructor= +fc;fc.prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new D(Bb(a,b.x,c.x,d.x,e.x),Bb(a,b.y,c.y,d.y,e.y))};gc.prototype=Object.create(ua.prototype);gc.prototype.constructor=gc;gc.prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2;return new D(Ab(a,b.x,c.x,d.x),Ab(a,b.y,c.y,d.y))};var xe=Object.assign(Object.create(ad.prototype),{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;bNumber.EPSILON){if(0>m&&(g=b[f],k=-k,h=b[e],m=-m),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=m*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=Ia.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);var g,h,m,k=[];if(1===f.length)return h=f[0],m=new Db,m.curves=h.curves,k.push(m),k;var l=!e(f[0].getPoints()),l=a?!l:l;m=[];var p= +[],n=[],q=0,x;p[q]=void 0;n[q]=[];for(var r=0,A=f.length;rd&&this._mixBufferRegion(c,a,3*b,1-d,b);for(var d=b,f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}}, +saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d,e){ca.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}};ka.prototype={constructor:ka,getValue:function(a, +b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;a||(this.node=a=ka.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(c){var f=b.objectIndex;switch(c){case "materials":if(!a.material){console.error(" can not bind to material as node does not have a material",this);return}if(!a.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array", +this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c=c){var p=c++,n=b[p];d[n.uuid]=l;b[l]=n;d[k]=p;b[p]=m;m=0;for(k=f;m!==k;++m){var n=e[m],q=n[l];n[l]=n[p];n[p]=q}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,h=0,m=arguments.length;h!==m;++h){var k=arguments[h].uuid,l=e[k]; +if(void 0!==l)if(delete e[k],lb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&& +(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){var b=this.timeScale,c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200===d)a:{if(-1===e&&(this._loopCount= +0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{d=2202===d;-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(b>=c||0>b){var f=Math.floor(b/c),b=b-c*f,e=e+Math.abs(f),g=this.repetitions-e;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time, +f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}};cd.prototype={constructor:cd,clipAction:function(a,b){var c=b||this._root,d=c.uuid,e="string"===typeof a?qa.findByName(c,a):a,c=null!==e?e.uuid:a,f=this._actionsByClip[c],g=null;if(void 0!==f){g=f.actionByRoot[d];if(void 0!==g)return g;g=f.knownActions[0];null===e&&(e=g._clip)}if(null===e)return null;e=new ne(this,e,b);this._bindAction(e, +g);this._addInactiveAction(e,c,d);return e},existingAction:function(a,b){var c=b||this._root,d=c.uuid,c="string"===typeof a?qa.findByName(c,a):a,c=this._actionsByClip[c?c.uuid:a];return void 0!==c?c.actionByRoot[d]||null:null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,e=this._nActiveBindings=this._nActiveActions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].useCount=0;return this},update:function(a){a*=this.timeScale;for(var b= +this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1,g=0;g!==c;++g){var h=b[g];h.enabled&&h._update(d,a,e,f)}a=this._bindings;b=this._nActiveBindings;for(g=0;g!==b;++g)a[g].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip,d=c[a];if(void 0!==d){for(var d=d.knownActions,e=0,f=d.length;e!==f;++e){var g=d[e];this._deactivateAction(g);var h=g._cacheIndex,l=b[b.length-1];g._cacheIndex= +null;g._byClipCacheIndex=null;l._cacheIndex=h;b[h]=l;b.pop();this._removeInactiveBindingsForAction(g)}delete c[a]}},uncacheRoot:function(a){a=a.uuid;var b=this._actionsByClip,c;for(c in b){var d=b[c].actionByRoot[a];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}c=this._bindingsByRootAndName[a];if(void 0!==c)for(var e in c)a=c[e],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){var c=this.existingAction(a,b);null!==c&&(this._deactivateAction(c), +this._removeInactiveAction(c))}};Object.assign(cd.prototype,{_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,h=c.uuid,l=this._bindingsByRootAndName,k=l[h];void 0===k&&(k={},l[h]=k);for(l=0;l!==e;++l){var q=d[l],p=q.name,n=k[p];if(void 0===n){n=f[l];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,h,p));continue}n=new Jd(ka.create(c,p,b&&b._propertyBindings[l].binding.parsedPath),q.ValueTypeName, +q.getValueSize());++n.referenceCount;this._addInactiveBinding(n,h,p)}f[l]=n;g[l].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b= +a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, +get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ah.end&&(h.end=f);c||(c=l)}}for(l in d)h=d[l],this.createAnimation(l,h.start,h.end,a);this.firstAnimation=c};oa.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};oa.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};oa.prototype.setAnimationFPS= +function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};oa.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};oa.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};oa.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};oa.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};oa.prototype.getAnimationDuration= +function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};oa.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")};oa.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};oa.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b +d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.start+N.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);d.currentFrame!== +d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=e*g,this.morphTargetInfluences[d.lastFrame]=(1-e)*g):this.morphTargetInfluences[d.currentFrame]=g}}};dd.prototype=Object.create(x.prototype);dd.prototype.constructor=dd;dd.prototype.isImmediateRenderObject=!0;ed.prototype=Object.create(ga.prototype);ed.prototype.constructor=ed;ed.prototype.update=function(){var a=new q,b=new q,c=new ya;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld); +var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,l=g.faces,k=g=0,q=l.length;kc.y?this.quaternion.set(1, +0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();Fb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};Fb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Nd.prototype=Object.create(ga.prototype);Nd.prototype.constructor=Nd;var Qd=new q, +ye=new ve,ze=new ve,Ae=new ve;va.prototype=Object.create(ua.prototype);va.prototype.constructor=va;va.prototype.getPoint=function(a){var b=this.points,c=b.length;2>c&&console.log("duh, you need at least 2 points");a*=c-(this.closed?0:1);var d=Math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1E-4>c&&(c=d);1E-4>h&&(h=d);ye.initNonuniformCatmullRom(e.x,f.x,g.x,b.x,c,d,h);ze.initNonuniformCatmullRom(e.y,f.y,g.y,b.y,c,d,h);Ae.initNonuniformCatmullRom(e.z,f.z,g.z,b.z,c,d,h)}else"catmullrom"===this.type&&(c=void 0!==this.tension?this.tension: +.5,ye.initCatmullRom(e.x,f.x,g.x,b.x,c),ze.initCatmullRom(e.y,f.y,g.y,b.y,c),Ae.initCatmullRom(e.z,f.z,g.z,b.z,c));return new q(ye.calc(a),ze.calc(a),Ae.calc(a))};id.prototype=Object.create(ua.prototype);id.prototype.constructor=id;id.prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new q(Bb(a,b.x,c.x,d.x,e.x),Bb(a,b.y,c.y,d.y,e.y),Bb(a,b.z,c.z,d.z,e.z))};jd.prototype=Object.create(ua.prototype);jd.prototype.constructor=jd;jd.prototype.getPoint=function(a){var b=this.v0, +c=this.v1,d=this.v2;return new q(Ab(a,b.x,c.x,d.x),Ab(a,b.y,c.y,d.y),Ab(a,b.z,c.z,d.z))};kd.prototype=Object.create(ua.prototype);kd.prototype.constructor=kd;kd.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var b=new q;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b};Od.prototype=Object.create(Wa.prototype);Od.prototype.constructor=Od;ua.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(ua.prototype);a.prototype.constructor= +a;a.prototype.getPoint=b;return a};Xe.prototype=Object.create(va.prototype);Ye.prototype=Object.create(va.prototype);we.prototype=Object.create(va.prototype);Object.assign(we.prototype,{initFromArray:function(a){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(a){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(a){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}); +fd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Object.assign(sc.prototype,{center:function(a){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."); +return this.intersectsBox(a)},size:function(a){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(Pa.prototype,{center:function(a){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."); +return this.intersectsBox(a)},isIntersectionSphere:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)},size:function(a){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(a)}});hb.prototype.center=function(a){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(a)};N.random16=function(){console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."); +return Math.random()};Object.assign(ya.prototype,{flattenToArrayOffset:function(a,b){console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,b)},multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."); +return this.applyToVector3Array(a)},applyToBuffer:function(a,b,c){console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,c){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(S.prototype,{extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(a)}, +flattenToArrayOffset:function(a,b){console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,b)},getPosition:function(){var a;return function(){void 0===a&&(a=new q);console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return a.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."); +return this.makeRotationFromQuaternion(a)},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."); +return this.applyToVector3Array(a)},rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")}, +rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(a,b,c){console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,c){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")}, +makeFrustum:function(a,b,c,d,e,f){console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.");return this.makePerspective(a,b,d,c,e,f)}});la.prototype.isIntersectionLine=function(a){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(a)};ca.prototype.multiplyVector3=function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."); +return a.applyQuaternion(this)};Object.assign(cb.prototype,{isIntersectionBox:function(a){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}}); +Object.assign(Db.prototype,{extrude:function(a){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.");return new La(this,a)},makeGeometry:function(a){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new Yb(this,a)}});Object.assign(D.prototype,{fromAttribute:function(a,b,c){console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,b,c)}});Object.assign(q.prototype, +{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."); +return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(b,a)},applyProjection:function(a){console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.");return this.applyMatrix4(a)},fromAttribute:function(a,b,c){console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a, +b,c)}});Object.assign(fa.prototype,{fromAttribute:function(a,b,c){console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,b,c)}});T.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")};Object.assign(x.prototype,{getChildByName:function(a){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}, +translate:function(a,b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)}});Object.defineProperties(x.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}, +set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.defineProperties(Ec.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Fa.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==b&&(this.filmGauge=b);this.setFocalLength(a)};Object.defineProperties(ma.prototype, +{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."); +this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=a}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}}, +shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");this.shadow.bias=a}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=a}}});Object.defineProperties(U.prototype, +{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead.");return this.array.length}}});Object.assign(I.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},addDrawCall:function(a,b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(a, +b)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().");this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(I.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."); +return this.groups}}});Object.defineProperties(Kd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.defineProperties(X.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+ +": .wrapAround has been removed.")}},wrapRGB:{get:function(){console.warn("THREE."+this.type+": .wrapRGB has been removed.");return new J}}});Object.defineProperties(Ca.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");return!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Ha.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."); +return this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});Object.assign(Yd.prototype,{supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."); +return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return this.extensions.get("WEBGL_compressed_texture_s3tc")}, +supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."); +return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}, +addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}});Object.defineProperties(Yd.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."); +this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");this.shadowMap.cullFace=a}}});Object.defineProperties(Ke.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+a+".");this.renderReverseSided=a}}});Object.defineProperties(Ya.prototype, +{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=a}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");return this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=a}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."); +return this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=a}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=a}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."); +return this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat}, +set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");this.texture.format=a}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."); +this.texture.type=a}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");this.texture.generateMipmaps=a}}});hc.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var b=this;(new ge).load(a,function(a){b.setBuffer(a)});return this}; +le.prototype.getData=function(){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");return this.getFrequencyData()};l.WebGLRenderTargetCube=Gb;l.WebGLRenderTarget=Ya;l.WebGLRenderer=Yd;l.ShaderLib=bb;l.UniformsLib=V;l.UniformsUtils=Ja;l.ShaderChunk=Z;l.FogExp2=Kb;l.Fog=Lb;l.Scene=mb;l.LensFlare=Zd;l.Sprite=Dc;l.LOD=Ec;l.SkinnedMesh=qd;l.Skeleton=od;l.Bone=pd;l.Mesh=Aa;l.LineSegments=ga;l.Line=Ua;l.Points=Mb;l.Group=Fc;l.VideoTexture=rd;l.DataTexture=eb;l.CompressedTexture= +Nb;l.CubeTexture=Za;l.CanvasTexture=sd;l.DepthTexture=Gc;l.Texture=ea;l.CompressedTextureLoader=Re;l.DataTextureLoader=ae;l.CubeTextureLoader=be;l.TextureLoader=td;l.ObjectLoader=Se;l.MaterialLoader=Hd;l.BufferGeometryLoader=ce;l.DefaultLoadingManager=ta;l.LoadingManager=$d;l.JSONLoader=de;l.ImageLoader=Yc;l.FontLoader=Ue;l.FileLoader=sa;l.Loader=zb;l.Cache=ld;l.AudioLoader=ge;l.SpotLightShadow=vd;l.SpotLight=wd;l.PointLight=xd;l.RectAreaLight=he;l.HemisphereLight=ud;l.DirectionalLightShadow=yd;l.DirectionalLight= +zd;l.AmbientLight=Ad;l.LightShadow=wb;l.Light=ma;l.StereoCamera=Ve;l.PerspectiveCamera=Fa;l.OrthographicCamera=Jb;l.CubeCamera=Id;l.Camera=ra;l.AudioListener=ie;l.PositionalAudio=ke;l.AudioContext=je;l.AudioAnalyser=le;l.Audio=hc;l.VectorKeyframeTrack=dc;l.StringKeyframeTrack=Ed;l.QuaternionKeyframeTrack=$c;l.NumberKeyframeTrack=ec;l.ColorKeyframeTrack=Gd;l.BooleanKeyframeTrack=Fd;l.PropertyMixer=Jd;l.PropertyBinding=ka;l.KeyframeTrack=yb;l.AnimationUtils=na;l.AnimationObjectGroup=me;l.AnimationMixer= +cd;l.AnimationClip=qa;l.Uniform=Kd;l.InstancedBufferGeometry=Eb;l.BufferGeometry=I;l.GeometryIdCount=function(){return Vd++};l.Geometry=T;l.InterleavedBufferAttribute=oe;l.InstancedInterleavedBuffer=jc;l.InterleavedBuffer=ic;l.InstancedBufferAttribute=kc;l.Face3=ha;l.Object3D=x;l.Raycaster=pe;l.Layers=nd;l.EventDispatcher=pa;l.Clock=re;l.QuaternionLinearInterpolant=Dd;l.LinearInterpolant=Zc;l.DiscreteInterpolant=Cd;l.CubicInterpolant=Bd;l.Interpolant=xa;l.Triangle=za;l.Math=N;l.Spherical=se;l.Cylindrical= +te;l.Plane=la;l.Frustum=tc;l.Sphere=Na;l.Ray=cb;l.Matrix4=S;l.Matrix3=ya;l.Box3=Pa;l.Box2=sc;l.Line3=hb;l.Euler=db;l.Vector4=fa;l.Vector3=q;l.Vector2=D;l.Quaternion=ca;l.Color=J;l.MorphBlendMesh=oa;l.ImmediateRenderObject=dd;l.VertexNormalsHelper=ed;l.SpotLightHelper=lc;l.SkeletonHelper=mc;l.PointLightHelper=nc;l.RectAreaLightHelper=oc;l.HemisphereLightHelper=pc;l.GridHelper=fd;l.PolarGridHelper=Ld;l.FaceNormalsHelper=gd;l.DirectionalLightHelper=qc;l.CameraHelper=hd;l.BoxHelper=rc;l.ArrowHelper=Fb; +l.AxisHelper=Nd;l.CatmullRomCurve3=va;l.CubicBezierCurve3=id;l.QuadraticBezierCurve3=jd;l.LineCurve3=kd;l.ArcCurve=Od;l.EllipseCurve=Wa;l.SplineCurve=Cb;l.CubicBezierCurve=fc;l.QuadraticBezierCurve=gc;l.LineCurve=Ta;l.Shape=Db;l.Path=bd;l.ShapePath=ee;l.Font=fe;l.CurvePath=ad;l.Curve=ua;l.ShapeUtils=Ia;l.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new Fc,d=0,e=b.length;d self.capabilities.maxLayers) { + reject(new Error('Invalid number of layers.')); + return; + } + + var incomingLayer = layers[0]; + if (!incomingLayer.source) { + /* + todo: figure out the correct behavior if the source is not provided. + see https://github.com/w3c/webvr/issues/58 + */ + resolve(); + return; + } + + var leftBounds = incomingLayer.leftBounds || defaultLeftBounds; + var rightBounds = incomingLayer.rightBounds || defaultRightBounds; + if (wasPresenting) { + // Already presenting, just changing configuration + var layer = self.layer_; + if (layer.source !== incomingLayer.source) { + layer.source = incomingLayer.source; + } + + for (var i = 0; i < 4; i++) { + if (layer.leftBounds[i] !== leftBounds[i]) { + layer.leftBounds[i] = leftBounds[i]; + } + if (layer.rightBounds[i] !== rightBounds[i]) { + layer.rightBounds[i] = rightBounds[i]; + } + } + + resolve(); + return; + } + + // Was not already presenting. + self.layer_ = { + predistorted: incomingLayer.predistorted, + source: incomingLayer.source, + leftBounds: leftBounds.slice(0), + rightBounds: rightBounds.slice(0) + }; + + self.waitingForPresent_ = false; + if (self.layer_ && self.layer_.source) { + var fullscreenElement = self.wrapForFullscreen(self.layer_.source); + + function onFullscreenChange() { + // Don't let another fullscreen request cause multiple presents to the called. + // This currently happens with the shaka player and results in a black screen. + if (self.fullscreenJustChanged) { + return; + } + self.fullscreenJustChanged = true; + setTimeout(function() { + self.fullscreenJustChanged = false; + }, 700); + + var actualFullscreenElement = Util.getFullscreenElement(); + + self.isPresenting = (fullscreenElement === actualFullscreenElement); + if (self.isPresenting) { + // Removing orientation lock as if seems to conflict with shaka player + // if (screen.orientation && screen.orientation.lock) { + // screen.orientation.lock('landscape-primary').catch(function(error){ + // console.error('screen.orientation.lock() failed due to', error.message) + // }); + // } + self.waitingForPresent_ = false; + self.beginPresent_(); + resolve(); + } else { + // if (screen.orientation && screen.orientation.unlock) { + // screen.orientation.unlock(); + // } + self.removeFullscreenWrapper(); + self.wakelock_.release(); + self.endPresent_(); + self.removeFullscreenListeners_(); + } + self.fireVRDisplayPresentChange_(); + } + function onFullscreenError() { + if (!self.waitingForPresent_) { + return; + } + + self.removeFullscreenWrapper(); + self.removeFullscreenListeners_(); + + self.wakelock_.release(); + self.waitingForPresent_ = false; + self.isPresenting = false; + + reject(new Error('Unable to present.')); + } + + self.addFullscreenListeners_(fullscreenElement, + onFullscreenChange, onFullscreenError); + + if (Util.requestFullscreen(fullscreenElement)) { + self.wakelock_.request(); + self.waitingForPresent_ = true; + } else if (Util.isIOS()) { + // *sigh* Just fake it. + self.wakelock_.request(); + self.isPresenting = true; + self.beginPresent_(); + self.fireVRDisplayPresentChange_(); + resolve(); + } + } + + if (!self.waitingForPresent_ && !Util.isIOS()) { + Util.exitFullscreen(); + reject(new Error('Unable to present.')); + } + }); +}; + +VRDisplay.prototype.exitPresent = function() { + var wasPresenting = this.isPresenting; + var self = this; + this.isPresenting = false; + this.layer_ = null; + this.wakelock_.release(); + + return new Promise(function(resolve, reject) { + if (wasPresenting) { + if (!Util.exitFullscreen() && Util.isIOS()) { + self.endPresent_(); + self.fireVRDisplayPresentChange_(); + } + + resolve(); + } else { + reject(new Error('Was not presenting to VRDisplay.')); + } + }); +}; + +VRDisplay.prototype.getLayers = function() { + if (this.layer_) { + return [this.layer_]; + } + return []; +}; + +VRDisplay.prototype.fireVRDisplayPresentChange_ = function() { + var event = new CustomEvent('vrdisplaypresentchange', {detail: {display: this}}); + window.dispatchEvent(event); +}; + +VRDisplay.prototype.addFullscreenListeners_ = function(element, changeHandler, errorHandler) { + this.removeFullscreenListeners_(); + + this.fullscreenEventTarget_ = element; + this.fullscreenChangeHandler_ = changeHandler; + this.fullscreenErrorHandler_ = errorHandler; + + if (changeHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenchange', changeHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenchange', changeHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenchange', changeHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenchange', changeHandler, false); + } + } + + if (errorHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenerror', errorHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenerror', errorHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenerror', errorHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenerror', errorHandler, false); + } + } +}; + +VRDisplay.prototype.removeFullscreenListeners_ = function() { + if (!this.fullscreenEventTarget_) + return; + + var element = this.fullscreenEventTarget_; + + if (this.fullscreenChangeHandler_) { + var changeHandler = this.fullscreenChangeHandler_; + element.removeEventListener('fullscreenchange', changeHandler, false); + element.removeEventListener('webkitfullscreenchange', changeHandler, false); + document.removeEventListener('mozfullscreenchange', changeHandler, false); + element.removeEventListener('msfullscreenchange', changeHandler, false); + } + + if (this.fullscreenErrorHandler_) { + var errorHandler = this.fullscreenErrorHandler_; + element.removeEventListener('fullscreenerror', errorHandler, false); + element.removeEventListener('webkitfullscreenerror', errorHandler, false); + document.removeEventListener('mozfullscreenerror', errorHandler, false); + element.removeEventListener('msfullscreenerror', errorHandler, false); + } + + this.fullscreenEventTarget_ = null; + this.fullscreenChangeHandler_ = null; + this.fullscreenErrorHandler_ = null; +}; + +VRDisplay.prototype.beginPresent_ = function() { + // Override to add custom behavior when presentation begins. +}; + +VRDisplay.prototype.endPresent_ = function() { + // Override to add custom behavior when presentation ends. +}; + +VRDisplay.prototype.submitFrame = function(pose) { + // Override to add custom behavior for frame submission. +}; + +VRDisplay.prototype.getEyeParameters = function(whichEye) { + // Override to return accurate eye parameters if canPresent is true. + return null; +}; + +/* + * Deprecated classes + */ + +/** + * The base class for all VR devices. (Deprecated) + */ +function VRDevice() { + this.isPolyfilled = true; + this.hardwareUnitId = 'webvr-polyfill hardwareUnitId'; + this.deviceId = 'webvr-polyfill deviceId'; + this.deviceName = 'webvr-polyfill deviceName'; +} + +/** + * The base class for all VR HMD devices. (Deprecated) + */ +function HMDVRDevice() { +} +HMDVRDevice.prototype = new VRDevice(); + +/** + * The base class for all VR position sensor devices. (Deprecated) + */ +function PositionSensorVRDevice() { +} +PositionSensorVRDevice.prototype = new VRDevice(); + +module.exports.VRFrameData = VRFrameData; +module.exports.VRDisplay = VRDisplay; +module.exports.VRDevice = VRDevice; +module.exports.HMDVRDevice = HMDVRDevice; +module.exports.PositionSensorVRDevice = PositionSensorVRDevice; + +},{"./util.js":22,"./wakelock.js":24}],4:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var CardboardUI = _dereq_('./cardboard-ui.js'); +var Util = _dereq_('./util.js'); +var WGLUPreserveGLState = _dereq_('./deps/wglu-preserve-state.js'); + +var distortionVS = [ + 'attribute vec2 position;', + 'attribute vec3 texCoord;', + + 'varying vec2 vTexCoord;', + + 'uniform vec4 viewportOffsetScale[2];', + + 'void main() {', + ' vec4 viewport = viewportOffsetScale[int(texCoord.z)];', + ' vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;', + ' gl_Position = vec4( position, 1.0, 1.0 );', + '}', +].join('\n'); + +var distortionFS = [ + 'precision mediump float;', + 'uniform sampler2D diffuse;', + + 'varying vec2 vTexCoord;', + + 'void main() {', + ' gl_FragColor = texture2D(diffuse, vTexCoord);', + '}', +].join('\n'); + +/** + * A mesh-based distorter. + */ +function CardboardDistorter(gl) { + this.gl = gl; + this.ctxAttribs = gl.getContextAttributes(); + + this.meshWidth = 20; + this.meshHeight = 20; + + this.bufferScale = WebVRConfig.BUFFER_SCALE; + + this.bufferWidth = gl.drawingBufferWidth; + this.bufferHeight = gl.drawingBufferHeight; + + // Patching support + this.realBindFramebuffer = gl.bindFramebuffer; + this.realEnable = gl.enable; + this.realDisable = gl.disable; + this.realColorMask = gl.colorMask; + this.realClearColor = gl.clearColor; + this.realViewport = gl.viewport; + + if (!Util.isIOS()) { + this.realCanvasWidth = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'width'); + this.realCanvasHeight = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'height'); + } + + this.isPatched = false; + + // State tracking + this.lastBoundFramebuffer = null; + this.cullFace = false; + this.depthTest = false; + this.blend = false; + this.scissorTest = false; + this.stencilTest = false; + this.viewport = [0, 0, 0, 0]; + this.colorMask = [true, true, true, true]; + this.clearColor = [0, 0, 0, 0]; + + this.attribs = { + position: 0, + texCoord: 1 + }; + this.program = Util.linkProgram(gl, distortionVS, distortionFS, this.attribs); + this.uniforms = Util.getProgramUniforms(gl, this.program); + + this.viewportOffsetScale = new Float32Array(8); + this.setTextureBounds(); + + this.vertexBuffer = gl.createBuffer(); + this.indexBuffer = gl.createBuffer(); + this.indexCount = 0; + + this.renderTarget = gl.createTexture(); + this.framebuffer = gl.createFramebuffer(); + + this.depthStencilBuffer = null; + this.depthBuffer = null; + this.stencilBuffer = null; + + if (this.ctxAttribs.depth && this.ctxAttribs.stencil) { + this.depthStencilBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.depth) { + this.depthBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.stencil) { + this.stencilBuffer = gl.createRenderbuffer(); + } + + this.patch(); + + this.onResize(); + + if (!WebVRConfig.CARDBOARD_UI_DISABLED) { + this.cardboardUI = new CardboardUI(gl); + } +}; + +/** + * Tears down all the resources created by the distorter and removes any + * patches. + */ +CardboardDistorter.prototype.destroy = function() { + var gl = this.gl; + + this.unpatch(); + + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); + gl.deleteBuffer(this.indexBuffer); + gl.deleteTexture(this.renderTarget); + gl.deleteFramebuffer(this.framebuffer); + if (this.depthStencilBuffer) { + gl.deleteRenderbuffer(this.depthStencilBuffer); + } + if (this.depthBuffer) { + gl.deleteRenderbuffer(this.depthBuffer); + } + if (this.stencilBuffer) { + gl.deleteRenderbuffer(this.stencilBuffer); + } + + if (this.cardboardUI) { + this.cardboardUI.destroy(); + } +}; + + +/** + * Resizes the backbuffer to match the canvas width and height. + */ +CardboardDistorter.prototype.onResize = function() { + var gl = this.gl; + var self = this; + + var glState = [ + gl.RENDERBUFFER_BINDING, + gl.TEXTURE_BINDING_2D, gl.TEXTURE0 + ]; + + WGLUPreserveGLState(gl, glState, function(gl) { + // Bind real backbuffer and clear it once. We don't need to clear it again + // after that because we're overwriting the same area every frame. + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + + // Put things in a good state + if (self.scissorTest) { self.realDisable.call(gl, gl.SCISSOR_TEST); } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + self.realClearColor.call(gl, 0, 0, 0, 1); + + gl.clear(gl.COLOR_BUFFER_BIT); + + // Now bind and resize the fake backbuffer + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.framebuffer); + + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + gl.texImage2D(gl.TEXTURE_2D, 0, self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, + self.bufferWidth, self.bufferHeight, 0, + self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, gl.UNSIGNED_BYTE, null); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, self.renderTarget, 0); + + if (self.ctxAttribs.depth && self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, + self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, + gl.RENDERBUFFER, self.depthStencilBuffer); + } else if (self.ctxAttribs.depth) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, + self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, + gl.RENDERBUFFER, self.depthBuffer); + } else if (self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.stencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.STENCIL_INDEX8, + self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, + gl.RENDERBUFFER, self.stencilBuffer); + } + + if (!gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE) { + console.error('Framebuffer incomplete!'); + } + + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + + if (self.scissorTest) { self.realEnable.call(gl, gl.SCISSOR_TEST); } + + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + self.realClearColor.apply(gl, self.clearColor); + }); + + if (this.cardboardUI) { + this.cardboardUI.onResize(); + } +}; + +CardboardDistorter.prototype.patch = function() { + if (this.isPatched) { + return; + } + + var self = this; + var canvas = this.gl.canvas; + var gl = this.gl; + + if (!Util.isIOS()) { + canvas.width = Util.getScreenWidth() * this.bufferScale; + canvas.height = Util.getScreenHeight() * this.bufferScale; + + Object.defineProperty(canvas, 'width', { + configurable: true, + enumerable: true, + get: function() { + return self.bufferWidth; + }, + set: function(value) { + self.bufferWidth = value; + self.realCanvasWidth.set.call(canvas, value); + self.onResize(); + } + }); + + Object.defineProperty(canvas, 'height', { + configurable: true, + enumerable: true, + get: function() { + return self.bufferHeight; + }, + set: function(value) { + self.bufferHeight = value; + self.realCanvasHeight.set.call(canvas, value); + self.onResize(); + } + }); + } + + this.lastBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + + if (this.lastBoundFramebuffer == null) { + this.lastBoundFramebuffer = this.framebuffer; + this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); + } + + this.gl.bindFramebuffer = function(target, framebuffer) { + self.lastBoundFramebuffer = framebuffer ? framebuffer : self.framebuffer; + // Silently make calls to bind the default framebuffer bind ours instead. + self.realBindFramebuffer.call(gl, target, self.lastBoundFramebuffer); + }; + + this.cullFace = gl.getParameter(gl.CULL_FACE); + this.depthTest = gl.getParameter(gl.DEPTH_TEST); + this.blend = gl.getParameter(gl.BLEND); + this.scissorTest = gl.getParameter(gl.SCISSOR_TEST); + this.stencilTest = gl.getParameter(gl.STENCIL_TEST); + + gl.enable = function(pname) { + switch (pname) { + case gl.CULL_FACE: self.cullFace = true; break; + case gl.DEPTH_TEST: self.depthTest = true; break; + case gl.BLEND: self.blend = true; break; + case gl.SCISSOR_TEST: self.scissorTest = true; break; + case gl.STENCIL_TEST: self.stencilTest = true; break; + } + self.realEnable.call(gl, pname); + }; + + gl.disable = function(pname) { + switch (pname) { + case gl.CULL_FACE: self.cullFace = false; break; + case gl.DEPTH_TEST: self.depthTest = false; break; + case gl.BLEND: self.blend = false; break; + case gl.SCISSOR_TEST: self.scissorTest = false; break; + case gl.STENCIL_TEST: self.stencilTest = false; break; + } + self.realDisable.call(gl, pname); + }; + + this.colorMask = gl.getParameter(gl.COLOR_WRITEMASK); + gl.colorMask = function(r, g, b, a) { + self.colorMask[0] = r; + self.colorMask[1] = g; + self.colorMask[2] = b; + self.colorMask[3] = a; + self.realColorMask.call(gl, r, g, b, a); + }; + + this.clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE); + gl.clearColor = function(r, g, b, a) { + self.clearColor[0] = r; + self.clearColor[1] = g; + self.clearColor[2] = b; + self.clearColor[3] = a; + self.realClearColor.call(gl, r, g, b, a); + }; + + this.viewport = gl.getParameter(gl.VIEWPORT); + gl.viewport = function(x, y, w, h) { + self.viewport[0] = x; + self.viewport[1] = y; + self.viewport[2] = w; + self.viewport[3] = h; + self.realViewport.call(gl, x, y, w, h); + }; + + this.isPatched = true; + Util.safariCssSizeWorkaround(canvas); +}; + +CardboardDistorter.prototype.unpatch = function() { + if (!this.isPatched) { + return; + } + + var gl = this.gl; + var canvas = this.gl.canvas; + + if (!Util.isIOS()) { + Object.defineProperty(canvas, 'width', this.realCanvasWidth); + Object.defineProperty(canvas, 'height', this.realCanvasHeight); + } + canvas.width = this.bufferWidth; + canvas.height = this.bufferHeight; + + gl.bindFramebuffer = this.realBindFramebuffer; + gl.enable = this.realEnable; + gl.disable = this.realDisable; + gl.colorMask = this.realColorMask; + gl.clearColor = this.realClearColor; + gl.viewport = this.realViewport; + + // Check to see if our fake backbuffer is bound and bind the real backbuffer + // if that's the case. + if (this.lastBoundFramebuffer == this.framebuffer) { + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + + this.isPatched = false; + + setTimeout(function() { + Util.safariCssSizeWorkaround(canvas); + }, 1); +}; + +CardboardDistorter.prototype.setTextureBounds = function(leftBounds, rightBounds) { + if (!leftBounds) { + leftBounds = [0, 0, 0.5, 1]; + } + + if (!rightBounds) { + rightBounds = [0.5, 0, 0.5, 1]; + } + + // Left eye + this.viewportOffsetScale[0] = leftBounds[0]; // X + this.viewportOffsetScale[1] = leftBounds[1]; // Y + this.viewportOffsetScale[2] = leftBounds[2]; // Width + this.viewportOffsetScale[3] = leftBounds[3]; // Height + + // Right eye + this.viewportOffsetScale[4] = rightBounds[0]; // X + this.viewportOffsetScale[5] = rightBounds[1]; // Y + this.viewportOffsetScale[6] = rightBounds[2]; // Width + this.viewportOffsetScale[7] = rightBounds[3]; // Height +}; + +/** + * Performs distortion pass on the injected backbuffer, rendering it to the real + * backbuffer. + */ +CardboardDistorter.prototype.submitFrame = function() { + var gl = this.gl; + var self = this; + + var glState = []; + + if (!WebVRConfig.DIRTY_SUBMIT_FRAME_BINDINGS) { + glState.push( + gl.CURRENT_PROGRAM, + gl.ARRAY_BUFFER_BINDING, + gl.ELEMENT_ARRAY_BUFFER_BINDING, + gl.TEXTURE_BINDING_2D, gl.TEXTURE0 + ); + } + + WGLUPreserveGLState(gl, glState, function(gl) { + // Bind the real default framebuffer + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + + // Make sure the GL state is in a good place + if (self.cullFace) { self.realDisable.call(gl, gl.CULL_FACE); } + if (self.depthTest) { self.realDisable.call(gl, gl.DEPTH_TEST); } + if (self.blend) { self.realDisable.call(gl, gl.BLEND); } + if (self.scissorTest) { self.realDisable.call(gl, gl.SCISSOR_TEST); } + if (self.stencilTest) { self.realDisable.call(gl, gl.STENCIL_TEST); } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + + // If the backbuffer has an alpha channel clear every frame so the page + // doesn't show through. + if (self.ctxAttribs.alpha || Util.isIOS()) { + self.realClearColor.call(gl, 0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + } + + // Bind distortion program and mesh + gl.useProgram(self.program); + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.enableVertexAttribArray(self.attribs.position); + gl.enableVertexAttribArray(self.attribs.texCoord); + gl.vertexAttribPointer(self.attribs.position, 2, gl.FLOAT, false, 20, 0); + gl.vertexAttribPointer(self.attribs.texCoord, 3, gl.FLOAT, false, 20, 8); + + gl.activeTexture(gl.TEXTURE0); + gl.uniform1i(self.uniforms.diffuse, 0); + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + + gl.uniform4fv(self.uniforms.viewportOffsetScale, self.viewportOffsetScale); + + // Draws both eyes + gl.drawElements(gl.TRIANGLES, self.indexCount, gl.UNSIGNED_SHORT, 0); + + if (self.cardboardUI) { + self.cardboardUI.renderNoState(); + } + + // Bind the fake default framebuffer again + self.realBindFramebuffer.call(self.gl, gl.FRAMEBUFFER, self.framebuffer); + + // If preserveDrawingBuffer == false clear the framebuffer + if (!self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.call(gl, 0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } + + if (!WebVRConfig.DIRTY_SUBMIT_FRAME_BINDINGS) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + } + + // Restore state + if (self.cullFace) { self.realEnable.call(gl, gl.CULL_FACE); } + if (self.depthTest) { self.realEnable.call(gl, gl.DEPTH_TEST); } + if (self.blend) { self.realEnable.call(gl, gl.BLEND); } + if (self.scissorTest) { self.realEnable.call(gl, gl.SCISSOR_TEST); } + if (self.stencilTest) { self.realEnable.call(gl, gl.STENCIL_TEST); } + + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + if (self.ctxAttribs.alpha || !self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.apply(gl, self.clearColor); + } + }); + + // Workaround for the fact that Safari doesn't allow us to patch the canvas + // width and height correctly. After each submit frame check to see what the + // real backbuffer size has been set to and resize the fake backbuffer size + // to match. + if (Util.isIOS()) { + var canvas = gl.canvas; + if (canvas.width != self.bufferWidth || canvas.height != self.bufferHeight) { + self.bufferWidth = canvas.width; + self.bufferHeight = canvas.height; + self.onResize(); + } + } +}; + +/** + * Call when the deviceInfo has changed. At this point we need + * to re-calculate the distortion mesh. + */ +CardboardDistorter.prototype.updateDeviceInfo = function(deviceInfo) { + var gl = this.gl; + var self = this; + + var glState = [gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING]; + WGLUPreserveGLState(gl, glState, function(gl) { + var vertices = self.computeMeshVertices_(self.meshWidth, self.meshHeight, deviceInfo); + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + + // Indices don't change based on device parameters, so only compute once. + if (!self.indexCount) { + var indices = self.computeMeshIndices_(self.meshWidth, self.meshHeight); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + self.indexCount = indices.length; + } + }); +}; + +/** + * Build the distortion mesh vertices. + * Based on code from the Unity cardboard plugin. + */ +CardboardDistorter.prototype.computeMeshVertices_ = function(width, height, deviceInfo) { + var vertices = new Float32Array(2 * width * height * 5); + + var lensFrustum = deviceInfo.getLeftEyeVisibleTanAngles(); + var noLensFrustum = deviceInfo.getLeftEyeNoLensTanAngles(); + var viewport = deviceInfo.getLeftEyeVisibleScreenRect(noLensFrustum); + var vidx = 0; + var iidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + var u = i / (width - 1); + var v = j / (height - 1); + + // Grid points regularly spaced in StreoScreen, and barrel distorted in + // the mesh. + var s = u; + var t = v; + var x = Util.lerp(lensFrustum[0], lensFrustum[2], u); + var y = Util.lerp(lensFrustum[3], lensFrustum[1], v); + var d = Math.sqrt(x * x + y * y); + var r = deviceInfo.distortion.distortInverse(d); + var p = x * r / d; + var q = y * r / d; + u = (p - noLensFrustum[0]) / (noLensFrustum[2] - noLensFrustum[0]); + v = (q - noLensFrustum[3]) / (noLensFrustum[1] - noLensFrustum[3]); + + // Convert u,v to mesh screen coordinates. + var aspect = deviceInfo.device.widthMeters / deviceInfo.device.heightMeters; + + // FIXME: The original Unity plugin multiplied U by the aspect ratio + // and didn't multiply either value by 2, but that seems to get it + // really close to correct looking for me. I hate this kind of "Don't + // know why it works" code though, and wold love a more logical + // explanation of what needs to happen here. + u = (viewport.x + u * viewport.width - 0.5) * 2.0; //* aspect; + v = (viewport.y + v * viewport.height - 0.5) * 2.0; + + vertices[(vidx * 5) + 0] = u; // position.x + vertices[(vidx * 5) + 1] = v; // position.y + vertices[(vidx * 5) + 2] = s; // texCoord.x + vertices[(vidx * 5) + 3] = t; // texCoord.y + vertices[(vidx * 5) + 4] = e; // texCoord.z (viewport index) + } + } + var w = lensFrustum[2] - lensFrustum[0]; + lensFrustum[0] = -(w + lensFrustum[0]); + lensFrustum[2] = w - lensFrustum[2]; + w = noLensFrustum[2] - noLensFrustum[0]; + noLensFrustum[0] = -(w + noLensFrustum[0]); + noLensFrustum[2] = w - noLensFrustum[2]; + viewport.x = 1 - (viewport.x + viewport.width); + } + return vertices; +} + +/** + * Build the distortion mesh indices. + * Based on code from the Unity cardboard plugin. + */ +CardboardDistorter.prototype.computeMeshIndices_ = function(width, height) { + var indices = new Uint16Array(2 * (width - 1) * (height - 1) * 6); + var halfwidth = width / 2; + var halfheight = height / 2; + var vidx = 0; + var iidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + if (i == 0 || j == 0) + continue; + // Build a quad. Lower right and upper left quadrants have quads with + // the triangle diagonal flipped to get the vignette to interpolate + // correctly. + if ((i <= halfwidth) == (j <= halfheight)) { + // Quad diagonal lower left to upper right. + indices[iidx++] = vidx; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx; + indices[iidx++] = vidx - 1; + } else { + // Quad diagonal upper left to lower right. + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width - 1; + } + } + } + } + return indices; +}; + +CardboardDistorter.prototype.getOwnPropertyDescriptor_ = function(proto, attrName) { + var descriptor = Object.getOwnPropertyDescriptor(proto, attrName); + // In some cases (ahem... Safari), the descriptor returns undefined get and + // set fields. In this case, we need to create a synthetic property + // descriptor. This works around some of the issues in + // https://github.com/borismus/webvr-polyfill/issues/46 + if (descriptor.get === undefined || descriptor.set === undefined) { + descriptor.configurable = true; + descriptor.enumerable = true; + descriptor.get = function() { + return this.getAttribute(attrName); + }; + descriptor.set = function(val) { + this.setAttribute(attrName, val); + }; + } + return descriptor; +}; + +module.exports = CardboardDistorter; + +},{"./cardboard-ui.js":5,"./deps/wglu-preserve-state.js":7,"./util.js":22}],5:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Util = _dereq_('./util.js'); +var WGLUPreserveGLState = _dereq_('./deps/wglu-preserve-state.js'); + +var uiVS = [ + 'attribute vec2 position;', + + 'uniform mat4 projectionMat;', + + 'void main() {', + ' gl_Position = projectionMat * vec4( position, -1.0, 1.0 );', + '}', +].join('\n'); + +var uiFS = [ + 'precision mediump float;', + + 'uniform vec4 color;', + + 'void main() {', + ' gl_FragColor = color;', + '}', +].join('\n'); + +var DEG2RAD = Math.PI/180.0; + +// The gear has 6 identical sections, each spanning 60 degrees. +var kAnglePerGearSection = 60; + +// Half-angle of the span of the outer rim. +var kOuterRimEndAngle = 12; + +// Angle between the middle of the outer rim and the start of the inner rim. +var kInnerRimBeginAngle = 20; + +// Distance from center to outer rim, normalized so that the entire model +// fits in a [-1, 1] x [-1, 1] square. +var kOuterRadius = 1; + +// Distance from center to depressed rim, in model units. +var kMiddleRadius = 0.75; + +// Radius of the inner hollow circle, in model units. +var kInnerRadius = 0.3125; + +// Center line thickness in DP. +var kCenterLineThicknessDp = 4; + +// Button width in DP. +var kButtonWidthDp = 28; + +// Factor to scale the touch area that responds to the touch. +var kTouchSlopFactor = 1.5; + +var Angles = [ + 0, kOuterRimEndAngle, kInnerRimBeginAngle, + kAnglePerGearSection - kInnerRimBeginAngle, + kAnglePerGearSection - kOuterRimEndAngle +]; + +/** + * Renders the alignment line and "options" gear. It is assumed that the canvas + * this is rendered into covers the entire screen (or close to it.) + */ +function CardboardUI(gl) { + this.gl = gl; + + this.attribs = { + position: 0 + }; + this.program = Util.linkProgram(gl, uiVS, uiFS, this.attribs); + this.uniforms = Util.getProgramUniforms(gl, this.program); + + this.vertexBuffer = gl.createBuffer(); + this.gearOffset = 0; + this.gearVertexCount = 0; + this.arrowOffset = 0; + this.arrowVertexCount = 0; + + this.projMat = new Float32Array(16); + + this.listener = null; + + this.onResize(); +}; + +/** + * Tears down all the resources created by the UI renderer. + */ +CardboardUI.prototype.destroy = function() { + var gl = this.gl; + + if (this.listener) { + gl.canvas.removeEventListener('click', this.listener, false); + } + + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); +}; + +/** + * Adds a listener to clicks on the gear and back icons + */ +CardboardUI.prototype.listen = function(optionsCallback, backCallback) { + var canvas = this.gl.canvas; + this.listener = function(event) { + var midline = canvas.clientWidth / 2; + // Double button size to circumvent address bar opeing when trying to close VR + var buttonSize = kButtonWidthDp * kTouchSlopFactor * 2; + // Check to see if the user clicked on (or around) the gear icon + if (event.clientX > midline - buttonSize && + event.clientX < midline + buttonSize && + event.clientY > canvas.clientHeight - buttonSize) { + optionsCallback(event); + } + // Check to see if the user clicked on (or around) the back icon + else if (event.clientX < buttonSize && event.clientY > canvas.clientHeight - buttonSize) { + backCallback(event); + } + }; + canvas.addEventListener('click', this.listener, false); +}; + +/** + * Builds the UI mesh. + */ +CardboardUI.prototype.onResize = function() { + var gl = this.gl; + var self = this; + + var glState = [ + gl.ARRAY_BUFFER_BINDING + ]; + + WGLUPreserveGLState(gl, glState, function(gl) { + var vertices = []; + + var midline = gl.drawingBufferWidth / 2; + + // Assumes your canvas width and height is scaled proportionately. + // TODO(smus): The following causes buttons to become huge on iOS, but seems + // like the right thing to do. For now, added a hack. But really, investigate why. + var dps = (gl.drawingBufferWidth / (screen.width * window.devicePixelRatio)); + if (!Util.isIOS()) { + dps *= window.devicePixelRatio; + } + + var lineWidth = kCenterLineThicknessDp * dps / 2; + var buttonSize = kButtonWidthDp * kTouchSlopFactor * dps; + var buttonScale = kButtonWidthDp * dps / 2; + var buttonBorder = ((kButtonWidthDp * kTouchSlopFactor) - kButtonWidthDp) * dps; + + // Build centerline + vertices.push(midline - lineWidth, buttonSize); + vertices.push(midline - lineWidth, gl.drawingBufferHeight); + vertices.push(midline + lineWidth, buttonSize); + vertices.push(midline + lineWidth, gl.drawingBufferHeight); + + // Build gear + self.gearOffset = (vertices.length / 2); + + function addGearSegment(theta, r) { + var angle = (90 - theta) * DEG2RAD; + var x = Math.cos(angle); + var y = Math.sin(angle); + vertices.push(kInnerRadius * x * buttonScale + midline, kInnerRadius * y * buttonScale + buttonScale); + vertices.push(r * x * buttonScale + midline, r * y * buttonScale + buttonScale); + } + + for (var i = 0; i <= 6; i++) { + var segmentTheta = i * kAnglePerGearSection; + + addGearSegment(segmentTheta, kOuterRadius); + addGearSegment(segmentTheta + kOuterRimEndAngle, kOuterRadius); + addGearSegment(segmentTheta + kInnerRimBeginAngle, kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kInnerRimBeginAngle), kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kOuterRimEndAngle), kOuterRadius); + } + + self.gearVertexCount = (vertices.length / 2) - self.gearOffset; + + // Build back arrow + self.arrowOffset = (vertices.length / 2); + + function addArrowVertex(x, y) { + vertices.push(buttonBorder + x, buttonBorder + y); + } + + var angledLineWidth = lineWidth / Math.sin(45 * DEG2RAD); + + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, 0); + addArrowVertex(buttonScale + angledLineWidth, angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale + angledLineWidth); + + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, buttonScale * 2); + addArrowVertex(buttonScale + angledLineWidth, (buttonScale * 2) - angledLineWidth); + + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + + addArrowVertex(angledLineWidth, buttonScale - lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale - lineWidth); + addArrowVertex(angledLineWidth, buttonScale + lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale + lineWidth); + + self.arrowVertexCount = (vertices.length / 2) - self.arrowOffset; + + // Buffer data + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + }); +}; + +/** + * Performs distortion pass on the injected backbuffer, rendering it to the real + * backbuffer. + */ +CardboardUI.prototype.render = function() { + var gl = this.gl; + var self = this; + + var glState = [ + gl.CULL_FACE, + gl.DEPTH_TEST, + gl.BLEND, + gl.SCISSOR_TEST, + gl.STENCIL_TEST, + gl.COLOR_WRITEMASK, + gl.VIEWPORT, + + gl.CURRENT_PROGRAM, + gl.ARRAY_BUFFER_BINDING + ]; + + WGLUPreserveGLState(gl, glState, function(gl) { + // Make sure the GL state is in a good place + gl.disable(gl.CULL_FACE); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + gl.disable(gl.SCISSOR_TEST); + gl.disable(gl.STENCIL_TEST); + gl.colorMask(true, true, true, true); + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + + self.renderNoState(); + }); +}; + +CardboardUI.prototype.renderNoState = function() { + var gl = this.gl; + + // Bind distortion program and mesh + gl.useProgram(this.program); + + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer); + gl.enableVertexAttribArray(this.attribs.position); + gl.vertexAttribPointer(this.attribs.position, 2, gl.FLOAT, false, 8, 0); + + gl.uniform4f(this.uniforms.color, 1.0, 1.0, 1.0, 1.0); + + Util.orthoMatrix(this.projMat, 0, gl.drawingBufferWidth, 0, gl.drawingBufferHeight, 0.1, 1024.0); + gl.uniformMatrix4fv(this.uniforms.projectionMat, false, this.projMat); + + // Draws UI element + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); + gl.drawArrays(gl.TRIANGLE_STRIP, this.gearOffset, this.gearVertexCount); + gl.drawArrays(gl.TRIANGLE_STRIP, this.arrowOffset, this.arrowVertexCount); +}; + +module.exports = CardboardUI; + +},{"./deps/wglu-preserve-state.js":7,"./util.js":22}],6:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var CardboardDistorter = _dereq_('./cardboard-distorter.js'); +var CardboardUI = _dereq_('./cardboard-ui.js'); +var DeviceInfo = _dereq_('./device-info.js'); +var Dpdb = _dereq_('./dpdb/dpdb.js'); +var FusionPoseSensor = _dereq_('./sensor-fusion/fusion-pose-sensor.js'); +var RotateInstructions = _dereq_('./rotate-instructions.js'); +var ViewerSelector = _dereq_('./viewer-selector.js'); +var VRDisplay = _dereq_('./base.js').VRDisplay; +var Util = _dereq_('./util.js'); + +var Eye = { + LEFT: 'left', + RIGHT: 'right' +}; + +/** + * VRDisplay based on mobile device parameters and DeviceMotion APIs. + */ +function CardboardVRDisplay() { + this.displayName = 'Cardboard VRDisplay (webvr-polyfill)'; + + this.capabilities.hasOrientation = true; + this.capabilities.canPresent = true; + + // "Private" members. + this.bufferScale_ = WebVRConfig.BUFFER_SCALE; + this.poseSensor_ = new FusionPoseSensor(); + this.distorter_ = null; + this.cardboardUI_ = null; + + this.dpdb_ = new Dpdb(true, this.onDeviceParamsUpdated_.bind(this)); + this.deviceInfo_ = new DeviceInfo(this.dpdb_.getDeviceParams()); + + this.viewerSelector_ = new ViewerSelector(); + this.viewerSelector_.on('change', this.onViewerChanged_.bind(this)); + + // Set the correct initial viewer. + this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()); + + if (!WebVRConfig.ROTATE_INSTRUCTIONS_DISABLED) { + this.rotateInstructions_ = new RotateInstructions(); + } + + if (Util.isIOS()) { + // Listen for resize events to workaround this awful Safari bug. + window.addEventListener('resize', this.onResize_.bind(this)); + } +} +CardboardVRDisplay.prototype = new VRDisplay(); + +CardboardVRDisplay.prototype.getImmediatePose = function() { + return { + position: this.poseSensor_.getPosition(), + orientation: this.poseSensor_.getOrientation(), + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; +}; + +CardboardVRDisplay.prototype.resetPose = function() { + this.poseSensor_.resetPose(); +}; + +CardboardVRDisplay.prototype.getEyeParameters = function(whichEye) { + var offset = [this.deviceInfo_.viewer.interLensDistance * 0.5, 0.0, 0.0]; + var fieldOfView; + + // TODO: FoV can be a little expensive to compute. Cache when device params change. + if (whichEye == Eye.LEFT) { + offset[0] *= -1.0; + fieldOfView = this.deviceInfo_.getFieldOfViewLeftEye(); + } else if (whichEye == Eye.RIGHT) { + fieldOfView = this.deviceInfo_.getFieldOfViewRightEye(); + } else { + console.error('Invalid eye provided: %s', whichEye); + return null; + } + + return { + fieldOfView: fieldOfView, + offset: offset, + // TODO: Should be able to provide better values than these. + renderWidth: this.deviceInfo_.device.width * 0.5 * this.bufferScale_, + renderHeight: this.deviceInfo_.device.height * this.bufferScale_, + }; +}; + +CardboardVRDisplay.prototype.onDeviceParamsUpdated_ = function(newParams) { + if (Util.isDebug()) { + console.log('DPDB reported that device params were updated.'); + } + this.deviceInfo_.updateDeviceParams(newParams); + + if (this.distorter_) { + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } +}; + +CardboardVRDisplay.prototype.updateBounds_ = function () { + if (this.layer_ && this.distorter_ && (this.layer_.leftBounds || this.layer_.rightBounds)) { + this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds); + } +}; + +CardboardVRDisplay.prototype.beginPresent_ = function() { + var gl = this.layer_.source.getContext('webgl'); + if (!gl) + gl = this.layer_.source.getContext('experimental-webgl'); + if (!gl) + gl = this.layer_.source.getContext('webgl2'); + + if (!gl) + return; // Can't do distortion without a WebGL context. + + // Provides a way to opt out of distortion + if (this.layer_.predistorted) { + if (!WebVRConfig.CARDBOARD_UI_DISABLED) { + gl.canvas.width = Util.getScreenWidth() * this.bufferScale_; + gl.canvas.height = Util.getScreenHeight() * this.bufferScale_; + this.cardboardUI_ = new CardboardUI(gl); + } + } else { + // Create a new distorter for the target context + this.distorter_ = new CardboardDistorter(gl); + this.distorter_.updateDeviceInfo(this.deviceInfo_); + this.cardboardUI_ = this.distorter_.cardboardUI; + } + + if (this.cardboardUI_) { + this.cardboardUI_.listen(function(e) { + // Options clicked. + this.viewerSelector_.show(this.layer_.source.parentElement); + e.stopPropagation(); + e.preventDefault(); + }.bind(this), function(e) { + // Back clicked. + this.exitPresent(); + e.stopPropagation(); + e.preventDefault(); + }.bind(this)); + } + + if (this.rotateInstructions_) { + if (Util.isLandscapeMode() && Util.isMobile()) { + // In landscape mode, temporarily show the "put into Cardboard" + // interstitial. Otherwise, do the default thing. + this.rotateInstructions_.showTemporarily(3000, this.layer_.source.parentElement); + } else { + this.rotateInstructions_.update(); + } + } + + // Listen for orientation change events in order to show interstitial. + this.orientationHandler = this.onOrientationChange_.bind(this); + window.addEventListener('orientationchange', this.orientationHandler); + + // Listen for present display change events in order to update distorter dimensions + this.vrdisplaypresentchangeHandler = this.updateBounds_.bind(this); + window.addEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); + + // Fire this event initially, to give geometry-distortion clients the chance + // to do something custom. + this.fireVRDisplayDeviceParamsChange_(); +}; + +CardboardVRDisplay.prototype.endPresent_ = function() { + if (this.distorter_) { + this.distorter_.destroy(); + this.distorter_ = null; + } + if (this.cardboardUI_) { + this.cardboardUI_.destroy(); + this.cardboardUI_ = null; + } + + if (this.rotateInstructions_) { + this.rotateInstructions_.hide(); + } + this.viewerSelector_.hide(); + + window.removeEventListener('orientationchange', this.orientationHandler); + window.removeEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); +}; + +CardboardVRDisplay.prototype.submitFrame = function(pose) { + if (this.distorter_) { + this.distorter_.submitFrame(); + } else if (this.cardboardUI_ && this.layer_) { + // Hack for predistorted: true. + var canvas = this.layer_.source.getContext('webgl').canvas; + if (canvas.width != this.lastWidth || canvas.height != this.lastHeight) { + this.cardboardUI_.onResize(); + } + this.lastWidth = canvas.width; + this.lastHeight = canvas.height; + + // Render the Cardboard UI. + this.cardboardUI_.render(); + } +}; + +CardboardVRDisplay.prototype.onOrientationChange_ = function(e) { + // Hide the viewer selector. + this.viewerSelector_.hide(); + + // Update the rotate instructions. + if (this.rotateInstructions_) { + this.rotateInstructions_.update(); + } + + this.onResize_(); +}; + +CardboardVRDisplay.prototype.onResize_ = function(e) { + if (this.layer_) { + var gl = this.layer_.source.getContext('webgl'); + // Size the CSS canvas. + // Added padding on right and bottom because iPhone 5 will not + // hide the URL bar unless content is bigger than the screen. + // This will not be visible as long as the container element (e.g. body) + // is set to 'overflow: hidden'. + var cssProperties = { + 'position': 'absolute', + 'top': '0', + 'left': '0', + 'width': Math.max(screen.width, screen.height) + 'px', + 'height': Math.min(screen.height, screen.width) + 'px', + 'border': '0', + 'margin': '0', + 'padding': '0 10px 10px 0', + }; + + for (var i in cssProperties) { + gl.canvas.style[i] = cssProperties[i]; + } + + Util.safariCssSizeWorkaround(gl.canvas); + } +}; + +CardboardVRDisplay.prototype.onViewerChanged_ = function(viewer) { + this.deviceInfo_.setViewer(viewer); + + if (this.distorter_) { + // Update the distortion appropriately. + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } + + // Fire a new event containing viewer and device parameters for clients that + // want to implement their own geometry-based distortion. + this.fireVRDisplayDeviceParamsChange_(); +}; + +CardboardVRDisplay.prototype.fireVRDisplayDeviceParamsChange_ = function() { + var event = new CustomEvent('vrdisplaydeviceparamschange', { + detail: { + vrdisplay: this, + deviceInfo: this.deviceInfo_, + } + }); + window.dispatchEvent(event); +}; + +module.exports = CardboardVRDisplay; + +},{"./base.js":3,"./cardboard-distorter.js":4,"./cardboard-ui.js":5,"./device-info.js":8,"./dpdb/dpdb.js":12,"./rotate-instructions.js":16,"./sensor-fusion/fusion-pose-sensor.js":18,"./util.js":22,"./viewer-selector.js":23}],7:[function(_dereq_,module,exports){ +/* +Copyright (c) 2016, Brandon Jones. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* +Caches specified GL state, runs a callback, and restores the cached state when +done. + +Example usage: + +var savedState = [ + gl.ARRAY_BUFFER_BINDING, + + // TEXTURE_BINDING_2D or _CUBE_MAP must always be followed by the texure unit. + gl.TEXTURE_BINDING_2D, gl.TEXTURE0, + + gl.CLEAR_COLOR, +]; +// After this call the array buffer, texture unit 0, active texture, and clear +// color will be restored. The viewport will remain changed, however, because +// gl.VIEWPORT was not included in the savedState list. +WGLUPreserveGLState(gl, savedState, function(gl) { + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, ....); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, ...); + + gl.clearColor(1, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); +}); + +Note that this is not intended to be fast. Managing state in your own code to +avoid redundant state setting and querying will always be faster. This function +is most useful for cases where you may not have full control over the WebGL +calls being made, such as tooling or effect injectors. +*/ + +function WGLUPreserveGLState(gl, bindings, callback) { + if (!bindings) { + callback(gl); + return; + } + + var boundValues = []; + + var activeTexture = null; + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + switch (binding) { + case gl.TEXTURE_BINDING_2D: + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) { + console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"); + boundValues.push(null, null); + break; + } + if (!activeTexture) { + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + } + gl.activeTexture(textureUnit); + boundValues.push(gl.getParameter(binding), null); + break; + case gl.ACTIVE_TEXTURE: + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + boundValues.push(null); + break; + default: + boundValues.push(gl.getParameter(binding)); + break; + } + } + + callback(gl); + + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + var boundValue = boundValues[i]; + switch (binding) { + case gl.ACTIVE_TEXTURE: + break; // Ignore this binding, since we special-case it to happen last. + case gl.ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ARRAY_BUFFER, boundValue); + break; + case gl.COLOR_CLEAR_VALUE: + gl.clearColor(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.COLOR_WRITEMASK: + gl.colorMask(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.CURRENT_PROGRAM: + gl.useProgram(boundValue); + break; + case gl.ELEMENT_ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, boundValue); + break; + case gl.FRAMEBUFFER_BINDING: + gl.bindFramebuffer(gl.FRAMEBUFFER, boundValue); + break; + case gl.RENDERBUFFER_BINDING: + gl.bindRenderbuffer(gl.RENDERBUFFER, boundValue); + break; + case gl.TEXTURE_BINDING_2D: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_2D, boundValue); + break; + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, boundValue); + break; + case gl.VIEWPORT: + gl.viewport(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.BLEND: + case gl.CULL_FACE: + case gl.DEPTH_TEST: + case gl.SCISSOR_TEST: + case gl.STENCIL_TEST: + if (boundValue) { + gl.enable(binding); + } else { + gl.disable(binding); + } + break; + default: + console.log("No GL restore behavior for 0x" + binding.toString(16)); + break; + } + + if (activeTexture) { + gl.activeTexture(activeTexture); + } + } +} + +module.exports = WGLUPreserveGLState; +},{}],8:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Distortion = _dereq_('./distortion/distortion.js'); +var MathUtil = _dereq_('./math-util.js'); +var Util = _dereq_('./util.js'); + +function Device(params) { + this.width = params.width || Util.getScreenWidth(); + this.height = params.height || Util.getScreenHeight(); + this.widthMeters = params.widthMeters; + this.heightMeters = params.heightMeters; + this.bevelMeters = params.bevelMeters; +} + + +// Fallback Android device (based on Nexus 5 measurements) for use when +// we can't recognize an Android device. +var DEFAULT_ANDROID = new Device({ + widthMeters: 0.110, + heightMeters: 0.062, + bevelMeters: 0.004 +}); + +// Fallback iOS device (based on iPhone6) for use when +// we can't recognize an Android device. +var DEFAULT_IOS = new Device({ + widthMeters: 0.1038, + heightMeters: 0.0584, + bevelMeters: 0.004 +}); + + +var Viewers = { + CardboardV1: new CardboardViewer({ + id: 'CardboardV1', + label: 'Cardboard I/O 2014', + fov: 40, + interLensDistance: 0.060, + baselineLensDistance: 0.035, + screenLensDistance: 0.042, + distortionCoefficients: [0.441, 0.156], + inverseCoefficients: [-0.4410035, 0.42756155, -0.4804439, 0.5460139, + -0.58821183, 0.5733938, -0.48303202, 0.33299083, -0.17573841, + 0.0651772, -0.01488963, 0.001559834] + }), + CardboardV2: new CardboardViewer({ + id: 'CardboardV2', + label: 'Cardboard I/O 2015', + fov: 60, + interLensDistance: 0.064, + baselineLensDistance: 0.035, + screenLensDistance: 0.039, + distortionCoefficients: [0.34, 0.55], + inverseCoefficients: [-0.33836704, -0.18162185, 0.862655, -1.2462051, + 1.0560602, -0.58208317, 0.21609078, -0.05444823, 0.009177956, + -9.904169E-4, 6.183535E-5, -1.6981803E-6] + }) +}; + + +var DEFAULT_LEFT_CENTER = {x: 0.5, y: 0.5}; +var DEFAULT_RIGHT_CENTER = {x: 0.5, y: 0.5}; + +/** + * Manages information about the device and the viewer. + * + * deviceParams indicates the parameters of the device to use (generally + * obtained from dpdb.getDeviceParams()). Can be null to mean no device + * params were found. + */ +function DeviceInfo(deviceParams) { + this.viewer = Viewers.CardboardV2; + this.updateDeviceParams(deviceParams); + this.distortion = new Distortion(this.viewer.distortionCoefficients); +} + +DeviceInfo.prototype.updateDeviceParams = function(deviceParams) { + this.device = this.determineDevice_(deviceParams) || this.device; +}; + +DeviceInfo.prototype.getDevice = function() { + return this.device; +}; + +DeviceInfo.prototype.setViewer = function(viewer) { + this.viewer = viewer; + this.distortion = new Distortion(this.viewer.distortionCoefficients); +}; + +DeviceInfo.prototype.determineDevice_ = function(deviceParams) { + if (!deviceParams) { + // No parameters, so use a default. + if (Util.isIOS()) { + console.warn('Using fallback iOS device measurements.'); + return DEFAULT_IOS; + } else { + console.warn('Using fallback Android device measurements.'); + return DEFAULT_ANDROID; + } + } + + // Compute device screen dimensions based on deviceParams. + var METERS_PER_INCH = 0.0254; + var metersPerPixelX = METERS_PER_INCH / deviceParams.xdpi; + var metersPerPixelY = METERS_PER_INCH / deviceParams.ydpi; + var width = Util.getScreenWidth(); + var height = Util.getScreenHeight(); + return new Device({ + widthMeters: metersPerPixelX * width, + heightMeters: metersPerPixelY * height, + bevelMeters: deviceParams.bevelMm * 0.001, + }); +}; + +/** + * Calculates field of view for the left eye. + */ +DeviceInfo.prototype.getDistortedFieldOfViewLeftEye = function() { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + + // Device.height and device.width for device in portrait mode, so transpose. + var eyeToScreenDistance = viewer.screenLensDistance; + + var outerDist = (device.widthMeters - viewer.interLensDistance) / 2; + var innerDist = viewer.interLensDistance / 2; + var bottomDist = viewer.baselineLensDistance - device.bevelMeters; + var topDist = device.heightMeters - bottomDist; + + var outerAngle = MathUtil.radToDeg * Math.atan( + distortion.distort(outerDist / eyeToScreenDistance)); + var innerAngle = MathUtil.radToDeg * Math.atan( + distortion.distort(innerDist / eyeToScreenDistance)); + var bottomAngle = MathUtil.radToDeg * Math.atan( + distortion.distort(bottomDist / eyeToScreenDistance)); + var topAngle = MathUtil.radToDeg * Math.atan( + distortion.distort(topDist / eyeToScreenDistance)); + + return { + leftDegrees: Math.min(outerAngle, viewer.fov), + rightDegrees: Math.min(innerAngle, viewer.fov), + downDegrees: Math.min(bottomAngle, viewer.fov), + upDegrees: Math.min(topAngle, viewer.fov) + }; +}; + +/** + * Calculates the tan-angles from the maximum FOV for the left eye for the + * current device and screen parameters. + */ +DeviceInfo.prototype.getLeftEyeVisibleTanAngles = function() { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + + // Tan-angles from the max FOV. + var fovLeft = Math.tan(-MathUtil.degToRad * viewer.fov); + var fovTop = Math.tan(MathUtil.degToRad * viewer.fov); + var fovRight = Math.tan(MathUtil.degToRad * viewer.fov); + var fovBottom = Math.tan(-MathUtil.degToRad * viewer.fov); + // Viewport size. + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + // Viewport center, measured from left lens position. + var verticalLensOffset = (viewer.baselineLensDistance - device.bevelMeters - halfHeight); + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + // Tan-angles of the viewport edges, as seen through the lens. + var screenLeft = distortion.distort((centerX - halfWidth) / centerZ); + var screenTop = distortion.distort((centerY + halfHeight) / centerZ); + var screenRight = distortion.distort((centerX + halfWidth) / centerZ); + var screenBottom = distortion.distort((centerY - halfHeight) / centerZ); + // Compare the two sets of tan-angles and take the value closer to zero on each side. + var result = new Float32Array(4); + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; + +/** + * Calculates the tan-angles from the maximum FOV for the left eye for the + * current device and screen parameters, assuming no lenses. + */ +DeviceInfo.prototype.getLeftEyeNoLensTanAngles = function() { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + + var result = new Float32Array(4); + // Tan-angles from the max FOV. + var fovLeft = distortion.distortInverse(Math.tan(-MathUtil.degToRad * viewer.fov)); + var fovTop = distortion.distortInverse(Math.tan(MathUtil.degToRad * viewer.fov)); + var fovRight = distortion.distortInverse(Math.tan(MathUtil.degToRad * viewer.fov)); + var fovBottom = distortion.distortInverse(Math.tan(-MathUtil.degToRad * viewer.fov)); + // Viewport size. + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + // Viewport center, measured from left lens position. + var verticalLensOffset = (viewer.baselineLensDistance - device.bevelMeters - halfHeight); + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + // Tan-angles of the viewport edges, as seen through the lens. + var screenLeft = (centerX - halfWidth) / centerZ; + var screenTop = (centerY + halfHeight) / centerZ; + var screenRight = (centerX + halfWidth) / centerZ; + var screenBottom = (centerY - halfHeight) / centerZ; + // Compare the two sets of tan-angles and take the value closer to zero on each side. + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; + +/** + * Calculates the screen rectangle visible from the left eye for the + * current device and screen parameters. + */ +DeviceInfo.prototype.getLeftEyeVisibleScreenRect = function(undistortedFrustum) { + var viewer = this.viewer; + var device = this.device; + + var dist = viewer.screenLensDistance; + var eyeX = (device.widthMeters - viewer.interLensDistance) / 2; + var eyeY = viewer.baselineLensDistance - device.bevelMeters; + var left = (undistortedFrustum[0] * dist + eyeX) / device.widthMeters; + var top = (undistortedFrustum[1] * dist + eyeY) / device.heightMeters; + var right = (undistortedFrustum[2] * dist + eyeX) / device.widthMeters; + var bottom = (undistortedFrustum[3] * dist + eyeY) / device.heightMeters; + return { + x: left, + y: bottom, + width: right - left, + height: top - bottom + }; +}; + +DeviceInfo.prototype.getFieldOfViewLeftEye = function(opt_isUndistorted) { + return opt_isUndistorted ? this.getUndistortedFieldOfViewLeftEye() : + this.getDistortedFieldOfViewLeftEye(); +}; + +DeviceInfo.prototype.getFieldOfViewRightEye = function(opt_isUndistorted) { + var fov = this.getFieldOfViewLeftEye(opt_isUndistorted); + return { + leftDegrees: fov.rightDegrees, + rightDegrees: fov.leftDegrees, + upDegrees: fov.upDegrees, + downDegrees: fov.downDegrees + }; +}; + +/** + * Calculates undistorted field of view for the left eye. + */ +DeviceInfo.prototype.getUndistortedFieldOfViewLeftEye = function() { + var p = this.getUndistortedParams_(); + + return { + leftDegrees: MathUtil.radToDeg * Math.atan(p.outerDist), + rightDegrees: MathUtil.radToDeg * Math.atan(p.innerDist), + downDegrees: MathUtil.radToDeg * Math.atan(p.bottomDist), + upDegrees: MathUtil.radToDeg * Math.atan(p.topDist) + }; +}; + +DeviceInfo.prototype.getUndistortedViewportLeftEye = function() { + var p = this.getUndistortedParams_(); + var viewer = this.viewer; + var device = this.device; + + // Distances stored in local variables are in tan-angle units unless otherwise + // noted. + var eyeToScreenDistance = viewer.screenLensDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + var xPxPerTanAngle = device.width / screenWidth; + var yPxPerTanAngle = device.height / screenHeight; + + var x = Math.round((p.eyePosX - p.outerDist) * xPxPerTanAngle); + var y = Math.round((p.eyePosY - p.bottomDist) * yPxPerTanAngle); + return { + x: x, + y: y, + width: Math.round((p.eyePosX + p.innerDist) * xPxPerTanAngle) - x, + height: Math.round((p.eyePosY + p.topDist) * yPxPerTanAngle) - y + }; +}; + +DeviceInfo.prototype.getUndistortedParams_ = function() { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + + // Most of these variables in tan-angle units. + var eyeToScreenDistance = viewer.screenLensDistance; + var halfLensDistance = viewer.interLensDistance / 2 / eyeToScreenDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + + var eyePosX = screenWidth / 2 - halfLensDistance; + var eyePosY = (viewer.baselineLensDistance - device.bevelMeters) / eyeToScreenDistance; + + var maxFov = viewer.fov; + var viewerMax = distortion.distortInverse(Math.tan(MathUtil.degToRad * maxFov)); + var outerDist = Math.min(eyePosX, viewerMax); + var innerDist = Math.min(halfLensDistance, viewerMax); + var bottomDist = Math.min(eyePosY, viewerMax); + var topDist = Math.min(screenHeight - eyePosY, viewerMax); + + return { + outerDist: outerDist, + innerDist: innerDist, + topDist: topDist, + bottomDist: bottomDist, + eyePosX: eyePosX, + eyePosY: eyePosY + }; +}; + + +function CardboardViewer(params) { + // A machine readable ID. + this.id = params.id; + // A human readable label. + this.label = params.label; + + // Field of view in degrees (per side). + this.fov = params.fov; + + // Distance between lens centers in meters. + this.interLensDistance = params.interLensDistance; + // Distance between viewer baseline and lens center in meters. + this.baselineLensDistance = params.baselineLensDistance; + // Screen-to-lens distance in meters. + this.screenLensDistance = params.screenLensDistance; + + // Distortion coefficients. + this.distortionCoefficients = params.distortionCoefficients; + // Inverse distortion coefficients. + // TODO: Calculate these from distortionCoefficients in the future. + this.inverseCoefficients = params.inverseCoefficients; +} + +// Export viewer information. +DeviceInfo.Viewers = Viewers; +module.exports = DeviceInfo; + +},{"./distortion/distortion.js":10,"./math-util.js":14,"./util.js":22}],9:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var VRDisplay = _dereq_('./base.js').VRDisplay; +var HMDVRDevice = _dereq_('./base.js').HMDVRDevice; +var PositionSensorVRDevice = _dereq_('./base.js').PositionSensorVRDevice; + +/** + * Wraps a VRDisplay and exposes it as a HMDVRDevice + */ +function VRDisplayHMDDevice(display) { + this.display = display; + + this.hardwareUnitId = display.displayId; + this.deviceId = 'webvr-polyfill:HMD:' + display.displayId; + this.deviceName = display.displayName + ' (HMD)'; +} +VRDisplayHMDDevice.prototype = new HMDVRDevice(); + +VRDisplayHMDDevice.prototype.getEyeParameters = function(whichEye) { + var eyeParameters = this.display.getEyeParameters(whichEye); + + return { + currentFieldOfView: eyeParameters.fieldOfView, + maximumFieldOfView: eyeParameters.fieldOfView, + minimumFieldOfView: eyeParameters.fieldOfView, + recommendedFieldOfView: eyeParameters.fieldOfView, + eyeTranslation: { x: eyeParameters.offset[0], y: eyeParameters.offset[1], z: eyeParameters.offset[2] }, + renderRect: { + x: (whichEye == 'right') ? eyeParameters.renderWidth : 0, + y: 0, + width: eyeParameters.renderWidth, + height: eyeParameters.renderHeight + } + }; +}; + +VRDisplayHMDDevice.prototype.setFieldOfView = + function(opt_fovLeft, opt_fovRight, opt_zNear, opt_zFar) { + // Not supported. getEyeParameters reports that the min, max, and recommended + // FoV is all the same, so no adjustment can be made. +}; + +// TODO: Need to hook requestFullscreen to see if a wrapped VRDisplay was passed +// in as an option. If so we should prevent the default fullscreen behavior and +// call VRDisplay.requestPresent instead. + +/** + * Wraps a VRDisplay and exposes it as a PositionSensorVRDevice + */ +function VRDisplayPositionSensorDevice(display) { + this.display = display; + + this.hardwareUnitId = display.displayId; + this.deviceId = 'webvr-polyfill:PositionSensor: ' + display.displayId; + this.deviceName = display.displayName + ' (PositionSensor)'; +} +VRDisplayPositionSensorDevice.prototype = new PositionSensorVRDevice(); + +VRDisplayPositionSensorDevice.prototype.getState = function() { + var pose = this.display.getPose(); + return { + position: pose.position ? { x: pose.position[0], y: pose.position[1], z: pose.position[2] } : null, + orientation: pose.orientation ? { x: pose.orientation[0], y: pose.orientation[1], z: pose.orientation[2], w: pose.orientation[3] } : null, + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; +}; + +VRDisplayPositionSensorDevice.prototype.resetState = function() { + return this.positionDevice.resetPose(); +}; + + +module.exports.VRDisplayHMDDevice = VRDisplayHMDDevice; +module.exports.VRDisplayPositionSensorDevice = VRDisplayPositionSensorDevice; + + +},{"./base.js":3}],10:[function(_dereq_,module,exports){ +/** + * TODO(smus): Implement coefficient inversion. + */ +function Distortion(coefficients) { + this.coefficients = coefficients; +} + +/** + * Calculates the inverse distortion for a radius. + *

+ * Allows to compute the original undistorted radius from a distorted one. + * See also getApproximateInverseDistortion() for a faster but potentially + * less accurate method. + * + * @param {Number} radius Distorted radius from the lens center in tan-angle units. + * @return {Number} The undistorted radius in tan-angle units. + */ +Distortion.prototype.distortInverse = function(radius) { + // Secant method. + var r0 = 0; + var r1 = 1; + var dr0 = radius - this.distort(r0); + while (Math.abs(r1 - r0) > 0.0001 /** 0.1mm */) { + var dr1 = radius - this.distort(r1); + var r2 = r1 - dr1 * ((r1 - r0) / (dr1 - dr0)); + r0 = r1; + r1 = r2; + dr0 = dr1; + } + return r1; +}; + +/** + * Distorts a radius by its distortion factor from the center of the lenses. + * + * @param {Number} radius Radius from the lens center in tan-angle units. + * @return {Number} The distorted radius in tan-angle units. + */ +Distortion.prototype.distort = function(radius) { + var r2 = radius * radius; + var ret = 0; + for (var i = 0; i < this.coefficients.length; i++) { + ret = r2 * (ret + this.coefficients[i]); + } + return (ret + 1) * radius; +}; + +// Functions below roughly ported from +// https://github.com/googlesamples/cardboard-unity/blob/master/Cardboard/Scripts/CardboardProfile.cs#L412 + +// Solves a small linear equation via destructive gaussian +// elimination and back substitution. This isn't generic numeric +// code, it's just a quick hack to work with the generally +// well-behaved symmetric matrices for least-squares fitting. +// Not intended for reuse. +// +// @param a Input positive definite symmetrical matrix. Destroyed +// during calculation. +// @param y Input right-hand-side values. Destroyed during calculation. +// @return Resulting x value vector. +// +Distortion.prototype.solveLinear_ = function(a, y) { + var n = a.length; + + // Gaussian elimination (no row exchange) to triangular matrix. + // The input matrix is a A^T A product which should be a positive + // definite symmetrical matrix, and if I remember my linear + // algebra right this implies that the pivots will be nonzero and + // calculations sufficiently accurate without needing row + // exchange. + for (var j = 0; j < n - 1; ++j) { + for (var k = j + 1; k < n; ++k) { + var p = a[j][k] / a[j][j]; + for (var i = j + 1; i < n; ++i) { + a[i][k] -= p * a[i][j]; + } + y[k] -= p * y[j]; + } + } + // From this point on, only the matrix elements a[j][i] with i>=j are + // valid. The elimination doesn't fill in eliminated 0 values. + + var x = new Array(n); + + // Back substitution. + for (var j = n - 1; j >= 0; --j) { + var v = y[j]; + for (var i = j + 1; i < n; ++i) { + v -= a[i][j] * x[i]; + } + x[j] = v / a[j][j]; + } + + return x; +}; + +// Solves a least-squares matrix equation. Given the equation A * x = y, calculate the +// least-square fit x = inverse(A * transpose(A)) * transpose(A) * y. The way this works +// is that, while A is typically not a square matrix (and hence not invertible), A * transpose(A) +// is always square. That is: +// A * x = y +// transpose(A) * (A * x) = transpose(A) * y <- multiply both sides by transpose(A) +// (transpose(A) * A) * x = transpose(A) * y <- associativity +// x = inverse(transpose(A) * A) * transpose(A) * y <- solve for x +// Matrix A's row count (first index) must match y's value count. A's column count (second index) +// determines the length of the result vector x. +Distortion.prototype.solveLeastSquares_ = function(matA, vecY) { + var i, j, k, sum; + var numSamples = matA.length; + var numCoefficients = matA[0].length; + if (numSamples != vecY.Length) { + throw new Error("Matrix / vector dimension mismatch"); + } + + // Calculate transpose(A) * A + var matATA = new Array(numCoefficients); + for (k = 0; k < numCoefficients; ++k) { + matATA[k] = new Array(numCoefficients); + for (j = 0; j < numCoefficients; ++j) { + sum = 0; + for (i = 0; i < numSamples; ++i) { + sum += matA[j][i] * matA[k][i]; + } + matATA[k][j] = sum; + } + } + + // Calculate transpose(A) * y + var vecATY = new Array(numCoefficients); + for (j = 0; j < numCoefficients; ++j) { + sum = 0; + for (i = 0; i < numSamples; ++i) { + sum += matA[j][i] * vecY[i]; + } + vecATY[j] = sum; + } + + // Now solve (A * transpose(A)) * x = transpose(A) * y. + return this.solveLinear_(matATA, vecATY); +}; + +/// Calculates an approximate inverse to the given radial distortion parameters. +Distortion.prototype.approximateInverse = function(maxRadius, numSamples) { + maxRadius = maxRadius || 1; + numSamples = numSamples || 100; + var numCoefficients = 6; + var i, j; + + // R + K1*R^3 + K2*R^5 = r, with R = rp = distort(r) + // Repeating for numSamples: + // [ R0^3, R0^5 ] * [ K1 ] = [ r0 - R0 ] + // [ R1^3, R1^5 ] [ K2 ] [ r1 - R1 ] + // [ R2^3, R2^5 ] [ r2 - R2 ] + // [ etc... ] [ etc... ] + // That is: + // matA * [K1, K2] = y + // Solve: + // [K1, K2] = inverse(transpose(matA) * matA) * transpose(matA) * y + var matA = new Array(numCoefficients); + for (j = 0; j < numCoefficients; ++j) { + matA[j] = new Array(numSamples); + } + var vecY = new Array(numSamples); + + for (i = 0; i < numSamples; ++i) { + var r = maxRadius * (i + 1) / numSamples; + var rp = this.distort(r); + var v = rp; + for (j = 0; j < numCoefficients; ++j) { + v *= rp * rp; + matA[j][i] = v; + } + vecY[i] = r - rp; + } + + var inverseCoefficients = this.solveLeastSquares_(matA, vecY); + + return new Distortion(inverseCoefficients); +}; + +module.exports = Distortion; + +},{}],11:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * DPDB cache. + */ +var DPDB_CACHE = { + "format": 1, + "last_updated": "2016-01-20T00:18:35Z", + "devices": [ + + { + "type": "android", + "rules": [ + { "mdmh": "asus/*/Nexus 7/*" }, + { "ua": "Nexus 7" } + ], + "dpi": [ 320.8, 323.0 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "asus/*/ASUS_Z00AD/*" }, + { "ua": "ASUS_Z00AD" } + ], + "dpi": [ 403.0, 404.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Google//Pixel XL/" }, + { "ua": "Pixel XL" } + ], + "dpi": [537.9, 533], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "HTC/*/HTC6435LVW/*" }, + { "ua": "HTC6435LVW" } + ], + "dpi": [ 449.7, 443.3 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "HTC/*/HTC One XL/*" }, + { "ua": "HTC One XL" } + ], + "dpi": [ 315.3, 314.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "htc/*/Nexus 9/*" }, + { "ua": "Nexus 9" } + ], + "dpi": 289.0, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "HTC/*/HTC One M9/*" }, + { "ua": "HTC One M9" } + ], + "dpi": [ 442.5, 443.3 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "HTC/*/HTC One_M8/*" }, + { "ua": "HTC One_M8" } + ], + "dpi": [ 449.7, 447.4 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "HTC/*/HTC One/*" }, + { "ua": "HTC One" } + ], + "dpi": 472.8, + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Huawei/*/Nexus 6P/*" }, + { "ua": "Nexus 6P" } + ], + "dpi": [ 515.1, 518.0 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/Nexus 5X/*" }, + { "ua": "Nexus 5X" } + ], + "dpi": [ 422.0, 419.9 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LGMS345/*" }, + { "ua": "LGMS345" } + ], + "dpi": [ 221.7, 219.1 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LG-D800/*" }, + { "ua": "LG-D800" } + ], + "dpi": [ 422.0, 424.1 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LG-D850/*" }, + { "ua": "LG-D850" } + ], + "dpi": [ 537.9, 541.9 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/VS985 4G/*" }, + { "ua": "VS985 4G" } + ], + "dpi": [ 537.9, 535.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/Nexus 5/*" }, + { "ua": "Nexus 5 " } + ], + "dpi": [ 442.4, 444.8 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/Nexus 4/*" }, + { "ua": "Nexus 4" } + ], + "dpi": [ 319.8, 318.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LG-P769/*" }, + { "ua": "LG-P769" } + ], + "dpi": [ 240.6, 247.5 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LGMS323/*" }, + { "ua": "LGMS323" } + ], + "dpi": [ 206.6, 204.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "LGE/*/LGLS996/*" }, + { "ua": "LGLS996" } + ], + "dpi": [ 403.4, 401.5 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Micromax/*/4560MMX/*" }, + { "ua": "4560MMX" } + ], + "dpi": [ 240.0, 219.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Micromax/*/A250/*" }, + { "ua": "Micromax A250" } + ], + "dpi": [ 480.0, 446.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Micromax/*/Micromax AQ4501/*" }, + { "ua": "Micromax AQ4501" } + ], + "dpi": 240.0, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/DROID RAZR/*" }, + { "ua": "DROID RAZR" } + ], + "dpi": [ 368.1, 256.7 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT830C/*" }, + { "ua": "XT830C" } + ], + "dpi": [ 254.0, 255.9 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1021/*" }, + { "ua": "XT1021" } + ], + "dpi": [ 254.0, 256.7 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1023/*" }, + { "ua": "XT1023" } + ], + "dpi": [ 254.0, 256.7 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1028/*" }, + { "ua": "XT1028" } + ], + "dpi": [ 326.6, 327.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1034/*" }, + { "ua": "XT1034" } + ], + "dpi": [ 326.6, 328.4 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1053/*" }, + { "ua": "XT1053" } + ], + "dpi": [ 315.3, 316.1 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1562/*" }, + { "ua": "XT1562" } + ], + "dpi": [ 403.4, 402.7 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/Nexus 6/*" }, + { "ua": "Nexus 6 " } + ], + "dpi": [ 494.3, 489.7 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1063/*" }, + { "ua": "XT1063" } + ], + "dpi": [ 295.0, 296.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1064/*" }, + { "ua": "XT1064" } + ], + "dpi": [ 295.0, 295.6 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1092/*" }, + { "ua": "XT1092" } + ], + "dpi": [ 422.0, 424.1 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/XT1095/*" }, + { "ua": "XT1095" } + ], + "dpi": [ 422.0, 423.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "motorola/*/G4/*" }, + { "ua": "Moto G (4)" } + ], + "dpi": 401.0, + "bw": 4, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "OnePlus/*/A0001/*" }, + { "ua": "A0001" } + ], + "dpi": [ 403.4, 401.0 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "OnePlus/*/ONE E1005/*" }, + { "ua": "ONE E1005" } + ], + "dpi": [ 442.4, 441.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "OnePlus/*/ONE A2005/*" }, + { "ua": "ONE A2005" } + ], + "dpi": [ 391.9, 405.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "OPPO/*/X909/*" }, + { "ua": "X909" } + ], + "dpi": [ 442.4, 444.1 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9082/*" }, + { "ua": "GT-I9082" } + ], + "dpi": [ 184.7, 185.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G360P/*" }, + { "ua": "SM-G360P" } + ], + "dpi": [ 196.7, 205.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/Nexus S/*" }, + { "ua": "Nexus S" } + ], + "dpi": [ 234.5, 229.8 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9300/*" }, + { "ua": "GT-I9300" } + ], + "dpi": [ 304.8, 303.9 ], + "bw": 5, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-T230NU/*" }, + { "ua": "SM-T230NU" } + ], + "dpi": 216.0, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SGH-T399/*" }, + { "ua": "SGH-T399" } + ], + "dpi": [ 217.7, 231.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-N9005/*" }, + { "ua": "SM-N9005" } + ], + "dpi": [ 386.4, 387.0 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SAMSUNG-SM-N900A/*" }, + { "ua": "SAMSUNG-SM-N900A" } + ], + "dpi": [ 386.4, 387.7 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9500/*" }, + { "ua": "GT-I9500" } + ], + "dpi": [ 442.5, 443.3 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9505/*" }, + { "ua": "GT-I9505" } + ], + "dpi": 439.4, + "bw": 4, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G900F/*" }, + { "ua": "SM-G900F" } + ], + "dpi": [ 415.6, 431.6 ], + "bw": 5, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G900M/*" }, + { "ua": "SM-G900M" } + ], + "dpi": [ 415.6, 431.6 ], + "bw": 5, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G800F/*" }, + { "ua": "SM-G800F" } + ], + "dpi": 326.8, + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G906S/*" }, + { "ua": "SM-G906S" } + ], + "dpi": [ 562.7, 572.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9300/*" }, + { "ua": "GT-I9300" } + ], + "dpi": [ 306.7, 304.8 ], + "bw": 5, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-T535/*" }, + { "ua": "SM-T535" } + ], + "dpi": [ 142.6, 136.4 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-N920C/*" }, + { "ua": "SM-N920C" } + ], + "dpi": [ 515.1, 518.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9300I/*" }, + { "ua": "GT-I9300I" } + ], + "dpi": [ 304.8, 305.8 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-I9195/*" }, + { "ua": "GT-I9195" } + ], + "dpi": [ 249.4, 256.7 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SPH-L520/*" }, + { "ua": "SPH-L520" } + ], + "dpi": [ 249.4, 255.9 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SAMSUNG-SGH-I717/*" }, + { "ua": "SAMSUNG-SGH-I717" } + ], + "dpi": 285.8, + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SPH-D710/*" }, + { "ua": "SPH-D710" } + ], + "dpi": [ 217.7, 204.2 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/GT-N7100/*" }, + { "ua": "GT-N7100" } + ], + "dpi": 265.1, + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SCH-I605/*" }, + { "ua": "SCH-I605" } + ], + "dpi": 265.1, + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/Galaxy Nexus/*" }, + { "ua": "Galaxy Nexus" } + ], + "dpi": [ 315.3, 314.2 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-N910H/*" }, + { "ua": "SM-N910H" } + ], + "dpi": [ 515.1, 518.0 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-N910C/*" }, + { "ua": "SM-N910C" } + ], + "dpi": [ 515.2, 520.2 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G130M/*" }, + { "ua": "SM-G130M" } + ], + "dpi": [ 165.9, 164.8 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G928I/*" }, + { "ua": "SM-G928I" } + ], + "dpi": [ 515.1, 518.4 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G920F/*" }, + { "ua": "SM-G920F" } + ], + "dpi": 580.6, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G920P/*" }, + { "ua": "SM-G920P" } + ], + "dpi": [ 522.5, 577.0 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G925F/*" }, + { "ua": "SM-G925F" } + ], + "dpi": 580.6, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G925V/*" }, + { "ua": "SM-G925V" } + ], + "dpi": [ 522.5, 576.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "samsung/*/SM-G935F/*" }, + { "ua": "SM-G935F" } + ], + "dpi": 534, + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Sony/*/C6903/*" }, + { "ua": "C6903" } + ], + "dpi": [ 442.5, 443.3 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Sony/*/D6653/*" }, + { "ua": "D6653" } + ], + "dpi": [ 428.6, 427.6 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Sony/*/E6653/*" }, + { "ua": "E6653" } + ], + "dpi": [ 428.6, 425.7 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Sony/*/E6853/*" }, + { "ua": "E6853" } + ], + "dpi": [ 403.4, 401.9 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "Sony/*/SGP321/*" }, + { "ua": "SGP321" } + ], + "dpi": [ 224.7, 224.1 ], + "bw": 3, + "ac": 500 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "TCT/*/ALCATEL ONE TOUCH Fierce/*" }, + { "ua": "ALCATEL ONE TOUCH Fierce" } + ], + "dpi": [ 240.0, 247.5 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "THL/*/thl 5000/*" }, + { "ua": "thl 5000" } + ], + "dpi": [ 480.0, 443.3 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "android", + "rules": [ + { "mdmh": "ZTE/*/ZTE Blade L2/*" }, + { "ua": "ZTE Blade L2" } + ], + "dpi": 240.0, + "bw": 3, + "ac": 500 + }, + + { + "type": "ios", + "rules": [ { "res": [ 640, 960 ] } ], + "dpi": [ 325.1, 328.4 ], + "bw": 4, + "ac": 1000 + }, + + { + "type": "ios", + "rules": [ { "res": [ 640, 1136 ] } ], + "dpi": [ 317.1, 320.2 ], + "bw": 3, + "ac": 1000 + }, + + { + "type": "ios", + "rules": [ { "res": [ 750, 1334 ] } ], + "dpi": 326.4, + "bw": 4, + "ac": 1000 + }, + + { + "type": "ios", + "rules": [ { "res": [ 1242, 2208 ] } ], + "dpi": [ 453.6, 458.4 ], + "bw": 4, + "ac": 1000 + }, + + { + "type": "ios", + "rules": [ { "res": [ 1125, 2001 ] } ], + "dpi": [ 410.9, 415.4 ], + "bw": 4, + "ac": 1000 + } +]}; + +module.exports = DPDB_CACHE; + +},{}],12:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Offline cache of the DPDB, to be used until we load the online one (and +// as a fallback in case we can't load the online one). +var DPDB_CACHE = _dereq_('./dpdb-cache.js'); +var Util = _dereq_('../util.js'); + +// Online DPDB URL. +var ONLINE_DPDB_URL = 'https://storage.googleapis.com/cardboard-dpdb/dpdb.json'; + +/** + * Calculates device parameters based on the DPDB (Device Parameter Database). + * Initially, uses the cached DPDB values. + * + * If fetchOnline == true, then this object tries to fetch the online version + * of the DPDB and updates the device info if a better match is found. + * Calls the onDeviceParamsUpdated callback when there is an update to the + * device information. + */ +function Dpdb(fetchOnline, onDeviceParamsUpdated) { + // Start with the offline DPDB cache while we are loading the real one. + this.dpdb = DPDB_CACHE; + + // Calculate device params based on the offline version of the DPDB. + this.recalculateDeviceParams_(); + + // XHR to fetch online DPDB file, if requested. + if (fetchOnline) { + // Set the callback. + this.onDeviceParamsUpdated = onDeviceParamsUpdated; + + var xhr = new XMLHttpRequest(); + var obj = this; + xhr.open('GET', ONLINE_DPDB_URL, true); + xhr.addEventListener('load', function() { + obj.loading = false; + if (xhr.status >= 200 && xhr.status <= 299) { + // Success. + obj.dpdb = JSON.parse(xhr.response); + obj.recalculateDeviceParams_(); + } else { + // Error loading the DPDB. + console.error('Error loading online DPDB!'); + } + }); + xhr.send(); + } +} + +// Returns the current device parameters. +Dpdb.prototype.getDeviceParams = function() { + return this.deviceParams; +}; + +// Recalculates this device's parameters based on the DPDB. +Dpdb.prototype.recalculateDeviceParams_ = function() { + var newDeviceParams = this.calcDeviceParams_(); + if (newDeviceParams) { + this.deviceParams = newDeviceParams; + // Invoke callback, if it is set. + if (this.onDeviceParamsUpdated) { + this.onDeviceParamsUpdated(this.deviceParams); + } + } else { + console.error('Failed to recalculate device parameters.'); + } +}; + +// Returns a DeviceParams object that represents the best guess as to this +// device's parameters. Can return null if the device does not match any +// known devices. +Dpdb.prototype.calcDeviceParams_ = function() { + var db = this.dpdb; // shorthand + if (!db) { + console.error('DPDB not available.'); + return null; + } + if (db.format != 1) { + console.error('DPDB has unexpected format version.'); + return null; + } + if (!db.devices || !db.devices.length) { + console.error('DPDB does not have a devices section.'); + return null; + } + + // Get the actual user agent and screen dimensions in pixels. + var userAgent = navigator.userAgent || navigator.vendor || window.opera; + var width = Util.getScreenWidth(); + var height = Util.getScreenHeight(); + + if (!db.devices) { + console.error('DPDB has no devices section.'); + return null; + } + + for (var i = 0; i < db.devices.length; i++) { + var device = db.devices[i]; + if (!device.rules) { + console.warn('Device[' + i + '] has no rules section.'); + continue; + } + + if (device.type != 'ios' && device.type != 'android') { + console.warn('Device[' + i + '] has invalid type.'); + continue; + } + + // See if this device is of the appropriate type. + if (Util.isIOS() != (device.type == 'ios')) continue; + + // See if this device matches any of the rules: + var matched = false; + for (var j = 0; j < device.rules.length; j++) { + var rule = device.rules[j]; + if (this.matchRule_(rule, userAgent, width, height)) { + matched = true; + break; + } + } + if (!matched) continue; + + // device.dpi might be an array of [ xdpi, ydpi] or just a scalar. + var xdpi = device.dpi[0] || device.dpi; + var ydpi = device.dpi[1] || device.dpi; + + return new DeviceParams({ xdpi: xdpi, ydpi: ydpi, bevelMm: device.bw }); + } + + console.warn('No DPDB device match.'); + return null; +}; + +Dpdb.prototype.matchRule_ = function(rule, ua, screenWidth, screenHeight) { + // We can only match 'ua' and 'res' rules, not other types like 'mdmh' + // (which are meant for native platforms). + if (!rule.ua && !rule.res) return false; + + // If our user agent string doesn't contain the indicated user agent string, + // the match fails. + if (rule.ua && ua.indexOf(rule.ua) < 0) return false; + + // If the rule specifies screen dimensions that don't correspond to ours, + // the match fails. + if (rule.res) { + if (!rule.res[0] || !rule.res[1]) return false; + var resX = rule.res[0]; + var resY = rule.res[1]; + // Compare min and max so as to make the order not matter, i.e., it should + // be true that 640x480 == 480x640. + if (Math.min(screenWidth, screenHeight) != Math.min(resX, resY) || + (Math.max(screenWidth, screenHeight) != Math.max(resX, resY))) { + return false; + } + } + + return true; +} + +function DeviceParams(params) { + this.xdpi = params.xdpi; + this.ydpi = params.ydpi; + this.bevelMm = params.bevelMm; +} + +module.exports = Dpdb; + +},{"../util.js":22,"./dpdb-cache.js":11}],13:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var Util = _dereq_('./util.js'); +var WebVRPolyfill = _dereq_('./webvr-polyfill.js').WebVRPolyfill; + +// Initialize a WebVRConfig just in case. +window.WebVRConfig = Util.extend({ + // Forces availability of VR mode, even for non-mobile devices. + FORCE_ENABLE_VR: false, + + // Complementary filter coefficient. 0 for accelerometer, 1 for gyro. + K_FILTER: 0.98, + + // How far into the future to predict during fast motion (in seconds). + PREDICTION_TIME_S: 0.040, + + // Flag to enable touch panner. In case you have your own touch controls. + TOUCH_PANNER_DISABLED: true, + + // Flag to disabled the UI in VR Mode. + CARDBOARD_UI_DISABLED: false, // Default: false + + // Flag to disable the instructions to rotate your device. + ROTATE_INSTRUCTIONS_DISABLED: false, // Default: false. + + // Enable yaw panning only, disabling roll and pitch. This can be useful + // for panoramas with nothing interesting above or below. + YAW_ONLY: false, + + // To disable keyboard and mouse controls, if you want to use your own + // implementation. + MOUSE_KEYBOARD_CONTROLS_DISABLED: false, + + // Prevent the polyfill from initializing immediately. Requires the app + // to call InitializeWebVRPolyfill() before it can be used. + DEFER_INITIALIZATION: false, + + // Enable the deprecated version of the API (navigator.getVRDevices). + ENABLE_DEPRECATED_API: false, + + // Scales the recommended buffer size reported by WebVR, which can improve + // performance. + // UPDATE(2016-05-03): Setting this to 0.5 by default since 1.0 does not + // perform well on many mobile devices. + BUFFER_SCALE: 0.5, + + // Allow VRDisplay.submitFrame to change gl bindings, which is more + // efficient if the application code will re-bind its resources on the + // next frame anyway. This has been seen to cause rendering glitches with + // THREE.js. + // Dirty bindings include: gl.FRAMEBUFFER_BINDING, gl.CURRENT_PROGRAM, + // gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING, + // and gl.TEXTURE_BINDING_2D for texture unit 0. + DIRTY_SUBMIT_FRAME_BINDINGS: false, + + // When set to true, this will cause a polyfilled VRDisplay to always be + // appended to the list returned by navigator.getVRDisplays(), even if that + // list includes a native VRDisplay. + ALWAYS_APPEND_POLYFILL_DISPLAY: false +}, window.WebVRConfig); + +if (!window.WebVRConfig.DEFER_INITIALIZATION) { + new WebVRPolyfill(); +} else { + window.InitializeWebVRPolyfill = function() { + new WebVRPolyfill(); + } +} + +},{"./util.js":22,"./webvr-polyfill.js":25}],14:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var MathUtil = window.MathUtil || {}; + +MathUtil.degToRad = Math.PI / 180; +MathUtil.radToDeg = 180 / Math.PI; + +// Some minimal math functionality borrowed from THREE.Math and stripped down +// for the purposes of this library. + + +MathUtil.Vector2 = function ( x, y ) { + this.x = x || 0; + this.y = y || 0; +}; + +MathUtil.Vector2.prototype = { + constructor: MathUtil.Vector2, + + set: function ( x, y ) { + this.x = x; + this.y = y; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + + return this; + }, + + subVectors: function ( a, b ) { + this.x = a.x - b.x; + this.y = a.y - b.y; + + return this; + }, +}; + +MathUtil.Vector3 = function ( x, y, z ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; +}; + +MathUtil.Vector3.prototype = { + constructor: MathUtil.Vector3, + + set: function ( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + + return this; + }, + + length: function () { + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); + }, + + normalize: function () { + var scalar = this.length(); + + if ( scalar !== 0 ) { + var invScalar = 1 / scalar; + + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + multiplyScalar: function ( scalar ) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + + applyQuaternion: function ( q ) { + var x = this.x; + var y = this.y; + var z = this.z; + + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vector + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = - qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; + this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; + this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; + + return this; + }, + + dot: function ( v ) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + crossVectors: function ( a, b ) { + var ax = a.x, ay = a.y, az = a.z; + var bx = b.x, by = b.y, bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, +}; + +MathUtil.Quaternion = function ( x, y, z, w ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = ( w !== undefined ) ? w : 1; +}; + +MathUtil.Quaternion.prototype = { + constructor: MathUtil.Quaternion, + + set: function ( x, y, z, w ) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + + return this; + }, + + copy: function ( quaternion ) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + + return this; + }, + + setFromEulerXYZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + + return this; + }, + + setFromEulerYXZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + + return this; + }, + + setFromAxisAngle: function ( axis, angle ) { + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + + var halfAngle = angle / 2, s = Math.sin( halfAngle ); + + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos( halfAngle ); + + return this; + }, + + multiply: function ( q ) { + return this.multiplyQuaternions( this, q ); + }, + + multiplyQuaternions: function ( a, b ) { + // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + + var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w; + var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w; + + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + + return this; + }, + + inverse: function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + + this.normalize(); + + return this; + }, + + normalize: function () { + var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); + + if ( l === 0 ) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + + return this; + }, + + slerp: function ( qb, t ) { + if ( t === 0 ) return this; + if ( t === 1 ) return this.copy( qb ); + + var x = this.x, y = this.y, z = this.z, w = this.w; + + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + + if ( cosHalfTheta < 0 ) { + this.w = - qb.w; + this.x = - qb.x; + this.y = - qb.y; + this.z = - qb.z; + + cosHalfTheta = - cosHalfTheta; + } else { + this.copy( qb ); + } + + if ( cosHalfTheta >= 1.0 ) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + return this; + } + + var halfTheta = Math.acos( cosHalfTheta ); + var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); + + if ( Math.abs( sinHalfTheta ) < 0.001 ) { + this.w = 0.5 * ( w + this.w ); + this.x = 0.5 * ( x + this.x ); + this.y = 0.5 * ( y + this.y ); + this.z = 0.5 * ( z + this.z ); + + return this; + } + + var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, + ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; + + this.w = ( w * ratioA + this.w * ratioB ); + this.x = ( x * ratioA + this.x * ratioB ); + this.y = ( y * ratioA + this.y * ratioB ); + this.z = ( z * ratioA + this.z * ratioB ); + + return this; + }, + + setFromUnitVectors: function () { + // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final + // assumes direction vectors vFrom and vTo are normalized + + var v1, r; + var EPS = 0.000001; + + return function ( vFrom, vTo ) { + if ( v1 === undefined ) v1 = new MathUtil.Vector3(); + + r = vFrom.dot( vTo ) + 1; + + if ( r < EPS ) { + r = 0; + + if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { + v1.set( - vFrom.y, vFrom.x, 0 ); + } else { + v1.set( 0, - vFrom.z, vFrom.y ); + } + } else { + v1.crossVectors( vFrom, vTo ); + } + + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + + this.normalize(); + + return this; + } + }(), +}; + +module.exports = MathUtil; + +},{}],15:[function(_dereq_,module,exports){ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var VRDisplay = _dereq_('./base.js').VRDisplay; +var MathUtil = _dereq_('./math-util.js'); +var Util = _dereq_('./util.js'); + +// How much to rotate per key stroke. +var KEY_SPEED = 0.15; +var KEY_ANIMATION_DURATION = 80; + +// How much to rotate for mouse events. +var MOUSE_SPEED_X = 0.5; +var MOUSE_SPEED_Y = 0.3; + +/** + * VRDisplay based on mouse and keyboard input. Designed for desktops/laptops + * where orientation events aren't supported. Cannot present. + */ +function MouseKeyboardVRDisplay() { + this.displayName = 'Mouse and Keyboard VRDisplay (webvr-polyfill)'; + + this.capabilities.hasOrientation = true; + + // Attach to mouse and keyboard events. + window.addEventListener('keydown', this.onKeyDown_.bind(this)); + window.addEventListener('mousemove', this.onMouseMove_.bind(this)); + window.addEventListener('mousedown', this.onMouseDown_.bind(this)); + window.addEventListener('mouseup', this.onMouseUp_.bind(this)); + + // "Private" members. + this.phi_ = 0; + this.theta_ = 0; + + // Variables for keyboard-based rotation animation. + this.targetAngle_ = null; + this.angleAnimation_ = null; + + // State variables for calculations. + this.orientation_ = new MathUtil.Quaternion(); + + // Variables for mouse-based rotation. + this.rotateStart_ = new MathUtil.Vector2(); + this.rotateEnd_ = new MathUtil.Vector2(); + this.rotateDelta_ = new MathUtil.Vector2(); + this.isDragging_ = false; + + this.orientationOut_ = new Float32Array(4); +} +MouseKeyboardVRDisplay.prototype = new VRDisplay(); + +MouseKeyboardVRDisplay.prototype.getImmediatePose = function() { + this.orientation_.setFromEulerYXZ(this.phi_, this.theta_, 0); + + this.orientationOut_[0] = this.orientation_.x; + this.orientationOut_[1] = this.orientation_.y; + this.orientationOut_[2] = this.orientation_.z; + this.orientationOut_[3] = this.orientation_.w; + + return { + position: null, + orientation: this.orientationOut_, + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; +}; + +MouseKeyboardVRDisplay.prototype.onKeyDown_ = function(e) { + // Track WASD and arrow keys. + if (e.keyCode == 38) { // Up key. + this.animatePhi_(this.phi_ + KEY_SPEED); + } else if (e.keyCode == 39) { // Right key. + this.animateTheta_(this.theta_ - KEY_SPEED); + } else if (e.keyCode == 40) { // Down key. + this.animatePhi_(this.phi_ - KEY_SPEED); + } else if (e.keyCode == 37) { // Left key. + this.animateTheta_(this.theta_ + KEY_SPEED); + } +}; + +MouseKeyboardVRDisplay.prototype.animateTheta_ = function(targetAngle) { + this.animateKeyTransitions_('theta_', targetAngle); +}; + +MouseKeyboardVRDisplay.prototype.animatePhi_ = function(targetAngle) { + // Prevent looking too far up or down. + targetAngle = Util.clamp(targetAngle, -Math.PI/2, Math.PI/2); + this.animateKeyTransitions_('phi_', targetAngle); +}; + +/** + * Start an animation to transition an angle from one value to another. + */ +MouseKeyboardVRDisplay.prototype.animateKeyTransitions_ = function(angleName, targetAngle) { + // If an animation is currently running, cancel it. + if (this.angleAnimation_) { + cancelAnimationFrame(this.angleAnimation_); + } + var startAngle = this[angleName]; + var startTime = new Date(); + // Set up an interval timer to perform the animation. + this.angleAnimation_ = requestAnimationFrame(function animate() { + // Once we're finished the animation, we're done. + var elapsed = new Date() - startTime; + if (elapsed >= KEY_ANIMATION_DURATION) { + this[angleName] = targetAngle; + cancelAnimationFrame(this.angleAnimation_); + return; + } + // loop with requestAnimationFrame + this.angleAnimation_ = requestAnimationFrame(animate.bind(this)) + // Linearly interpolate the angle some amount. + var percent = elapsed / KEY_ANIMATION_DURATION; + this[angleName] = startAngle + (targetAngle - startAngle) * percent; + }.bind(this)); +}; + +MouseKeyboardVRDisplay.prototype.onMouseDown_ = function(e) { + this.rotateStart_.set(e.clientX, e.clientY); + this.isDragging_ = true; +}; + +// Very similar to https://gist.github.com/mrflix/8351020 +MouseKeyboardVRDisplay.prototype.onMouseMove_ = function(e) { + if (!this.isDragging_ && !this.isPointerLocked_()) { + return; + } + // Support pointer lock API. + if (this.isPointerLocked_()) { + var movementX = e.movementX || e.mozMovementX || 0; + var movementY = e.movementY || e.mozMovementY || 0; + this.rotateEnd_.set(this.rotateStart_.x - movementX, this.rotateStart_.y - movementY); + } else { + this.rotateEnd_.set(e.clientX, e.clientY); + } + // Calculate how much we moved in mouse space. + this.rotateDelta_.subVectors(this.rotateEnd_, this.rotateStart_); + this.rotateStart_.copy(this.rotateEnd_); + + // Keep track of the cumulative euler angles. + this.phi_ += 2 * Math.PI * this.rotateDelta_.y / screen.height * MOUSE_SPEED_Y; + this.theta_ += 2 * Math.PI * this.rotateDelta_.x / screen.width * MOUSE_SPEED_X; + + // Prevent looking too far up or down. + this.phi_ = Util.clamp(this.phi_, -Math.PI/2, Math.PI/2); +}; + +MouseKeyboardVRDisplay.prototype.onMouseUp_ = function(e) { + this.isDragging_ = false; +}; + +MouseKeyboardVRDisplay.prototype.isPointerLocked_ = function() { + var el = document.pointerLockElement || document.mozPointerLockElement || + document.webkitPointerLockElement; + return el !== undefined; +}; + +MouseKeyboardVRDisplay.prototype.resetPose = function() { + this.phi_ = 0; + this.theta_ = 0; +}; + +module.exports = MouseKeyboardVRDisplay; + +},{"./base.js":3,"./math-util.js":14,"./util.js":22}],16:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Util = _dereq_('./util.js'); + +function RotateInstructions() { + this.loadIcon_(); + + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.top = 0; + s.right = 0; + s.bottom = 0; + s.left = 0; + s.backgroundColor = 'gray'; + s.fontFamily = 'sans-serif'; + // Force this to be above the fullscreen canvas, which is at zIndex: 999999. + s.zIndex = 1000000; + + var img = document.createElement('img'); + img.src = this.icon; + var s = img.style; + s.marginLeft = '25%'; + s.marginTop = '25%'; + s.width = '50%'; + overlay.appendChild(img); + + var text = document.createElement('div'); + var s = text.style; + s.textAlign = 'center'; + s.fontSize = '16px'; + s.lineHeight = '24px'; + s.margin = '24px 25%'; + s.width = '50%'; + text.innerHTML = 'Place your phone into your Cardboard viewer.'; + overlay.appendChild(text); + + var snackbar = document.createElement('div'); + var s = snackbar.style; + s.backgroundColor = '#CFD8DC'; + s.position = 'fixed'; + s.bottom = 0; + s.width = '100%'; + s.height = '48px'; + s.padding = '14px 24px'; + s.boxSizing = 'border-box'; + s.color = '#656A6B'; + overlay.appendChild(snackbar); + + var snackbarText = document.createElement('div'); + snackbarText.style.float = 'left'; + snackbarText.innerHTML = 'No Cardboard viewer?'; + + var snackbarButton = document.createElement('a'); + snackbarButton.href = 'https://www.google.com/get/cardboard/get-cardboard/'; + snackbarButton.innerHTML = 'get one'; + snackbarButton.target = '_blank'; + var s = snackbarButton.style; + s.float = 'right'; + s.fontWeight = 600; + s.textTransform = 'uppercase'; + s.borderLeft = '1px solid gray'; + s.paddingLeft = '24px'; + s.textDecoration = 'none'; + s.color = '#656A6B'; + + snackbar.appendChild(snackbarText); + snackbar.appendChild(snackbarButton); + + this.overlay = overlay; + this.text = text; + + this.hide(); +} + +RotateInstructions.prototype.show = function(parent) { + if (!parent && !this.overlay.parentElement) { + document.body.appendChild(this.overlay); + } else if (parent) { + if (this.overlay.parentElement && this.overlay.parentElement != parent) + this.overlay.parentElement.removeChild(this.overlay); + + parent.appendChild(this.overlay); + } + + this.overlay.style.display = 'block'; + + var img = this.overlay.querySelector('img'); + var s = img.style; + + if (Util.isLandscapeMode()) { + s.width = '20%'; + s.marginLeft = '40%'; + s.marginTop = '3%'; + } else { + s.width = '50%'; + s.marginLeft = '25%'; + s.marginTop = '25%'; + } +}; + +RotateInstructions.prototype.hide = function() { + this.overlay.style.display = 'none'; +}; + +RotateInstructions.prototype.showTemporarily = function(ms, parent) { + this.show(parent); + this.timer = setTimeout(this.hide.bind(this), ms); +}; + +RotateInstructions.prototype.disableShowTemporarily = function() { + clearTimeout(this.timer); +}; + +RotateInstructions.prototype.update = function() { + this.disableShowTemporarily(); + // In portrait VR mode, tell the user to rotate to landscape. Otherwise, hide + // the instructions. + if (!Util.isLandscapeMode() && Util.isMobile()) { + this.show(); + } else { + this.hide(); + } +}; + +RotateInstructions.prototype.loadIcon_ = function() { + // Encoded asset_src/rotate-instructions.svg + this.icon = Util.base64('image/svg+xml', 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9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vcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+'); +}; + +module.exports = RotateInstructions; + +},{"./util.js":22}],17:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var SensorSample = _dereq_('./sensor-sample.js'); +var MathUtil = _dereq_('../math-util.js'); +var Util = _dereq_('../util.js'); + +/** + * An implementation of a simple complementary filter, which fuses gyroscope and + * accelerometer data from the 'devicemotion' event. + * + * Accelerometer data is very noisy, but stable over the long term. + * Gyroscope data is smooth, but tends to drift over the long term. + * + * This fusion is relatively simple: + * 1. Get orientation estimates from accelerometer by applying a low-pass filter + * on that data. + * 2. Get orientation estimates from gyroscope by integrating over time. + * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the + * short term. + */ +function ComplementaryFilter(kFilter) { + this.kFilter = kFilter; + + // Raw sensor measurements. + this.currentAccelMeasurement = new SensorSample(); + this.currentGyroMeasurement = new SensorSample(); + this.previousGyroMeasurement = new SensorSample(); + + // Set default look direction to be in the correct direction. + if (Util.isIOS()) { + this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new MathUtil.Quaternion(); + this.previousFilterQ.copy(this.filterQ); + + // Orientation based on the accelerometer. + this.accelQ = new MathUtil.Quaternion(); + // Whether or not the orientation has been initialized. + this.isOrientationInitialized = false; + // Running estimate of gravity based on the current orientation. + this.estimatedGravity = new MathUtil.Vector3(); + // Measured gravity based on accelerometer. + this.measuredGravity = new MathUtil.Vector3(); + + // Debug only quaternion of gyro-based orientation. + this.gyroIntegralQ = new MathUtil.Quaternion(); +} + +ComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); +}; + +ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (Util.isTimestampDeltaValid(deltaT)) { + this.run_(); + } + + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); +}; + +ComplementaryFilter.prototype.run_ = function() { + + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - + this.previousGyroMeasurement.timestampS; + + // Convert gyro rotation vector to a quaternion delta. + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + + // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + + // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + var invFilterQ = new MathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + + // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + var deltaQ = new MathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + + if (Util.isDebug()) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', + MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ), + (this.estimatedGravity.x).toFixed(1), + (this.estimatedGravity.y).toFixed(1), + (this.estimatedGravity.z).toFixed(1), + (this.measuredGravity.x).toFixed(1), + (this.measuredGravity.y).toFixed(1), + (this.measuredGravity.z).toFixed(1)); + } + + // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + var targetQ = new MathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + + // SLERP factor: 0 is pure gyro, 1 is pure accel. + this.filterQ.slerp(targetQ, 1 - this.kFilter); + + this.previousFilterQ.copy(this.filterQ); +}; + +ComplementaryFilter.prototype.getOrientation = function() { + return this.filterQ; +}; + +ComplementaryFilter.prototype.accelToQuaternion_ = function(accel) { + var normAccel = new MathUtil.Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new MathUtil.Quaternion(); + quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; +}; + +ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) { + // Extract axis and angle from the gyroscope data. + var quat = new MathUtil.Quaternion(); + var axis = new MathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; +}; + + +module.exports = ComplementaryFilter; + +},{"../math-util.js":14,"../util.js":22,"./sensor-sample.js":20}],18:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var ComplementaryFilter = _dereq_('./complementary-filter.js'); +var PosePredictor = _dereq_('./pose-predictor.js'); +var TouchPanner = _dereq_('../touch-panner.js'); +var MathUtil = _dereq_('../math-util.js'); +var Util = _dereq_('../util.js'); + +/** + * The pose sensor, implemented using DeviceMotion APIs. + */ +function FusionPoseSensor() { + this.deviceId = 'webvr-polyfill:fused'; + this.deviceName = 'VR Position Device (webvr-polyfill:fused)'; + + this.accelerometer = new MathUtil.Vector3(); + this.gyroscope = new MathUtil.Vector3(); + + this.start(); + + this.filter = new ComplementaryFilter(WebVRConfig.K_FILTER); + this.posePredictor = new PosePredictor(WebVRConfig.PREDICTION_TIME_S); + this.touchPanner = new TouchPanner(); + + this.filterToWorldQ = new MathUtil.Quaternion(); + + // Set the filter to world transform, depending on OS. + if (Util.isIOS()) { + this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + this.inverseWorldToScreenQ = new MathUtil.Quaternion(); + this.worldToScreenQ = new MathUtil.Quaternion(); + this.originalPoseAdjustQ = new MathUtil.Quaternion(); + this.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), + -window.orientation * Math.PI / 180); + + this.setScreenTransform_(); + // Adjust this filter for being in landscape mode. + if (Util.isLandscapeMode()) { + this.filterToWorldQ.multiply(this.inverseWorldToScreenQ); + } + + // Keep track of a reset transform for resetSensor. + this.resetQ = new MathUtil.Quaternion(); + + this.isFirefoxAndroid = Util.isFirefoxAndroid(); + this.isIOS = Util.isIOS(); + + this.orientationOut_ = new Float32Array(4); +} + +FusionPoseSensor.prototype.getPosition = function() { + // This PoseSensor doesn't support position + return null; +}; + +FusionPoseSensor.prototype.getOrientation = function() { + // Convert from filter space to the the same system used by the + // deviceorientation event. + var orientation = this.filter.getOrientation(); + + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); + + // Convert to THREE coordinate system: -Z forward, Y up, X right. + var out = new MathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + if (!WebVRConfig.TOUCH_PANNER_DISABLED) { + out.multiply(this.touchPanner.getOrientation()); + } + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + + // Handle the yaw-only case. + if (WebVRConfig.YAW_ONLY) { + // Make a quaternion that only turns around the Y-axis. + out.x = 0; + out.z = 0; + out.normalize(); + } + + this.orientationOut_[0] = out.x; + this.orientationOut_[1] = out.y; + this.orientationOut_[2] = out.z; + this.orientationOut_[3] = out.w; + return this.orientationOut_; +}; + +FusionPoseSensor.prototype.resetPose = function() { + // Reduce to inverted yaw-only. + this.resetQ.copy(this.filter.getOrientation()); + this.resetQ.x = 0; + this.resetQ.y = 0; + this.resetQ.z *= -1; + this.resetQ.normalize(); + + // Take into account extra transformations in landscape mode. + if (Util.isLandscapeMode()) { + this.resetQ.multiply(this.inverseWorldToScreenQ); + } + + // Take into account original pose. + this.resetQ.multiply(this.originalPoseAdjustQ); + + if (!WebVRConfig.TOUCH_PANNER_DISABLED) { + this.touchPanner.resetSensor(); + } +}; + +FusionPoseSensor.prototype.onDeviceMotion_ = function(deviceMotion) { + this.updateDeviceMotion_(deviceMotion); +}; + +FusionPoseSensor.prototype.updateDeviceMotion_ = function(deviceMotion) { + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + var deltaS = timestampS - this.previousTimestampS; + if (deltaS <= Util.MIN_TIMESTEP || deltaS > Util.MAX_TIMESTEP) { + console.warn('Invalid timestamps detected. Time step between successive ' + + 'gyroscope sensor samples is very small or not monotonic'); + this.previousTimestampS = timestampS; + return; + } + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); + + // With iOS and Firefox Android, rotationRate is reported in degrees, + // so we first convert to radians. + if (this.isIOS || this.isFirefoxAndroid) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this.previousTimestampS = timestampS; +}; + +FusionPoseSensor.prototype.onOrientationChange_ = function(screenOrientation) { + this.setScreenTransform_(); +}; + +/** + * This is only needed if we are in an cross origin iframe on iOS to work around + * this issue: https://bugs.webkit.org/show_bug.cgi?id=152299. + */ +FusionPoseSensor.prototype.onMessage_ = function(event) { + var message = event.data; + + // If there's no message type, ignore it. + if (!message || !message.type) { + return; + } + + // Ignore all messages that aren't devicemotion. + var type = message.type.toLowerCase(); + if (type !== 'devicemotion') { + return; + } + + // Update device motion. + this.updateDeviceMotion_(message.deviceMotionEvent); +}; + +FusionPoseSensor.prototype.setScreenTransform_ = function() { + this.worldToScreenQ.set(0, 0, 0, 1); + switch (window.orientation) { + case 0: + break; + case 90: + this.worldToScreenQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), -Math.PI / 2); + break; + case -90: + this.worldToScreenQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), Math.PI / 2); + break; + case 180: + // TODO. + break; + } + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); +}; + +FusionPoseSensor.prototype.start = function() { + this.onDeviceMotionCallback_ = this.onDeviceMotion_.bind(this); + this.onOrientationChangeCallback_ = this.onOrientationChange_.bind(this); + this.onMessageCallback_ = this.onMessage_.bind(this); + + // Only listen for postMessages if we're in an iOS and embedded inside a cross + // domain IFrame. In this case, the polyfill can still work if the containing + // page sends synthetic devicemotion events. For an example of this, see + // iframe-message-sender.js in VR View: https://goo.gl/XDtvFZ + if (Util.isIOS() && Util.isInsideCrossDomainIFrame()) { + window.addEventListener('message', this.onMessageCallback_); + } + window.addEventListener('orientationchange', this.onOrientationChangeCallback_); + window.addEventListener('devicemotion', this.onDeviceMotionCallback_); +}; + +FusionPoseSensor.prototype.stop = function() { + window.removeEventListener('devicemotion', this.onDeviceMotionCallback_); + window.removeEventListener('orientationchange', this.onOrientationChangeCallback_); + window.removeEventListener('message', this.onMessageCallback_); +}; + +module.exports = FusionPoseSensor; + +},{"../math-util.js":14,"../touch-panner.js":21,"../util.js":22,"./complementary-filter.js":17,"./pose-predictor.js":19}],19:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var MathUtil = _dereq_('../math-util'); +var Util = _dereq_('../util'); + +/** + * Given an orientation and the gyroscope data, predicts the future orientation + * of the head. This makes rendering appear faster. + * + * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf + * + * @param {Number} predictionTimeS time from head movement to the appearance of + * the corresponding image. + */ +function PosePredictor(predictionTimeS) { + this.predictionTimeS = predictionTimeS; + + // The quaternion corresponding to the previous state. + this.previousQ = new MathUtil.Quaternion(); + // Previous time a prediction occurred. + this.previousTimestampS = null; + + // The delta quaternion that adjusts the current pose. + this.deltaQ = new MathUtil.Quaternion(); + // The output quaternion. + this.outQ = new MathUtil.Quaternion(); +} + +PosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + + // Calculate axis and angle based on gyroscope rotation rate data. + var axis = new MathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + + var angularSpeed = gyro.length(); + + // If we're rotating slowly, don't do prediction. + if (angularSpeed < MathUtil.degToRad * 20) { + if (Util.isDebug()) { + console.log('Moving slowly, at %s deg/s: no prediction', + (MathUtil.radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + + // Get the predicted angle based on the time delta and latency. + var deltaT = timestampS - this.previousTimestampS; + var predictAngle = angularSpeed * this.predictionTimeS; + + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + + return this.outQ; +}; + + +module.exports = PosePredictor; + +},{"../math-util":14,"../util":22}],20:[function(_dereq_,module,exports){ +function SensorSample(sample, timestampS) { + this.set(sample, timestampS); +}; + +SensorSample.prototype.set = function(sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; +}; + +SensorSample.prototype.copy = function(sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); +}; + +module.exports = SensorSample; + +},{}],21:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var MathUtil = _dereq_('./math-util.js'); +var Util = _dereq_('./util.js'); + +var ROTATE_SPEED = 0.5; +/** + * Provides a quaternion responsible for pre-panning the scene before further + * transformations due to device sensors. + */ +function TouchPanner() { + window.addEventListener('touchstart', this.onTouchStart_.bind(this)); + window.addEventListener('touchmove', this.onTouchMove_.bind(this)); + window.addEventListener('touchend', this.onTouchEnd_.bind(this)); + + this.isTouching = false; + this.rotateStart = new MathUtil.Vector2(); + this.rotateEnd = new MathUtil.Vector2(); + this.rotateDelta = new MathUtil.Vector2(); + + this.theta = 0; + this.orientation = new MathUtil.Quaternion(); +} + +TouchPanner.prototype.getOrientation = function() { + this.orientation.setFromEulerXYZ(0, 0, this.theta); + return this.orientation; +}; + +TouchPanner.prototype.resetSensor = function() { + this.theta = 0; +}; + +TouchPanner.prototype.onTouchStart_ = function(e) { + // Only respond if there is exactly one touch. + if (e.touches.length != 1) { + return; + } + this.rotateStart.set(e.touches[0].pageX, e.touches[0].pageY); + this.isTouching = true; +}; + +TouchPanner.prototype.onTouchMove_ = function(e) { + if (!this.isTouching) { + return; + } + this.rotateEnd.set(e.touches[0].pageX, e.touches[0].pageY); + this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart); + this.rotateStart.copy(this.rotateEnd); + + // On iOS, direction is inverted. + if (Util.isIOS()) { + this.rotateDelta.x *= -1; + } + + var element = document.body; + this.theta += 2 * Math.PI * this.rotateDelta.x / element.clientWidth * ROTATE_SPEED; +}; + +TouchPanner.prototype.onTouchEnd_ = function(e) { + this.isTouching = false; +}; + +module.exports = TouchPanner; + +},{"./math-util.js":14,"./util.js":22}],22:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var objectAssign = _dereq_('object-assign'); + +var Util = window.Util || {}; + +Util.MIN_TIMESTEP = 0.001; +Util.MAX_TIMESTEP = 1; + +Util.base64 = function(mimeType, base64) { + return 'data:' + mimeType + ';base64,' + base64; +}; + +Util.clamp = function(value, min, max) { + return Math.min(Math.max(min, value), max); +}; + +Util.lerp = function(a, b, t) { + return a + ((b - a) * t); +}; + +Util.isIOS = (function() { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return isIOS; + }; +})(); + +Util.isSafari = (function() { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return isSafari; + }; +})(); + +Util.isFirefoxAndroid = (function() { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; + return function() { + return isFirefoxAndroid; + }; +})(); + +Util.isLandscapeMode = function() { + return (window.orientation == 90 || window.orientation == -90); +}; + +// Helper method to validate the time steps of sensor timestamps. +Util.isTimestampDeltaValid = function(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= Util.MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > Util.MAX_TIMESTEP) { + return false; + } + return true; +}; + +Util.getScreenWidth = function() { + return Math.max(window.screen.width, window.screen.height) * + window.devicePixelRatio; +}; + +Util.getScreenHeight = function() { + return Math.min(window.screen.width, window.screen.height) * + window.devicePixelRatio; +}; + +Util.requestFullscreen = function(element) { + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + + return true; +}; + +Util.exitFullscreen = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + + return true; +}; + +Util.getFullscreenElement = function() { + return document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement; +}; + +Util.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) { + // No error checking for brevity. + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + + for (var attribName in attribLocationMap) + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + + gl.linkProgram(program); + + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + + return program; +}; + +Util.getProgramUniforms = function(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; +}; + +Util.orthoMatrix = function (out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; + +Util.isMobile = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); + return check; +}; + +Util.extend = objectAssign; + +Util.safariCssSizeWorkaround = function(canvas) { + /* + // TODO(smus): Remove this workaround when Safari for iOS is fixed. + // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556). + // + // "To the last I grapple with thee; + // from hell's heart I stab at thee; + // for hate's sake I spit my last breath at thee." + // -- Moby Dick, by Herman Melville + if (Util.isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = (parseInt(width) + 1) + 'px'; + canvas.style.height = (parseInt(height)) + 'px'; + setTimeout(function() { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + */ + + // Debug only. + window.Util = Util; + window.canvas = canvas; +}; + +Util.isDebug = function() { + return Util.getQueryParameter('debug'); +}; + +Util.getQueryParameter = function(name) { + var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); +}; + +Util.frameDataFromPose = (function() { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + + // Borrowed from glMatrix. + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45), + downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45), + leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45), + rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + }; + + function mat4_translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + }; + + function mat4_invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + }; + + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + + function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar); + + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + + mat4_fromRotationTranslation(view, orientation, position); + if (parameters) + mat4_translate(view, view, parameters.offset); + mat4_invert(view, view); + } + + return function(frameData, pose, vrDisplay) { + if (!frameData || !pose) + return false; + + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + + updateEyeMatrices( + frameData.leftProjectionMatrix, frameData.leftViewMatrix, + pose, vrDisplay.getEyeParameters("left"), vrDisplay); + updateEyeMatrices( + frameData.rightProjectionMatrix, frameData.rightViewMatrix, + pose, vrDisplay.getEyeParameters("right"), vrDisplay); + + return true; + }; +})(); + +Util.isInsideCrossDomainIFrame = function() { + var isFramed = (window.self !== window.top); + var refDomain = Util.getDomainFromUrl(document.referrer); + var thisDomain = Util.getDomainFromUrl(window.location.href); + + return isFramed && (refDomain !== thisDomain); +}; + +// From http://stackoverflow.com/a/23945027. +Util.getDomainFromUrl = function(url) { + var domain; + // Find & remove protocol (http, ftp, etc.) and get domain. + if (url.indexOf("://") > -1) { + domain = url.split('/')[2]; + } + else { + domain = url.split('/')[0]; + } + + //find & remove port number + domain = domain.split(':')[0]; + + return domain; +} + +module.exports = Util; + +},{"object-assign":2}],23:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var DeviceInfo = _dereq_('./device-info.js'); +var EventEmitter3 = _dereq_('eventemitter3'); +var Util = _dereq_('./util.js'); + +var DEFAULT_VIEWER = 'CardboardV2'; +var VIEWER_KEY = 'WEBVR_CARDBOARD_VIEWER'; +var CLASS_NAME = 'webvr-polyfill-viewer-selector'; + +/** + * Creates a viewer selector with the options specified. Supports being shown + * and hidden. Generates events when viewer parameters change. Also supports + * saving the currently selected index in localStorage. + */ +function ViewerSelector() { + // Try to load the selected key from local storage. If none exists, use the + // default key. + try { + this.selectedKey = localStorage.getItem(VIEWER_KEY) || DEFAULT_VIEWER; + } catch (error) { + console.error('Failed to load viewer profile: %s', error); + } + this.dialog = this.createDialog_(DeviceInfo.Viewers); + this.root = null; +} +ViewerSelector.prototype = new EventEmitter3(); + +ViewerSelector.prototype.show = function(root) { + this.root = root; + + root.appendChild(this.dialog); + + // Ensure the currently selected item is checked. + var selected = this.dialog.querySelector('#' + this.selectedKey); + selected.checked = true; + + // Show the UI. + this.dialog.style.display = 'block'; +}; + +ViewerSelector.prototype.hide = function() { + if (this.root && this.root.contains(this.dialog)) { + this.root.removeChild(this.dialog); + } + this.dialog.style.display = 'none'; +}; + +ViewerSelector.prototype.getCurrentViewer = function() { + return DeviceInfo.Viewers[this.selectedKey]; +}; + +ViewerSelector.prototype.getSelectedKey_ = function() { + var input = this.dialog.querySelector('input[name=field]:checked'); + if (input) { + return input.id; + } + return null; +}; + +ViewerSelector.prototype.onSave_ = function() { + this.selectedKey = this.getSelectedKey_(); + if (!this.selectedKey || !DeviceInfo.Viewers[this.selectedKey]) { + console.error('ViewerSelector.onSave_: this should never happen!'); + return; + } + + this.emit('change', DeviceInfo.Viewers[this.selectedKey]); + + // Attempt to save the viewer profile, but fails in private mode. + try { + localStorage.setItem(VIEWER_KEY, this.selectedKey); + } catch(error) { + console.error('Failed to save viewer profile: %s', error); + } + this.hide(); +}; + +/** + * Creates the dialog. + */ +ViewerSelector.prototype.createDialog_ = function(options) { + var container = document.createElement('div'); + container.classList.add(CLASS_NAME); + container.style.display = 'none'; + // Create an overlay that dims the background, and which goes away when you + // tap it. + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.left = 0; + s.top = 0; + s.width = '100%'; + s.height = '100%'; + s.background = 'rgba(0, 0, 0, 0.3)'; + overlay.addEventListener('click', this.hide.bind(this)); + + var width = 280; + var dialog = document.createElement('div'); + var s = dialog.style; + s.boxSizing = 'border-box'; + s.position = 'fixed'; + s.top = '24px'; + s.left = '50%'; + s.marginLeft = (-width/2) + 'px'; + s.width = width + 'px'; + s.padding = '24px'; + s.overflow = 'hidden'; + s.background = '#fafafa'; + s.fontFamily = "'Roboto', sans-serif"; + s.boxShadow = '0px 5px 20px #666'; + + dialog.appendChild(this.createH1_('Select your viewer')); + for (var id in options) { + dialog.appendChild(this.createChoice_(id, options[id].label)); + } + dialog.appendChild(this.createButton_('Save', this.onSave_.bind(this))); + + container.appendChild(overlay); + container.appendChild(dialog); + + return container; +}; + +ViewerSelector.prototype.createH1_ = function(name) { + var h1 = document.createElement('h1'); + var s = h1.style; + s.color = 'black'; + s.fontSize = '20px'; + s.fontWeight = 'bold'; + s.marginTop = 0; + s.marginBottom = '24px'; + h1.innerHTML = name; + return h1; +}; + +ViewerSelector.prototype.createChoice_ = function(id, name) { + /* +

+ + +
+ */ + var div = document.createElement('div'); + div.style.marginTop = '8px'; + div.style.color = 'black'; + + var input = document.createElement('input'); + input.style.fontSize = '30px'; + input.setAttribute('id', id); + input.setAttribute('type', 'radio'); + input.setAttribute('value', id); + input.setAttribute('name', 'field'); + + var label = document.createElement('label'); + label.style.marginLeft = '4px'; + label.setAttribute('for', id); + label.innerHTML = name; + + div.appendChild(input); + div.appendChild(label); + + return div; +}; + +ViewerSelector.prototype.createButton_ = function(label, onclick) { + var button = document.createElement('button'); + button.innerHTML = label; + var s = button.style; + s.float = 'right'; + s.textTransform = 'uppercase'; + s.color = '#1094f7'; + s.fontSize = '14px'; + s.letterSpacing = 0; + s.border = 0; + s.background = 'none'; + s.marginTop = '16px'; + + button.addEventListener('click', onclick); + + return button; +}; + +module.exports = ViewerSelector; + +},{"./device-info.js":8,"./util.js":22,"eventemitter3":1}],24:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Util = _dereq_('./util.js'); + +/** + * Android and iOS compatible wakelock implementation. + * + * Refactored thanks to dkovalev@. + */ +function AndroidWakeLock() { + var video = document.createElement('video'); + + video.addEventListener('ended', function() { + video.play(); + }); + + this.request = function() { + if (video.paused) { + // Base64 version of videos_src/no-sleep-120s.mp4. + video.src = Util.base64('video/mp4', 'AAAAGGZ0eXBpc29tAAAAAG1wNDFhdmMxAAAIA21vb3YAAABsbXZoZAAAAADSa9v60mvb+gABX5AAlw/gAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAdkdHJhawAAAFx0a2hkAAAAAdJr2/rSa9v6AAAAAQAAAAAAlw/gAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAQAAAAHAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAJcP4AAAAAAAAQAAAAAG3G1kaWEAAAAgbWRoZAAAAADSa9v60mvb+gAPQkAGjneAFccAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kb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JlMFEw3//7B'); + video.play(); + } + }; + + this.release = function() { + video.pause(); + video.src = ''; + }; +} + +function iOSWakeLock() { + var timer = null; + + this.request = function() { + if (!timer) { + timer = setInterval(function() { + window.location = window.location; + setTimeout(window.stop, 0); + }, 30000); + } + } + + this.release = function() { + if (timer) { + clearInterval(timer); + timer = null; + } + } +} + + +function getWakeLock() { + var userAgent = navigator.userAgent || navigator.vendor || window.opera; + if (userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) { + return iOSWakeLock; + } else { + return AndroidWakeLock; + } +} + +module.exports = getWakeLock(); +},{"./util.js":22}],25:[function(_dereq_,module,exports){ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Util = _dereq_('./util.js'); +var CardboardVRDisplay = _dereq_('./cardboard-vr-display.js'); +var MouseKeyboardVRDisplay = _dereq_('./mouse-keyboard-vr-display.js'); +// Uncomment to add positional tracking via webcam. +//var WebcamPositionSensorVRDevice = require('./webcam-position-sensor-vr-device.js'); +var VRDisplay = _dereq_('./base.js').VRDisplay; +var VRFrameData = _dereq_('./base.js').VRFrameData; +var HMDVRDevice = _dereq_('./base.js').HMDVRDevice; +var PositionSensorVRDevice = _dereq_('./base.js').PositionSensorVRDevice; +var VRDisplayHMDDevice = _dereq_('./display-wrappers.js').VRDisplayHMDDevice; +var VRDisplayPositionSensorDevice = _dereq_('./display-wrappers.js').VRDisplayPositionSensorDevice; + +function WebVRPolyfill() { + this.displays = []; + this.devices = []; // For deprecated objects + this.devicesPopulated = false; + this.nativeWebVRAvailable = this.isWebVRAvailable(); + this.nativeLegacyWebVRAvailable = this.isDeprecatedWebVRAvailable(); + this.nativeGetVRDisplaysFunc = this.nativeWebVRAvailable ? + navigator.getVRDisplays : + null; + + if (!this.nativeLegacyWebVRAvailable) { + this.enablePolyfill(); + if (WebVRConfig.ENABLE_DEPRECATED_API) { + this.enableDeprecatedPolyfill(); + } + } + + // Put a shim in place to update the API to 1.1 if needed. + InstallWebVRSpecShim(); +} + +WebVRPolyfill.prototype.isWebVRAvailable = function() { + return ('getVRDisplays' in navigator); +}; + +WebVRPolyfill.prototype.isDeprecatedWebVRAvailable = function() { + return ('getVRDevices' in navigator) || ('mozGetVRDevices' in navigator); +}; + +WebVRPolyfill.prototype.populateDevices = function() { + if (this.devicesPopulated) { + return; + } + + // Initialize our virtual VR devices. + var vrDisplay = null; + + // Add a Cardboard VRDisplay on compatible mobile devices + if (this.isCardboardCompatible()) { + vrDisplay = new CardboardVRDisplay(); + this.displays.push(vrDisplay); + + // For backwards compatibility + if (WebVRConfig.ENABLE_DEPRECATED_API) { + this.devices.push(new VRDisplayHMDDevice(vrDisplay)); + this.devices.push(new VRDisplayPositionSensorDevice(vrDisplay)); + } + } + + // Add a Mouse and Keyboard driven VRDisplay for desktops/laptops + if (!this.isMobile() && !WebVRConfig.MOUSE_KEYBOARD_CONTROLS_DISABLED) { + vrDisplay = new MouseKeyboardVRDisplay(); + this.displays.push(vrDisplay); + + // For backwards compatibility + if (WebVRConfig.ENABLE_DEPRECATED_API) { + this.devices.push(new VRDisplayHMDDevice(vrDisplay)); + this.devices.push(new VRDisplayPositionSensorDevice(vrDisplay)); + } + } + + // Uncomment to add positional tracking via webcam. + //if (!this.isMobile() && WebVRConfig.ENABLE_DEPRECATED_API) { + // positionDevice = new WebcamPositionSensorVRDevice(); + // this.devices.push(positionDevice); + //} + + this.devicesPopulated = true; +}; + +WebVRPolyfill.prototype.enablePolyfill = function() { + // Provide navigator.getVRDisplays. + navigator.getVRDisplays = this.getVRDisplays.bind(this); + + // Provide the VRDisplay object. + window.VRDisplay = VRDisplay; + + // Provide navigator.vrEnabled. + var self = this; + Object.defineProperty(navigator, 'vrEnabled', { + get: function () { + return self.isCardboardCompatible() && + (self.isFullScreenAvailable() || Util.isIOS()); + } + }); + + if (!'VRFrameData' in window) { + // Provide the VRFrameData object. + window.VRFrameData = VRFrameData; + } +}; + +WebVRPolyfill.prototype.enableDeprecatedPolyfill = function() { + // Provide navigator.getVRDevices. + navigator.getVRDevices = this.getVRDevices.bind(this); + + // Provide the CardboardHMDVRDevice and PositionSensorVRDevice objects. + window.HMDVRDevice = HMDVRDevice; + window.PositionSensorVRDevice = PositionSensorVRDevice; +}; + +WebVRPolyfill.prototype.getVRDisplays = function() { + this.populateDevices(); + var polyfillDisplays = this.displays; + + if (this.nativeWebVRAvailable) { + return this.nativeGetVRDisplaysFunc.call(navigator).then(function(nativeDisplays) { + if (WebVRConfig.ALWAYS_APPEND_POLYFILL_DISPLAY) { + return nativeDisplays.concat(polyfillDisplays); + } else { + return nativeDisplays.length > 0 ? nativeDisplays : polyfillDisplays; + } + }); + } else { + return new Promise(function(resolve, reject) { + try { + resolve(polyfillDisplays); + } catch (e) { + reject(e); + } + }); + } +}; + +WebVRPolyfill.prototype.getVRDevices = function() { + console.warn('getVRDevices is deprecated. Please update your code to use getVRDisplays instead.'); + var self = this; + return new Promise(function(resolve, reject) { + try { + if (!self.devicesPopulated) { + if (self.nativeWebVRAvailable) { + return navigator.getVRDisplays(function(displays) { + for (var i = 0; i < displays.length; ++i) { + self.devices.push(new VRDisplayHMDDevice(displays[i])); + self.devices.push(new VRDisplayPositionSensorDevice(displays[i])); + } + self.devicesPopulated = true; + resolve(self.devices); + }, reject); + } + + if (self.nativeLegacyWebVRAvailable) { + return (navigator.getVRDDevices || navigator.mozGetVRDevices)(function(devices) { + for (var i = 0; i < devices.length; ++i) { + if (devices[i] instanceof HMDVRDevice) { + self.devices.push(devices[i]); + } + if (devices[i] instanceof PositionSensorVRDevice) { + self.devices.push(devices[i]); + } + } + self.devicesPopulated = true; + resolve(self.devices); + }, reject); + } + } + + self.populateDevices(); + resolve(self.devices); + } catch (e) { + reject(e); + } + }); +}; + +/** + * Determine if a device is mobile. + */ +WebVRPolyfill.prototype.isMobile = function() { + return /Android/i.test(navigator.userAgent) || + /iPhone|iPad|iPod/i.test(navigator.userAgent); +}; + +WebVRPolyfill.prototype.isCardboardCompatible = function() { + // For now, support all iOS and Android devices. + // Also enable the WebVRConfig.FORCE_VR flag for debugging. + return this.isMobile() || WebVRConfig.FORCE_ENABLE_VR; +}; + +WebVRPolyfill.prototype.isFullScreenAvailable = function() { + return (document.fullscreenEnabled || + document.mozFullScreenEnabled || + document.webkitFullscreenEnabled || + false); +}; + +// Installs a shim that updates a WebVR 1.0 spec implementation to WebVR 1.1 +function InstallWebVRSpecShim() { + if ('VRDisplay' in window && !('VRFrameData' in window)) { + // Provide the VRFrameData object. + window.VRFrameData = VRFrameData; + + // A lot of Chrome builds don't have depthNear and depthFar, even + // though they're in the WebVR 1.0 spec. Patch them in if they're not present. + if(!('depthNear' in window.VRDisplay.prototype)) { + window.VRDisplay.prototype.depthNear = 0.01; + } + + if(!('depthFar' in window.VRDisplay.prototype)) { + window.VRDisplay.prototype.depthFar = 10000.0; + } + + window.VRDisplay.prototype.getFrameData = function(frameData) { + return Util.frameDataFromPose(frameData, this.getPose(), this); + } + } +}; + +module.exports.WebVRPolyfill = WebVRPolyfill; + +},{"./base.js":3,"./cardboard-vr-display.js":6,"./display-wrappers.js":9,"./mouse-keyboard-vr-display.js":15,"./util.js":22}]},{},[13])(13) +}); \ No newline at end of file