From 6d21fc221eabf5703a126b2b963e494ddc92feaf Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 15 Jul 2013 19:38:23 +0200 Subject: [PATCH] r59 --- build/three.js | 8127 ++++++++++------- build/three.min.js | 1094 +-- docs/59/api/cameras/Camera.html | 53 + docs/59/api/cameras/OrthographicCamera.html | 70 + docs/59/api/cameras/PerspectiveCamera.html | 120 + docs/59/api/core/BufferGeometry.html | 156 + docs/59/api/core/Clock.html | 82 + docs/59/api/core/EventDispatcher.html | 66 + docs/59/api/core/Face3.html | 101 + docs/59/api/core/Face4.html | 108 + docs/59/api/core/Geometry.html | 308 + docs/59/api/core/Object3D.html | 282 + docs/59/api/core/Projector.html | 70 + docs/59/api/core/Raycaster.html | 91 + docs/59/api/extras/FontUtils.html | 108 + docs/59/api/extras/GeometryUtils.html | 102 + docs/59/api/extras/ImageUtils.html | 104 + docs/59/api/extras/SceneUtils.html | 51 + docs/59/api/extras/animation/Animation.html | 144 + .../extras/animation/AnimationHandler.html | 97 + .../animation/AnimationMorphTarget.html | 105 + .../extras/animation/KeyFrameAnimation.html | 133 + .../59/api/extras/cameras/CombinedCamera.html | 184 + docs/59/api/extras/cameras/CubeCamera.html | 55 + docs/59/api/extras/core/Curve.html | 61 + docs/59/api/extras/core/CurvePath.html | 136 + docs/59/api/extras/core/Gyroscope.html | 66 + docs/59/api/extras/core/Path.html | 75 + docs/59/api/extras/core/Shape.html | 95 + .../api/extras/geometries/CircleGeometry.html | 30 + .../api/extras/geometries/ConvexGeometry.html | 33 + .../api/extras/geometries/CubeGeometry.html | 40 + .../extras/geometries/CylinderGeometry.html | 42 + .../extras/geometries/ExtrudeGeometry.html | 54 + .../geometries/IcosahedronGeometry.html | 38 + .../api/extras/geometries/LatheGeometry.html | 36 + .../extras/geometries/OctahedronGeometry.html | 33 + .../extras/geometries/ParametricGeometry.html | 36 + .../api/extras/geometries/PlaneGeometry.html | 39 + .../extras/geometries/PolyhedronGeometry.html | 36 + .../api/extras/geometries/RingGeometry.html | 35 + .../api/extras/geometries/ShapeGeometry.html | 65 + .../api/extras/geometries/SphereGeometry.html | 47 + .../geometries/TetrahedronGeometry.html | 31 + .../api/extras/geometries/TextGeometry.html | 42 + .../api/extras/geometries/TorusGeometry.html | 40 + .../extras/geometries/TorusKnotGeometry.html | 44 + .../api/extras/geometries/TubeGeometry.html | 91 + docs/59/api/extras/helpers/ArrowHelper.html | 76 + docs/59/api/extras/helpers/AxisHelper.html | 30 + docs/59/api/extras/helpers/BoxHelper.html | 49 + docs/59/api/extras/helpers/CameraHelper.html | 52 + .../helpers/DirectionalLightHelper.html | 58 + docs/59/api/extras/helpers/GridHelper.html | 32 + .../extras/helpers/HemisphereLightHelper.html | 56 + .../api/extras/helpers/PointLightHelper.html | 53 + .../api/extras/helpers/SpotLightHelper.html | 58 + .../extras/objects/ImmediateRenderObject.html | 39 + docs/59/api/extras/objects/LensFlare.html | 63 + .../59/api/extras/objects/MorphBlendMesh.html | 160 + .../renderers/plugins/DepthPassPlugin.html | 72 + .../renderers/plugins/LensFlarePlugin.html | 52 + .../renderers/plugins/ShadowMapPlugin.html | 58 + .../renderers/plugins/SpritePlugin.html | 51 + docs/59/api/extras/shaders/ShaderFlares.html | 33 + docs/59/api/extras/shaders/ShaderSprite.html | 29 + docs/59/api/lights/AmbientLight.html | 40 + docs/59/api/lights/AreaLight.html | 86 + docs/59/api/lights/DirectionalLight.html | 210 + docs/59/api/lights/HemisphereLight.html | 48 + docs/59/api/lights/Light.html | 40 + docs/59/api/lights/PointLight.html | 61 + docs/59/api/lights/SpotLight.html | 197 + docs/59/api/loaders/GeometryLoader.html | 87 + docs/59/api/loaders/ImageLoader.html | 97 + docs/59/api/loaders/JSONLoader.html | 70 + docs/59/api/loaders/Loader.html | 106 + docs/59/api/loaders/LoadingMonitor.html | 89 + docs/59/api/loaders/MaterialLoader.html | 83 + docs/59/api/loaders/SceneLoader.html | 98 + docs/59/api/loaders/TextureLoader.html | 98 + docs/59/api/materials/LineBasicMaterial.html | 62 + docs/59/api/materials/LineDashedMaterial.html | 76 + docs/59/api/materials/Material.html | 188 + docs/59/api/materials/MeshBasicMaterial.html | 112 + docs/59/api/materials/MeshDepthMaterial.html | 51 + docs/59/api/materials/MeshFaceMaterial.html | 46 + .../59/api/materials/MeshLambertMaterial.html | 126 + docs/59/api/materials/MeshNormalMaterial.html | 61 + docs/59/api/materials/MeshPhongMaterial.html | 164 + .../api/materials/ParticleBasicMaterial.html | 65 + .../api/materials/ParticleCanvasMaterial.html | 55 + docs/59/api/materials/ShaderMaterial.html | 116 + docs/59/api/materials/SpriteMaterial.html | 83 + docs/59/api/math/Box2.html | 233 + docs/59/api/math/Box3.html | 235 + docs/59/api/math/Color.html | 197 + docs/59/api/math/Frustum.html | 95 + docs/59/api/math/Line3.html | 142 + docs/59/api/math/Math.html | 115 + docs/59/api/math/Matrix3.html | 133 + docs/59/api/math/Matrix4.html | 247 + docs/59/api/math/Plane.html | 193 + docs/59/api/math/Quaternion.html | 172 + docs/59/api/math/Ray.html | 154 + docs/59/api/math/Sphere.html | 151 + docs/59/api/math/Spline.html | 64 + docs/59/api/math/Triangle.html | 144 + docs/59/api/math/Vector2.html | 229 + docs/59/api/math/Vector3.html | 402 + docs/59/api/math/Vector4.html | 261 + docs/59/api/objects/Bone.html | 60 + docs/59/api/objects/LOD.html | 68 + docs/59/api/objects/Line.html | 58 + docs/59/api/objects/Mesh.html | 82 + docs/59/api/objects/MorphAnimMesh.html | 144 + docs/59/api/objects/Particle.html | 46 + docs/59/api/objects/ParticleSystem.html | 52 + docs/59/api/objects/Ribbon.html | 52 + docs/59/api/objects/SkinnedMesh.html | 76 + docs/59/api/objects/Sprite.html | 51 + docs/59/api/renderers/CanvasRenderer.html | 137 + docs/59/api/renderers/WebGLRenderTarget.html | 44 + .../api/renderers/WebGLRenderTargetCube.html | 44 + docs/59/api/renderers/WebGLRenderer.html | 371 + docs/59/api/renderers/WebGLShaders.html | 32 + .../renderables/RenderableFace3.html | 104 + .../renderables/RenderableFace4.html | 109 + .../renderers/renderables/RenderableLine.html | 59 + .../renderables/RenderableObject.html | 49 + .../renderables/RenderableParticle.html | 74 + .../renderables/RenderableVertex.html | 62 + docs/59/api/scenes/Fog.html | 46 + docs/59/api/scenes/FogExp2.html | 43 + docs/59/api/scenes/Scene.html | 50 + docs/59/api/textures/CompressedTexture.html | 51 + docs/59/api/textures/DataTexture.html | 49 + docs/59/api/textures/Texture.html | 152 + docs/59/files/inconsolata.woff | Bin 0 -> 28040 bytes docs/59/index.html | 194 + docs/59/list.js | 227 + .../manual/introduction/Creating-a-scene.html | 155 + docs/59/page.css | 87 + docs/59/page.js | 97 + docs/59/prettify/prettify.css | 1 + docs/59/prettify/prettify.js | 28 + docs/59/prettify/readme.txt | 5 + docs/59/prettify/threejs.css | 15 + docs/index.html | 2 +- editor/index.html | 479 +- editor/js/Editor.js | 270 + editor/js/Loader.js | 381 + editor/js/{ui => }/Menubar.Add.js | 91 +- editor/js/Menubar.Edit.js | 87 + editor/js/{ui => }/Menubar.File.js | 33 +- editor/js/{ui => }/Menubar.Help.js | 2 +- editor/js/Menubar.js | 14 + editor/js/Sidebar.Animation.js | 96 + .../{ui => }/Sidebar.Geometry.CubeGeometry.js | 0 .../Sidebar.Geometry.CylinderGeometry.js | 0 .../Sidebar.Geometry.IcosahedronGeometry.js | 0 .../Sidebar.Geometry.PlaneGeometry.js | 0 .../Sidebar.Geometry.SphereGeometry.js | 0 .../Sidebar.Geometry.TorusGeometry.js | 0 .../Sidebar.Geometry.TorusKnotGeometry.js | 0 editor/js/{ui => }/Sidebar.Geometry.js | 22 +- editor/js/{ui => }/Sidebar.Material.js | 186 +- editor/js/{ui => }/Sidebar.Object3D.js | 322 +- editor/js/{ui => }/Sidebar.Renderer.js | 4 +- editor/js/{ui => }/Sidebar.Scene.js | 93 +- editor/js/Sidebar.js | 16 + editor/js/Toolbar.js | 56 + editor/js/{ui => }/Viewport.js | 355 +- editor/js/{UI.js => libs/ui.js} | 217 +- editor/js/{UI.three.js => libs/ui.three.js} | 43 +- editor/js/ui/Menubar.Edit.js | 42 - editor/js/ui/Menubar.js | 14 - editor/js/ui/Sidebar.js | 15 - editor/js/ui/Toolbar.js | 55 - examples/canvas_geometry_earth.html | 30 +- examples/canvas_geometry_nurbs.html | 240 + examples/canvas_interactive_cubes.html | 1 - examples/canvas_interactive_lines.html | 230 + examples/canvas_interactive_particles.html | 2 - examples/canvas_lines.html | 1 - examples/canvas_lines_dashed.html | 244 + examples/canvas_lines_sphere.html | 1 - examples/canvas_materials.html | 1 - examples/canvas_materials_video.html | 1 - examples/canvas_particles_random.html | 1 - examples/canvas_particles_shapes.html | 2 - examples/css3d_molecules.html | 55 +- examples/css3d_periodictable.html | 263 +- examples/css3d_sprites.html | 235 + examples/css3d_youtube.html | 259 +- examples/js/Octree.js | 2056 +++++ examples/js/controls/EditorControls.js | 12 +- examples/js/controls/FlyControls.js | 4 +- examples/js/controls/OculusControls.js | 64 + examples/js/controls/TrackballControls.js | 54 +- examples/js/controls/TransformControls.js | 946 ++ examples/js/curves/NURBSCurve.js | 56 + examples/js/curves/NURBSSurface.js | 49 + examples/js/curves/NURBSUtils.js | 394 + examples/js/effects/AnaglyphEffect.js | 7 + examples/js/effects/OculusRiftEffect.js | 44 +- examples/js/exporters/GeometryExporter.js | 126 +- examples/js/exporters/HTMLExporter.js | 17 + examples/js/exporters/MaterialExporter.js | 7 +- examples/js/exporters/ObjectExporter.js | 50 +- examples/js/exporters/STLExporter.js | 96 + examples/js/geometries/ConvexGeometry.js | 223 + examples/js/loaders/BinaryLoader.js | 60 +- examples/js/loaders/ColladaLoader.js | 183 +- examples/js/loaders/MTLLoader.js | 52 +- examples/js/loaders/OBJLoader.js | 41 +- examples/js/loaders/OBJMTLLoader.js | 7 +- examples/js/loaders/ObjectLoader.js | 287 - examples/js/loaders/PDBLoader.js | 258 +- examples/js/loaders/PLYLoader.js | 7 +- examples/js/loaders/STLLoader.js | 299 +- examples/js/loaders/VRMLLoader.js | 376 + examples/js/loaders/VTKLoader.js | 7 +- .../js/loaders/deprecated/ObjectLoader4.js | 299 + .../js/loaders/deprecated/ObjectLoader41.js | 297 + examples/js/renderers/CSS3DRenderer.js | 166 +- examples/js/renderers/SVGRenderer.js | 7 - .../js/renderers/WebGLDeferredRenderer.js | 32 +- .../js/renderers/WebGLRenderer2/README.md | 2 + .../WebGLRenderer2/WebGLRenderer2.js | 3274 +++++++ .../WebGLRenderer2/webgl/LowLevelRenderer.js | 1570 ++++ .../WebGLRenderer2/webgl/ShaderBuilder.js | 413 + .../webgl/objects/LineRenderer.js | 206 + .../webgl/objects/MeshRenderer.js | 1618 ++++ .../webgl/objects/Object3DRenderer.js | 127 + .../webgl/objects/ParticleRenderer.js | 360 + .../webgl/objects/RibbonRenderer.js | 209 + examples/js/renderers/WebGLRenderer3.js | 461 +- examples/js/shaders/FXAAShader.js | 15 +- examples/misc_controls_oculusrift.html | 161 + examples/misc_controls_transform.html | 115 + examples/misc_uv_tests.html | 207 +- examples/models/collada/multimaterial.dae | 317 + examples/scenes/test_scene.js | 633 +- examples/textures/sprite.png | Bin 0 -> 18971 bytes examples/webgl3_performance.html | 12 +- examples/webgl_buffergeometry.html | 12 +- ...rgeometry_custom_attributes_particles.html | 9 +- examples/webgl_buffergeometry_lines.html | 6 +- examples/webgl_buffergeometry_particles.html | 6 +- examples/webgl_geometries.html | 38 +- examples/webgl_geometry_convex.html | 1 + examples/webgl_geometry_extrude_shapes.html | 3 - examples/webgl_geometry_extrude_splines.html | 4 +- examples/webgl_geometry_minecraft_ao.html | 39 +- examples/webgl_geometry_normals.html | 92 +- examples/webgl_geometry_nurbs.html | 290 + examples/webgl_geometry_subdivision.html | 155 +- examples/webgl_geometry_terrain_raycast.html | 292 + examples/webgl_helpers.html | 108 + examples/webgl_loader_obj.html | 25 +- examples/webgl_loader_scene.html | 6 + examples/webgl_marching_cubes.html | 2 +- examples/webgl_materials_grass.html | 1 - examples/webgl_multiple_canvases_circle.html | 2 +- examples/webgl_multiple_windows.html | 732 ++ examples/webgl_octree.html | 239 + examples/webgl_particles_shapes.html | 2 - examples/webgl_performance.html | 1 - examples/webgldeferred_arealights.html | 2 +- index.html | 2 +- 271 files changed, 38350 insertions(+), 7296 deletions(-) create mode 100644 docs/59/api/cameras/Camera.html create mode 100644 docs/59/api/cameras/OrthographicCamera.html create mode 100644 docs/59/api/cameras/PerspectiveCamera.html create mode 100644 docs/59/api/core/BufferGeometry.html create mode 100644 docs/59/api/core/Clock.html create mode 100644 docs/59/api/core/EventDispatcher.html create mode 100644 docs/59/api/core/Face3.html create mode 100644 docs/59/api/core/Face4.html create mode 100644 docs/59/api/core/Geometry.html create mode 100644 docs/59/api/core/Object3D.html create mode 100644 docs/59/api/core/Projector.html create mode 100644 docs/59/api/core/Raycaster.html create mode 100644 docs/59/api/extras/FontUtils.html create mode 100644 docs/59/api/extras/GeometryUtils.html create mode 100644 docs/59/api/extras/ImageUtils.html create mode 100644 docs/59/api/extras/SceneUtils.html create mode 100644 docs/59/api/extras/animation/Animation.html create mode 100644 docs/59/api/extras/animation/AnimationHandler.html create mode 100644 docs/59/api/extras/animation/AnimationMorphTarget.html create mode 100644 docs/59/api/extras/animation/KeyFrameAnimation.html create mode 100644 docs/59/api/extras/cameras/CombinedCamera.html create mode 100644 docs/59/api/extras/cameras/CubeCamera.html create mode 100644 docs/59/api/extras/core/Curve.html create mode 100644 docs/59/api/extras/core/CurvePath.html create mode 100644 docs/59/api/extras/core/Gyroscope.html create mode 100644 docs/59/api/extras/core/Path.html create mode 100644 docs/59/api/extras/core/Shape.html create mode 100644 docs/59/api/extras/geometries/CircleGeometry.html create mode 100644 docs/59/api/extras/geometries/ConvexGeometry.html create mode 100644 docs/59/api/extras/geometries/CubeGeometry.html create mode 100644 docs/59/api/extras/geometries/CylinderGeometry.html create mode 100644 docs/59/api/extras/geometries/ExtrudeGeometry.html create mode 100644 docs/59/api/extras/geometries/IcosahedronGeometry.html create mode 100644 docs/59/api/extras/geometries/LatheGeometry.html create mode 100644 docs/59/api/extras/geometries/OctahedronGeometry.html create mode 100644 docs/59/api/extras/geometries/ParametricGeometry.html create mode 100644 docs/59/api/extras/geometries/PlaneGeometry.html create mode 100644 docs/59/api/extras/geometries/PolyhedronGeometry.html create mode 100644 docs/59/api/extras/geometries/RingGeometry.html create mode 100644 docs/59/api/extras/geometries/ShapeGeometry.html create mode 100644 docs/59/api/extras/geometries/SphereGeometry.html create mode 100644 docs/59/api/extras/geometries/TetrahedronGeometry.html create mode 100644 docs/59/api/extras/geometries/TextGeometry.html create mode 100644 docs/59/api/extras/geometries/TorusGeometry.html create mode 100644 docs/59/api/extras/geometries/TorusKnotGeometry.html create mode 100644 docs/59/api/extras/geometries/TubeGeometry.html create mode 100644 docs/59/api/extras/helpers/ArrowHelper.html create mode 100644 docs/59/api/extras/helpers/AxisHelper.html create mode 100644 docs/59/api/extras/helpers/BoxHelper.html create mode 100644 docs/59/api/extras/helpers/CameraHelper.html create mode 100644 docs/59/api/extras/helpers/DirectionalLightHelper.html create mode 100644 docs/59/api/extras/helpers/GridHelper.html create mode 100644 docs/59/api/extras/helpers/HemisphereLightHelper.html create mode 100644 docs/59/api/extras/helpers/PointLightHelper.html create mode 100644 docs/59/api/extras/helpers/SpotLightHelper.html create mode 100644 docs/59/api/extras/objects/ImmediateRenderObject.html create mode 100644 docs/59/api/extras/objects/LensFlare.html create mode 100644 docs/59/api/extras/objects/MorphBlendMesh.html create mode 100644 docs/59/api/extras/renderers/plugins/DepthPassPlugin.html create mode 100644 docs/59/api/extras/renderers/plugins/LensFlarePlugin.html create mode 100644 docs/59/api/extras/renderers/plugins/ShadowMapPlugin.html create mode 100644 docs/59/api/extras/renderers/plugins/SpritePlugin.html create mode 100644 docs/59/api/extras/shaders/ShaderFlares.html create mode 100644 docs/59/api/extras/shaders/ShaderSprite.html create mode 100644 docs/59/api/lights/AmbientLight.html create mode 100644 docs/59/api/lights/AreaLight.html create mode 100644 docs/59/api/lights/DirectionalLight.html create mode 100644 docs/59/api/lights/HemisphereLight.html create mode 100644 docs/59/api/lights/Light.html create mode 100644 docs/59/api/lights/PointLight.html create mode 100644 docs/59/api/lights/SpotLight.html create mode 100644 docs/59/api/loaders/GeometryLoader.html create mode 100644 docs/59/api/loaders/ImageLoader.html create mode 100644 docs/59/api/loaders/JSONLoader.html create mode 100644 docs/59/api/loaders/Loader.html create mode 100644 docs/59/api/loaders/LoadingMonitor.html create mode 100644 docs/59/api/loaders/MaterialLoader.html create mode 100644 docs/59/api/loaders/SceneLoader.html create mode 100644 docs/59/api/loaders/TextureLoader.html create mode 100644 docs/59/api/materials/LineBasicMaterial.html create mode 100644 docs/59/api/materials/LineDashedMaterial.html create mode 100644 docs/59/api/materials/Material.html create mode 100644 docs/59/api/materials/MeshBasicMaterial.html create mode 100644 docs/59/api/materials/MeshDepthMaterial.html create mode 100644 docs/59/api/materials/MeshFaceMaterial.html create mode 100644 docs/59/api/materials/MeshLambertMaterial.html create mode 100644 docs/59/api/materials/MeshNormalMaterial.html create mode 100644 docs/59/api/materials/MeshPhongMaterial.html create mode 100644 docs/59/api/materials/ParticleBasicMaterial.html create mode 100644 docs/59/api/materials/ParticleCanvasMaterial.html create mode 100644 docs/59/api/materials/ShaderMaterial.html create mode 100644 docs/59/api/materials/SpriteMaterial.html create mode 100644 docs/59/api/math/Box2.html create mode 100644 docs/59/api/math/Box3.html create mode 100644 docs/59/api/math/Color.html create mode 100644 docs/59/api/math/Frustum.html create mode 100644 docs/59/api/math/Line3.html create mode 100644 docs/59/api/math/Math.html create mode 100644 docs/59/api/math/Matrix3.html create mode 100644 docs/59/api/math/Matrix4.html create mode 100644 docs/59/api/math/Plane.html create mode 100644 docs/59/api/math/Quaternion.html create mode 100644 docs/59/api/math/Ray.html create mode 100644 docs/59/api/math/Sphere.html create mode 100644 docs/59/api/math/Spline.html create mode 100644 docs/59/api/math/Triangle.html create mode 100644 docs/59/api/math/Vector2.html create mode 100644 docs/59/api/math/Vector3.html create mode 100644 docs/59/api/math/Vector4.html create mode 100644 docs/59/api/objects/Bone.html create mode 100644 docs/59/api/objects/LOD.html create mode 100644 docs/59/api/objects/Line.html create mode 100644 docs/59/api/objects/Mesh.html create mode 100644 docs/59/api/objects/MorphAnimMesh.html create mode 100644 docs/59/api/objects/Particle.html create mode 100644 docs/59/api/objects/ParticleSystem.html create mode 100644 docs/59/api/objects/Ribbon.html create mode 100644 docs/59/api/objects/SkinnedMesh.html create mode 100644 docs/59/api/objects/Sprite.html create mode 100644 docs/59/api/renderers/CanvasRenderer.html create mode 100644 docs/59/api/renderers/WebGLRenderTarget.html create mode 100644 docs/59/api/renderers/WebGLRenderTargetCube.html create mode 100644 docs/59/api/renderers/WebGLRenderer.html create mode 100644 docs/59/api/renderers/WebGLShaders.html create mode 100644 docs/59/api/renderers/renderables/RenderableFace3.html create mode 100644 docs/59/api/renderers/renderables/RenderableFace4.html create mode 100644 docs/59/api/renderers/renderables/RenderableLine.html create mode 100644 docs/59/api/renderers/renderables/RenderableObject.html create mode 100644 docs/59/api/renderers/renderables/RenderableParticle.html create mode 100644 docs/59/api/renderers/renderables/RenderableVertex.html create mode 100644 docs/59/api/scenes/Fog.html create mode 100644 docs/59/api/scenes/FogExp2.html create mode 100644 docs/59/api/scenes/Scene.html create mode 100644 docs/59/api/textures/CompressedTexture.html create mode 100644 docs/59/api/textures/DataTexture.html create mode 100644 docs/59/api/textures/Texture.html create mode 100644 docs/59/files/inconsolata.woff create mode 100644 docs/59/index.html create mode 100644 docs/59/list.js create mode 100644 docs/59/manual/introduction/Creating-a-scene.html create mode 100644 docs/59/page.css create mode 100644 docs/59/page.js create mode 100644 docs/59/prettify/prettify.css create mode 100644 docs/59/prettify/prettify.js create mode 100644 docs/59/prettify/readme.txt create mode 100644 docs/59/prettify/threejs.css create mode 100644 editor/js/Editor.js create mode 100644 editor/js/Loader.js rename editor/js/{ui => }/Menubar.Add.js (72%) create mode 100644 editor/js/Menubar.Edit.js rename editor/js/{ui => }/Menubar.File.js (85%) rename editor/js/{ui => }/Menubar.Help.js (96%) create mode 100644 editor/js/Menubar.js create mode 100644 editor/js/Sidebar.Animation.js rename editor/js/{ui => }/Sidebar.Geometry.CubeGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.CylinderGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.IcosahedronGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.PlaneGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.SphereGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.TorusGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.TorusKnotGeometry.js (100%) rename editor/js/{ui => }/Sidebar.Geometry.js (93%) rename editor/js/{ui => }/Sidebar.Material.js (82%) rename editor/js/{ui => }/Sidebar.Object3D.js (59%) rename editor/js/{ui => }/Sidebar.Renderer.js (96%) rename editor/js/{ui => }/Sidebar.Scene.js (82%) create mode 100644 editor/js/Sidebar.js create mode 100644 editor/js/Toolbar.js rename editor/js/{ui => }/Viewport.js (50%) rename editor/js/{UI.js => libs/ui.js} (82%) rename editor/js/{UI.three.js => libs/ui.three.js} (75%) delete mode 100644 editor/js/ui/Menubar.Edit.js delete mode 100644 editor/js/ui/Menubar.js delete mode 100644 editor/js/ui/Sidebar.js delete mode 100644 editor/js/ui/Toolbar.js create mode 100644 examples/canvas_geometry_nurbs.html create mode 100644 examples/canvas_interactive_lines.html create mode 100644 examples/canvas_lines_dashed.html create mode 100644 examples/css3d_sprites.html create mode 100644 examples/js/Octree.js create mode 100644 examples/js/controls/OculusControls.js create mode 100644 examples/js/controls/TransformControls.js create mode 100644 examples/js/curves/NURBSCurve.js create mode 100644 examples/js/curves/NURBSSurface.js create mode 100644 examples/js/curves/NURBSUtils.js create mode 100644 examples/js/exporters/HTMLExporter.js create mode 100644 examples/js/exporters/STLExporter.js create mode 100644 examples/js/geometries/ConvexGeometry.js delete mode 100644 examples/js/loaders/ObjectLoader.js create mode 100644 examples/js/loaders/VRMLLoader.js create mode 100644 examples/js/loaders/deprecated/ObjectLoader4.js create mode 100644 examples/js/loaders/deprecated/ObjectLoader41.js create mode 100644 examples/js/renderers/WebGLRenderer2/README.md create mode 100644 examples/js/renderers/WebGLRenderer2/WebGLRenderer2.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/LowLevelRenderer.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/ShaderBuilder.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/objects/LineRenderer.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/objects/MeshRenderer.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/objects/Object3DRenderer.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/objects/ParticleRenderer.js create mode 100644 examples/js/renderers/WebGLRenderer2/webgl/objects/RibbonRenderer.js create mode 100644 examples/misc_controls_oculusrift.html create mode 100644 examples/misc_controls_transform.html create mode 100644 examples/models/collada/multimaterial.dae create mode 100644 examples/textures/sprite.png create mode 100644 examples/webgl_geometry_nurbs.html create mode 100644 examples/webgl_geometry_terrain_raycast.html create mode 100644 examples/webgl_helpers.html create mode 100644 examples/webgl_multiple_windows.html create mode 100644 examples/webgl_octree.html diff --git a/build/three.js b/build/three.js index da6816dafd..d121ea605f 100644 --- a/build/three.js +++ b/build/three.js @@ -1,9 +1,10 @@ /** * @author mrdoob / http://mrdoob.com/ * @author Larry Battle / http://bateru.com/news + * @author bhouston / http://exocortex.com */ -var THREE = THREE || { REVISION: '58' }; +var THREE = THREE || { REVISION: '59' }; self.console = self.console || { @@ -15,9 +16,6 @@ self.console = self.console || { }; -self.Int32Array = self.Int32Array || Array; -self.Float32Array = self.Float32Array || Array; - String.prototype.trim = String.prototype.trim || function () { return this.replace( /^\s+|\s+$/g, '' ); @@ -64,25 +62,25 @@ THREE.extend = function ( obj, source ) { // requestAnimationFrame polyfill by Erik Möller // fixes from Paul Irish and Tino Zijdel - +// using 'self' instead of 'window' for compatibility with both NodeJS and IE10. ( function () { var lastTime = 0; var vendors = [ 'ms', 'moz', 'webkit', 'o' ]; - for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++ x ) { + for ( var x = 0; x < vendors.length && !self.requestAnimationFrame; ++ x ) { - window.requestAnimationFrame = window[ vendors[ x ] + 'RequestAnimationFrame' ]; - window.cancelAnimationFrame = window[ vendors[ x ] + 'CancelAnimationFrame' ] || window[ vendors[ x ] + 'CancelRequestAnimationFrame' ]; + self.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ]; + self.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] || self[ vendors[ x ] + 'CancelRequestAnimationFrame' ]; } - if ( window.requestAnimationFrame === undefined ) { + if ( self.requestAnimationFrame === undefined && self['setTimeout'] !== undefined ) { - window.requestAnimationFrame = function ( callback ) { + self.requestAnimationFrame = function ( callback ) { var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); - var id = window.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall ); + var id = self.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall ); lastTime = currTime + timeToCall; return id; @@ -90,7 +88,11 @@ THREE.extend = function ( obj, source ) { } - window.cancelAnimationFrame = window.cancelAnimationFrame || function ( id ) { window.clearTimeout( id ) }; + if( self.cancelAnimationFrame === undefined && self['clearTimeout'] !== undefined ) { + + self.cancelAnimationFrame = function ( id ) { self.clearTimeout( id ) }; + + } }() ); @@ -241,6 +243,7 @@ THREE.RGB_PVRTC_2BPPV1_Format = 2101; THREE.RGBA_PVRTC_4BPPV1_Format = 2102; THREE.RGBA_PVRTC_2BPPV1_Format = 2103; */ + /** * @author mrdoob / http://mrdoob.com/ */ @@ -631,6 +634,7 @@ THREE.ColorKeywords = { "aliceblue": 0xF0F8FF, "antiquewhite": 0xFAEBD7, "aqua": "sienna": 0xA0522D, "silver": 0xC0C0C0, "skyblue": 0x87CEEB, "slateblue": 0x6A5ACD, "slategray": 0x708090, "slategrey": 0x708090, "snow": 0xFFFAFA, "springgreen": 0x00FF7F, "steelblue": 0x4682B4, "tan": 0xD2B48C, "teal": 0x008080, "thistle": 0xD8BFD8, "tomato": 0xFF6347, "turquoise": 0x40E0D0, "violet": 0xEE82EE, "wheat": 0xF5DEB3, "white": 0xFFFFFF, "whitesmoke": 0xF5F5F5, "yellow": 0xFFFF00, "yellowgreen": 0x9ACD32 }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -638,12 +642,12 @@ THREE.ColorKeywords = { "aliceblue": 0xF0F8FF, "antiquewhite": 0xFAEBD7, "aqua": * @author bhouston / http://exocortex.com */ -THREE.Quaternion = function( x, y, z, w ) { +THREE.Quaternion = function ( x, y, z, w ) { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = ( w !== undefined ) ? w : 1; + this._x = x || 0; + this._y = y || 0; + this._z = z || 0; + this._w = ( w !== undefined ) ? w : 1; }; @@ -651,85 +655,162 @@ THREE.Quaternion.prototype = { constructor: THREE.Quaternion, + _x: 0,_y: 0, _z: 0, _w: 0, + + _euler: undefined, + + _updateEuler: function ( callback ) { + + if ( this._euler !== undefined ) { + + this._euler.setFromQuaternion( this, undefined, false ); + + } + + }, + + get x () { + + return this._x; + + }, + + set x ( value ) { + + this._x = value; + this._updateEuler(); + + }, + + get y () { + + return this._y; + + }, + + set y ( value ) { + + this._y = value; + this._updateEuler(); + + }, + + get z () { + + return this._z; + + }, + + set z ( value ) { + + this._z = value; + this._updateEuler(); + + }, + + get w () { + + return this._w; + + }, + + set w ( value ) { + + this._w = value; + this._updateEuler(); + + }, + set: function ( x, y, z, w ) { - this.x = x; - this.y = y; - this.z = z; - this.w = w; + this._x = x; + this._y = y; + this._z = z; + this._w = w; + + this._updateEuler(); return this; }, - copy: function ( q ) { + copy: function ( quaternion ) { + + this._x = quaternion._x; + this._y = quaternion._y; + this._z = quaternion._z; + this._w = quaternion._w; - this.x = q.x; - this.y = q.y; - this.z = q.z; - this.w = q.w; + this._updateEuler(); return this; }, - setFromEuler: function ( v, order ) { + setFromEuler: function ( euler, update ) { + + if ( typeof euler['order'] === undefined ) { + + console.error( 'ERROR: Quaternion\'s .setFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); + } // http://www.mathworks.com/matlabcentral/fileexchange/ // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ // content/SpinCalc.m - var c1 = Math.cos( v.x / 2 ); - var c2 = Math.cos( v.y / 2 ); - var c3 = Math.cos( v.z / 2 ); - var s1 = Math.sin( v.x / 2 ); - var s2 = Math.sin( v.y / 2 ); - var s3 = Math.sin( v.z / 2 ); + var c1 = Math.cos( euler._x / 2 ); + var c2 = Math.cos( euler._y / 2 ); + var c3 = Math.cos( euler._z / 2 ); + var s1 = Math.sin( euler._x / 2 ); + var s2 = Math.sin( euler._y / 2 ); + var s3 = Math.sin( euler._z / 2 ); - if ( order === undefined || order === 'XYZ' ) { + if ( euler.order === undefined || euler.order === 'XYZ' ) { - 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; + 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; - } else if ( order === 'YXZ' ) { + } else if ( euler.order === 'YXZ' ) { - 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; + 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; - } else if ( order === 'ZXY' ) { + } else if ( euler.order === 'ZXY' ) { - 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; + 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; - } else if ( order === 'ZYX' ) { + } else if ( euler.order === 'ZYX' ) { - 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; + 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; - } else if ( order === 'YZX' ) { + } else if ( euler.order === 'YZX' ) { - 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; + 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; - } else if ( order === 'XZY' ) { + } else if ( euler.order === 'XZY' ) { - 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; + 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; } + if ( update !== false ) this._updateEuler(); + return this; }, @@ -739,13 +820,14 @@ THREE.Quaternion.prototype = { // from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm // axis have to be normalized - var halfAngle = angle / 2, - s = Math.sin( halfAngle ); + 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 ); - this.x = axis.x * s; - this.y = axis.y * s; - this.z = axis.z * s; - this.w = Math.cos( halfAngle ); + this._updateEuler(); return this; @@ -770,40 +852,42 @@ THREE.Quaternion.prototype = { s = 0.5 / Math.sqrt( trace + 1.0 ); - this.w = 0.25 / s; - this.x = ( m32 - m23 ) * s; - this.y = ( m13 - m31 ) * s; - this.z = ( m21 - m12 ) * s; + this._w = 0.25 / s; + this._x = ( m32 - m23 ) * s; + this._y = ( m13 - m31 ) * s; + this._z = ( m21 - m12 ) * s; } else if ( m11 > m22 && m11 > m33 ) { s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - this.w = (m32 - m23 ) / s; - this.x = 0.25 * s; - this.y = (m12 + m21 ) / s; - this.z = (m13 + m31 ) / s; + this._w = (m32 - m23 ) / s; + this._x = 0.25 * s; + this._y = (m12 + m21 ) / s; + this._z = (m13 + m31 ) / s; } else if ( m22 > m33 ) { s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - this.w = (m13 - m31 ) / s; - this.x = (m12 + m21 ) / s; - this.y = 0.25 * s; - this.z = (m23 + m32 ) / s; + this._w = (m13 - m31 ) / s; + this._x = (m12 + m21 ) / s; + this._y = 0.25 * s; + this._z = (m23 + m32 ) / s; } else { s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - this.w = ( m21 - m12 ) / s; - this.x = ( m13 + m31 ) / s; - this.y = ( m23 + m32 ) / s; - this.z = 0.25 * s; + this._w = ( m21 - m12 ) / s; + this._x = ( m13 + m31 ) / s; + this._y = ( m23 + m32 ) / s; + this._z = 0.25 * s; } + this._updateEuler(); + return this; }, @@ -818,9 +902,11 @@ THREE.Quaternion.prototype = { conjugate: function () { - this.x *= -1; - this.y *= -1; - this.z *= -1; + this._x *= -1; + this._y *= -1; + this._z *= -1; + + this._updateEuler(); return this; @@ -828,13 +914,13 @@ THREE.Quaternion.prototype = { lengthSq: function () { - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; + 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 ); + return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); }, @@ -844,19 +930,19 @@ THREE.Quaternion.prototype = { if ( l === 0 ) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; + 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; + this._x = this._x * l; + this._y = this._y * l; + this._z = this._z * l; + this._w = this._w * l; } @@ -881,13 +967,15 @@ THREE.Quaternion.prototype = { // 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; + 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; - 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; + this._updateEuler(); return this; @@ -902,18 +990,18 @@ THREE.Quaternion.prototype = { slerp: function ( qb, t ) { - var x = this.x, y = this.y, z = this.z, w = this.w; + 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; + 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; + this._w = -qb._w; + this._x = -qb._x; + this._y = -qb._y; + this._z = -qb._z; cosHalfTheta = -cosHalfTheta; @@ -925,10 +1013,10 @@ THREE.Quaternion.prototype = { if ( cosHalfTheta >= 1.0 ) { - this.w = w; - this.x = x; - this.y = y; - this.z = z; + this._w = w; + this._x = x; + this._y = y; + this._z = z; return this; @@ -939,10 +1027,10 @@ THREE.Quaternion.prototype = { 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 ); + 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; @@ -951,27 +1039,31 @@ THREE.Quaternion.prototype = { 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 ); + 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 ); + + this._updateEuler(); return this; }, - equals: function ( v ) { + equals: function ( quaternion ) { - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); + return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); }, fromArray: function ( array ) { - this.x = array[ 0 ]; - this.y = array[ 1 ]; - this.z = array[ 2 ]; - this.w = array[ 3 ]; + this._x = array[ 0 ]; + this._y = array[ 1 ]; + this._z = array[ 2 ]; + this._w = array[ 3 ]; + + this._updateEuler(); return this; @@ -979,13 +1071,13 @@ THREE.Quaternion.prototype = { toArray: function () { - return [ this.x, this.y, this.z, this.w ]; + return [ this._x, this._y, this._z, this._w ]; }, clone: function () { - return new THREE.Quaternion( this.x, this.y, this.z, this.w ); + return new THREE.Quaternion( this._x, this._y, this._z, this._w ); } @@ -996,6 +1088,7 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) { return qm.copy( qa ).slerp( qb, t ); } + /** * @author mrdoob / http://mrdoob.com/ * @author philogb / http://blog.thejit.org/ @@ -1141,16 +1234,19 @@ THREE.Vector2.prototype = { }, - divideScalar: function ( s ) { + divideScalar: function ( scalar ) { - if ( s !== 0 ) { + if ( scalar !== 0 ) { - this.x /= s; - this.y /= s; + var invScalar = 1 / scalar; + + this.x *= invScalar; + this.y *= invScalar; } else { - this.set( 0, 0 ); + this.x = 0; + this.y = 0; } @@ -1315,6 +1411,7 @@ THREE.Vector2.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author *kile / http://kile.stravaganza.org/ @@ -1487,11 +1584,11 @@ THREE.Vector3.prototype = { }, - multiplyScalar: function ( s ) { + multiplyScalar: function ( scalar ) { - this.x *= s; - this.y *= s; - this.z *= s; + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; return this; @@ -1613,13 +1710,15 @@ THREE.Vector3.prototype = { }, - divideScalar: function ( s ) { + divideScalar: function ( scalar ) { + + if ( scalar !== 0 ) { - if ( s !== 0 ) { + var invScalar = 1 / scalar; - this.x /= s; - this.y /= s; - this.z /= s; + this.x *= invScalar; + this.y *= invScalar; + this.z *= invScalar; } else { @@ -1835,181 +1934,13 @@ THREE.Vector3.prototype = { setEulerFromRotationMatrix: function ( m, order ) { - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - // clamp, to handle numerical problems - - function clamp( x ) { - - return Math.min( Math.max( x, -1 ), 1 ); - - } - - var te = m.elements; - var m11 = te[0], m12 = te[4], m13 = te[8]; - var m21 = te[1], m22 = te[5], m23 = te[9]; - var m31 = te[2], m32 = te[6], m33 = te[10]; - - if ( order === undefined || order === 'XYZ' ) { - - this.y = Math.asin( clamp( m13 ) ); - - if ( Math.abs( m13 ) < 0.99999 ) { - - this.x = Math.atan2( - m23, m33 ); - this.z = Math.atan2( - m12, m11 ); - - } else { - - this.x = Math.atan2( m32, m22 ); - this.z = 0; - - } - - } else if ( order === 'YXZ' ) { - - this.x = Math.asin( - clamp( m23 ) ); - - if ( Math.abs( m23 ) < 0.99999 ) { - - this.y = Math.atan2( m13, m33 ); - this.z = Math.atan2( m21, m22 ); - - } else { - - this.y = Math.atan2( - m31, m11 ); - this.z = 0; - - } - - } else if ( order === 'ZXY' ) { - - this.x = Math.asin( clamp( m32 ) ); - - if ( Math.abs( m32 ) < 0.99999 ) { - - this.y = Math.atan2( - m31, m33 ); - this.z = Math.atan2( - m12, m22 ); - - } else { - - this.y = 0; - this.z = Math.atan2( m21, m11 ); - - } - - } else if ( order === 'ZYX' ) { - - this.y = Math.asin( - clamp( m31 ) ); - - if ( Math.abs( m31 ) < 0.99999 ) { - - this.x = Math.atan2( m32, m33 ); - this.z = Math.atan2( m21, m11 ); - - } else { - - this.x = 0; - this.z = Math.atan2( - m12, m22 ); - - } - - } else if ( order === 'YZX' ) { - - this.z = Math.asin( clamp( m21 ) ); - - if ( Math.abs( m21 ) < 0.99999 ) { - - this.x = Math.atan2( - m23, m22 ); - this.y = Math.atan2( - m31, m11 ); - - } else { - - this.x = 0; - this.y = Math.atan2( m13, m33 ); - - } - - } else if ( order === 'XZY' ) { - - this.z = Math.asin( - clamp( m12 ) ); - - if ( Math.abs( m12 ) < 0.99999 ) { - - this.x = Math.atan2( m32, m22 ); - this.y = Math.atan2( m13, m11 ); - - } else { - - this.x = Math.atan2( - m23, m33 ); - this.y = 0; - - } - - } - - return this; + console.error( "REMOVED: Vector3\'s setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code."); }, setEulerFromQuaternion: function ( q, order ) { - // q is assumed to be normalized - - // clamp, to handle numerical problems - - function clamp( x ) { - - return Math.min( Math.max( x, -1 ), 1 ); - - } - - // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m - - var sqx = q.x * q.x; - var sqy = q.y * q.y; - var sqz = q.z * q.z; - var sqw = q.w * q.w; - - if ( order === undefined || order === 'XYZ' ) { - - this.x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) ); - this.y = Math.asin( clamp( 2 * ( q.x * q.z + q.y * q.w ) ) ); - this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) ); - - } else if ( order === 'YXZ' ) { - - this.x = Math.asin( clamp( 2 * ( q.x * q.w - q.y * q.z ) ) ); - this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) ); - this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) ); - - } else if ( order === 'ZXY' ) { - - this.x = Math.asin( clamp( 2 * ( q.x * q.w + q.y * q.z ) ) ); - this.y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) ); - this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) ); - - } else if ( order === 'ZYX' ) { - - this.x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) ); - this.y = Math.asin( clamp( 2 * ( q.y * q.w - q.x * q.z ) ) ); - this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) ); - - } else if ( order === 'YZX' ) { - - this.x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) ); - this.y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) ); - this.z = Math.asin( clamp( 2 * ( q.x * q.y + q.z * q.w ) ) ); - - } else if ( order === 'XZY' ) { - - this.x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) ); - this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) ); - this.z = Math.asin( clamp( 2 * ( q.z * q.w - q.x * q.y ) ) ); - - } - - return this; + console.error( "REMOVED: Vector3\'s setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code."); }, @@ -2086,9 +2017,13 @@ THREE.extend( THREE.Vector3.prototype, { var q1 = new THREE.Quaternion(); - return function ( v, eulerOrder ) { + return function ( rotation ) { - var quaternion = q1.setFromEuler( v, eulerOrder ); + if( typeof rotation['order'] === undefined ) { + console.error( 'ERROR: Vector3\'s .applyEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); + } + + var quaternion = q1.setFromEuler( rotation ); this.applyQuaternion( quaternion ); @@ -2157,6 +2092,7 @@ THREE.extend( THREE.Vector3.prototype, { }() } ); + /** * @author supereggbert / http://www.paulbrunt.co.uk/ * @author philogb / http://blog.thejit.org/ @@ -2329,12 +2265,12 @@ THREE.Vector4.prototype = { }, - multiplyScalar: function ( s ) { + multiplyScalar: function ( scalar ) { - this.x *= s; - this.y *= s; - this.z *= s; - this.w *= s; + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + this.w *= scalar; return this; @@ -2358,14 +2294,16 @@ THREE.Vector4.prototype = { }, - divideScalar: function ( s ) { + divideScalar: function ( scalar ) { - if ( s !== 0 ) { + if ( scalar !== 0 ) { - this.x /= s; - this.y /= s; - this.z /= s; - this.w /= s; + var invScalar = 1 / scalar; + + this.x *= invScalar; + this.y *= invScalar; + this.z *= invScalar; + this.w *= invScalar; } else { @@ -2683,6 +2621,7 @@ THREE.Vector4.prototype = { if ( oldLength !== 0 && l !== oldLength ) { this.multiplyScalar( l / oldLength ); + } return this; @@ -2730,6 +2669,371 @@ THREE.Vector4.prototype = { } }; + +/** + * @author mrdoob / http://mrdoob.com/ + * @author WestLangley / http://github.com/WestLangley + * @author bhouston / http://exocortex.com + */ + +THREE.Euler = function ( x, y, z, order ) { + + this._x = x || 0; + this._y = y || 0; + this._z = z || 0; + this._order = order || THREE.Euler.DefaultOrder; + +}; + +THREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; + +THREE.Euler.DefaultOrder = 'XYZ'; + +THREE.Euler.prototype = { + + constructor: THREE.Euler, + + _x: 0, _y: 0, _z: 0, _order: THREE.Euler.DefaultOrder, + + _quaternion: undefined, + + _updateQuaternion: function () { + + if ( this._quaternion !== undefined ) { + + this._quaternion.setFromEuler( this, false ); + + } + + }, + + get x () { + + return this._x; + + }, + + set x ( value ) { + + this._x = value; + this._updateQuaternion(); + + }, + + get y () { + + return this._y; + + }, + + set y ( value ) { + + this._y = value; + this._updateQuaternion(); + + }, + + get z () { + + return this._z; + + }, + + set z ( value ) { + + this._z = value; + this._updateQuaternion(); + + }, + + get order () { + + return this._order; + + }, + + set order ( value ) { + + this._order = value; + this._updateQuaternion(); + + }, + + set: function ( x, y, z, order ) { + + this._x = x; + this._y = y; + this._z = z; + this._order = order || this._order; + + this._updateQuaternion(); + + return this; + + }, + + copy: function ( euler ) { + + this._x = euler._x; + this._y = euler._y; + this._z = euler._z; + this._order = euler._order; + + this._updateQuaternion(); + + return this; + + }, + + setFromRotationMatrix: function ( m, order ) { + + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + + // clamp, to handle numerical problems + + function clamp( x ) { + + return Math.min( Math.max( x, -1 ), 1 ); + + } + + var te = m.elements; + var m11 = te[0], m12 = te[4], m13 = te[8]; + var m21 = te[1], m22 = te[5], m23 = te[9]; + var m31 = te[2], m32 = te[6], m33 = te[10]; + + order = order || this._order; + + if ( order === 'XYZ' ) { + + this._y = Math.asin( clamp( m13 ) ); + + if ( Math.abs( m13 ) < 0.99999 ) { + + this._x = Math.atan2( - m23, m33 ); + this._z = Math.atan2( - m12, m11 ); + + } else { + + this._x = Math.atan2( m32, m22 ); + this._z = 0; + + } + + } else if ( order === 'YXZ' ) { + + this._x = Math.asin( - clamp( m23 ) ); + + if ( Math.abs( m23 ) < 0.99999 ) { + + this._y = Math.atan2( m13, m33 ); + this._z = Math.atan2( m21, m22 ); + + } else { + + this._y = Math.atan2( - m31, m11 ); + this._z = 0; + + } + + } else if ( order === 'ZXY' ) { + + this._x = Math.asin( clamp( m32 ) ); + + if ( Math.abs( m32 ) < 0.99999 ) { + + this._y = Math.atan2( - m31, m33 ); + this._z = Math.atan2( - m12, m22 ); + + } else { + + this._y = 0; + this._z = Math.atan2( m21, m11 ); + + } + + } else if ( order === 'ZYX' ) { + + this._y = Math.asin( - clamp( m31 ) ); + + if ( Math.abs( m31 ) < 0.99999 ) { + + this._x = Math.atan2( m32, m33 ); + this._z = Math.atan2( m21, m11 ); + + } else { + + this._x = 0; + this._z = Math.atan2( - m12, m22 ); + + } + + } else if ( order === 'YZX' ) { + + this._z = Math.asin( clamp( m21 ) ); + + if ( Math.abs( m21 ) < 0.99999 ) { + + this._x = Math.atan2( - m23, m22 ); + this._y = Math.atan2( - m31, m11 ); + + } else { + + this._x = 0; + this._y = Math.atan2( m13, m33 ); + + } + + } else if ( order === 'XZY' ) { + + this._z = Math.asin( - clamp( m12 ) ); + + if ( Math.abs( m12 ) < 0.99999 ) { + + this._x = Math.atan2( m32, m22 ); + this._y = Math.atan2( m13, m11 ); + + } else { + + this._x = Math.atan2( - m23, m33 ); + this._y = 0; + + } + + } else { + + console.warn( 'WARNING: Euler.setFromRotationMatrix() given unsupported order: ' + order ) + + } + + this._order = order; + + this._updateQuaternion(); + + return this; + + }, + + setFromQuaternion: function ( q, order, update ) { + + // q is assumed to be normalized + + // clamp, to handle numerical problems + + function clamp( x ) { + + return Math.min( Math.max( x, -1 ), 1 ); + + } + + // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m + + var sqx = q.x * q.x; + var sqy = q.y * q.y; + var sqz = q.z * q.z; + var sqw = q.w * q.w; + + order = order || this._order; + + if ( order === 'XYZ' ) { + + this._x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) ); + this._y = Math.asin( clamp( 2 * ( q.x * q.z + q.y * q.w ) ) ); + this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) ); + + } else if ( order === 'YXZ' ) { + + this._x = Math.asin( clamp( 2 * ( q.x * q.w - q.y * q.z ) ) ); + this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) ); + this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) ); + + } else if ( order === 'ZXY' ) { + + this._x = Math.asin( clamp( 2 * ( q.x * q.w + q.y * q.z ) ) ); + this._y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) ); + this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) ); + + } else if ( order === 'ZYX' ) { + + this._x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) ); + this._y = Math.asin( clamp( 2 * ( q.y * q.w - q.x * q.z ) ) ); + this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) ); + + } else if ( order === 'YZX' ) { + + this._x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) ); + this._y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) ); + this._z = Math.asin( clamp( 2 * ( q.x * q.y + q.z * q.w ) ) ); + + } else if ( order === 'XZY' ) { + + this._x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) ); + this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) ); + this._z = Math.asin( clamp( 2 * ( q.z * q.w - q.x * q.y ) ) ); + + } else { + + console.warn( 'WARNING: Euler.setFromQuaternion() given unsupported order: ' + order ) + + } + + this._order = order; + + if ( update !== false ) this._updateQuaternion(); + + return this; + + }, + + reorder: function () { + + // WARNING: this discards revolution information -bhouston + + var q = new THREE.Quaternion(); + + return function ( newOrder ) { + + q.setFromEuler( this ); + this.setFromQuaternion( q, newOrder ); + + }; + + + }(), + + fromArray: function ( array ) { + + this._x = array[ 0 ]; + this._y = array[ 1 ]; + this._z = array[ 2 ]; + if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; + + this._updateQuaternion(); + + return this; + + }, + + toArray: function () { + + return [ this._x, this._y, this._z, this._order ]; + + }, + + equals: function ( euler ) { + + return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); + + }, + + clone: function () { + + return new THREE.Euler( this._x, this._y, this._z, this._order ); + + } + +}; + /** * @author bhouston / http://exocortex.com */ @@ -2856,6 +3160,7 @@ THREE.Line3.prototype = { } }; + /** * @author bhouston / http://exocortex.com */ @@ -3118,8 +3423,10 @@ THREE.Box2.prototype = { } }; + /** * @author bhouston / http://exocortex.com + * @author WestLangley / http://github.com/WestLangley */ THREE.Box3 = function ( min, max ) { @@ -3214,6 +3521,47 @@ THREE.Box3.prototype = { }(), + setFromObject: function() { + + // Computes the world-axis-aligned bounding box of an object (including its children), + // accounting for both the object's, and childrens', world transforms + + var v1 = new THREE.Vector3(); + + return function( object ) { + + var scope = this; + + object.updateMatrixWorld( true ); + + this.makeEmpty(); + + object.traverse( function ( node ) { + + if ( node.geometry !== undefined && node.geometry.vertices !== undefined ) { + + var vertices = node.geometry.vertices; + + for ( var i = 0, il = vertices.length; i < il; i++ ) { + + v1.copy( vertices[ i ] ); + + v1.applyMatrix4( node.matrixWorld ); + + scope.expandByPoint( v1 ); + + } + + } + + } ); + + return this; + + }; + + }(), + copy: function ( box ) { this.min.copy( box.min ); @@ -3449,6 +3797,7 @@ THREE.Box3.prototype = { } }; + /** * @author alteredq / http://alteredqualia.com/ * @author WestLangley / http://github.com/WestLangley @@ -3674,6 +4023,7 @@ THREE.Matrix3.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author supereggbert / http://www.paulbrunt.co.uk/ @@ -3690,11 +4040,13 @@ THREE.Matrix3.prototype = { THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - var te = this.elements = new Float32Array( 16 ); + this.elements = new Float32Array( 16 ); // TODO: if n11 is undefined, then just set to identity, otherwise copy all other values into matrix // we should not support semi specification of Matrix4, it is just weird. + var te = this.elements; + te[0] = ( n11 !== undefined ) ? n11 : 1; te[4] = n12 || 0; te[8] = n13 || 0; te[12] = n14 || 0; te[1] = n21 || 0; te[5] = ( n22 !== undefined ) ? n22 : 1; te[9] = n23 || 0; te[13] = n24 || 0; te[2] = n31 || 0; te[6] = n32 || 0; te[10] = ( n33 !== undefined ) ? n33 : 1; te[14] = n34 || 0; @@ -3736,16 +4088,7 @@ THREE.Matrix4.prototype = { copy: function ( m ) { - var me = m.elements; - - this.set( - - me[0], me[4], me[8], me[12], - me[1], me[5], me[9], me[13], - me[2], me[6], me[10], me[14], - me[3], me[7], me[11], me[15] - - ); + this.elements.set( m.elements ); return this; @@ -3802,24 +4145,22 @@ THREE.Matrix4.prototype = { }(), - setRotationFromEuler: function ( v, order ) { - - console.warn( 'DEPRECATED: Matrix4\'s .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.' ); + makeRotationFromEuler: function ( euler ) { - return this.makeRotationFromEuler( v, order ); + if ( typeof euler['order'] === undefined ) { - }, + console.error( 'ERROR: Matrix\'s .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); - makeRotationFromEuler: function ( v, order ) { + } var te = this.elements; - var x = v.x, y = v.y, z = v.z; + var x = euler.x, y = euler.y, z = euler.z; var a = Math.cos( x ), b = Math.sin( x ); var c = Math.cos( y ), d = Math.sin( y ); var e = Math.cos( z ), f = Math.sin( z ); - if ( order === undefined || order === 'XYZ' ) { + if ( euler.order === undefined || euler.order === 'XYZ' ) { var ae = a * e, af = a * f, be = b * e, bf = b * f; @@ -3835,7 +4176,7 @@ THREE.Matrix4.prototype = { te[6] = be + af * d; te[10] = a * c; - } else if ( order === 'YXZ' ) { + } else if ( euler.order === 'YXZ' ) { var ce = c * e, cf = c * f, de = d * e, df = d * f; @@ -3851,7 +4192,7 @@ THREE.Matrix4.prototype = { te[6] = df + ce * b; te[10] = a * c; - } else if ( order === 'ZXY' ) { + } else if ( euler.order === 'ZXY' ) { var ce = c * e, cf = c * f, de = d * e, df = d * f; @@ -3867,7 +4208,7 @@ THREE.Matrix4.prototype = { te[6] = b; te[10] = a * c; - } else if ( order === 'ZYX' ) { + } else if ( euler.order === 'ZYX' ) { var ae = a * e, af = a * f, be = b * e, bf = b * f; @@ -3883,7 +4224,7 @@ THREE.Matrix4.prototype = { te[6] = b * c; te[10] = a * c; - } else if ( order === 'YZX' ) { + } else if ( euler.order === 'YZX' ) { var ac = a * c, ad = a * d, bc = b * c, bd = b * d; @@ -3899,7 +4240,7 @@ THREE.Matrix4.prototype = { te[6] = ad * f + bc; te[10] = ac - bd * f; - } else if ( order === 'XZY' ) { + } else if ( euler.order === 'XZY' ) { var ac = a * c, ad = a * d, bc = b * c, bd = b * d; @@ -4314,7 +4655,7 @@ THREE.Matrix4.prototype = { te[11] = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43; te[15] = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33; - var det = me[ 0 ] * te[ 0 ] + me[ 1 ] * te[ 4 ] + me[ 2 ] * te[ 8 ] + me[ 3 ] * te[ 12 ]; + var det = n11 * te[ 0 ] + n21 * te[ 4 ] + n31 * te[ 8 ] + n41 * te[ 12 ]; if ( det == 0 ) { @@ -4503,14 +4844,6 @@ THREE.Matrix4.prototype = { compose: function ( position, quaternion, scale ) { - console.warn( 'DEPRECATED: Matrix4\'s .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code.' ); - - return this.makeFromPositionQuaternionScale( position, quaternion, scale ); - - }, - - makeFromPositionQuaternionScale: function ( position, quaternion, scale ) { - this.makeRotationFromQuaternion( quaternion ); this.scale( scale ); this.setPosition( position ); @@ -4519,15 +4852,54 @@ THREE.Matrix4.prototype = { }, - makeFromPositionEulerScale: function ( position, rotation, eulerOrder, scale ) { + decompose: function () { - this.makeRotationFromEuler( rotation, eulerOrder ); - this.scale( scale ); - this.setPosition( position ); + var vector = new THREE.Vector3(); + var matrix = new THREE.Matrix4(); - return this; + return function ( position, quaternion, scale ) { - }, + var te = this.elements; + + var sx = vector.set( te[0], te[1], te[2] ).length(); + var sy = vector.set( te[4], te[5], te[6] ).length(); + var sz = vector.set( te[8], te[9], te[10] ).length(); + + position.x = te[12]; + position.y = te[13]; + position.z = te[14]; + + // scale the rotation part + + matrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy() + + var invSX = 1 / sx; + var invSY = 1 / sy; + var invSZ = 1 / sz; + + matrix.elements[0] *= invSX; + matrix.elements[1] *= invSX; + matrix.elements[2] *= invSX; + + matrix.elements[4] *= invSY; + matrix.elements[5] *= invSY; + matrix.elements[6] *= invSY; + + matrix.elements[8] *= invSZ; + matrix.elements[9] *= invSZ; + matrix.elements[10] *= invSZ; + + quaternion.setFromRotationMatrix( matrix ); + + scale.x = sx; + scale.y = sy; + scale.z = sz; + + return this; + + }; + + }(), makeFrustum: function ( left, right, bottom, top, near, far ) { @@ -4580,6 +4952,27 @@ THREE.Matrix4.prototype = { }, + fromArray: function ( array ) { + + this.elements.set( array ); + + return this; + + }, + + toArray: function () { + + var te = this.elements; + + return [ + te[ 0 ], te[ 1 ], te[ 2 ], te[ 3 ], + te[ 4 ], te[ 5 ], te[ 6 ], te[ 7 ], + te[ 8 ], te[ 9 ], te[ 10 ], te[ 11 ], + te[ 12 ], te[ 13 ], te[ 14 ], te[ 15 ] + ]; + + }, + clone: function () { var te = this.elements; @@ -4597,61 +4990,6 @@ THREE.Matrix4.prototype = { }; -THREE.extend( THREE.Matrix4.prototype, { - - decompose: function() { - - var x = new THREE.Vector3(); - var y = new THREE.Vector3(); - var z = new THREE.Vector3(); - var matrix = new THREE.Matrix4(); - - return function ( position, quaternion, scale ) { - - var te = this.elements; - - // grab the axis vectors - x.set( te[0], te[1], te[2] ); - y.set( te[4], te[5], te[6] ); - z.set( te[8], te[9], te[10] ); - - position = ( position instanceof THREE.Vector3 ) ? position : new THREE.Vector3(); - quaternion = ( quaternion instanceof THREE.Quaternion ) ? quaternion : new THREE.Quaternion(); - scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3(); - - scale.x = x.length(); - scale.y = y.length(); - scale.z = z.length(); - - position.x = te[12]; - position.y = te[13]; - position.z = te[14]; - - // scale the rotation part - - matrix.copy( this ); - - matrix.elements[0] /= scale.x; - matrix.elements[1] /= scale.x; - matrix.elements[2] /= scale.x; - - matrix.elements[4] /= scale.y; - matrix.elements[5] /= scale.y; - matrix.elements[6] /= scale.y; - - matrix.elements[8] /= scale.z; - matrix.elements[9] /= scale.z; - matrix.elements[10] /= scale.z; - - quaternion.setFromRotationMatrix( matrix ); - - return [ position, quaternion, scale ]; - - }; - - }() - -} ); /** * @author bhouston / http://exocortex.com */ @@ -4685,7 +5023,7 @@ THREE.Ray.prototype = { }, - at: function( t, optionalTarget ) { + at: function ( t, optionalTarget ) { var result = optionalTarget || new THREE.Vector3(); @@ -4693,7 +5031,7 @@ THREE.Ray.prototype = { }, - recast: function() { + recast: function () { var v1 = new THREE.Vector3(); @@ -4713,17 +5051,32 @@ THREE.Ray.prototype = { result.subVectors( point, this.origin ); var directionDistance = result.dot( this.direction ); + if ( directionDistance < 0 ) { + + return result.copy( this.origin ); + + } + return result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); }, - distanceToPoint: function() { + distanceToPoint: function () { var v1 = new THREE.Vector3(); return function ( point ) { var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); + + // point behind the ray + + if ( directionDistance < 0 ) { + + return this.origin.distanceTo( point ); + + } + v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); return v1.distanceTo( point ); @@ -4732,30 +5085,152 @@ THREE.Ray.prototype = { }(), - isIntersectionSphere: function( sphere ) { + distanceSqToSegment: function( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { + + // from http://www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp + // It returns the min distance between the ray and the segment + // defined by v0 and v1 + // It can also set two optional targets : + // - The closest point on the ray + // - The closest point on the segment + + var segCenter = v0.clone().add( v1 ).multiplyScalar( 0.5 ); + var segDir = v1.clone().sub( v0 ).normalize(); + var segExtent = v0.distanceTo( v1 ) * 0.5; + var diff = this.origin.clone().sub( segCenter ); + var a01 = - this.direction.dot( segDir ); + var b0 = diff.dot( this.direction ); + var b1 = - diff.dot( segDir ); + var c = diff.lengthSq(); + var det = Math.abs( 1 - a01 * a01 ); + var s0, s1, sqrDist, extDet; + + if ( det >= 0 ) { + + // The ray and segment are not parallel. + + s0 = a01 * b1 - b0; + s1 = a01 * b0 - b1; + extDet = segExtent * det; + + if ( s0 >= 0 ) { + + if ( s1 >= - extDet ) { + + if ( s1 <= extDet ) { + + // region 0 + // Minimum at interior points of ray and segment. + + var invDet = 1 / det; + s0 *= invDet; + s1 *= invDet; + sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; + + } else { + + // region 1 + + s1 = segExtent; + s0 = Math.max( 0, - ( a01 * s1 + b0) ); + sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; + + } + + } else { + + // region 5 + + s1 = - segExtent; + s0 = Math.max( 0, - ( a01 * s1 + b0) ); + sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; + + } + + } else { + + if ( s1 <= - extDet) { + + // region 4 + + s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); + s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); + sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; + + } else if ( s1 <= extDet ) { + + // region 3 + + s0 = 0; + s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); + sqrDist = s1 * ( s1 + 2 * b1 ) + c; + + } else { + + // region 2 + + s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); + s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); + sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; + + } + + } + + } else { + + // Ray and segment are parallel. + + s1 = ( a01 > 0 ) ? - segExtent : segExtent; + s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); + sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; + + } + + if ( optionalPointOnRay ) { + + optionalPointOnRay.copy( this.direction.clone().multiplyScalar( s0 ).add( this.origin ) ); + + } + + if ( optionalPointOnSegment ) { + + optionalPointOnSegment.copy( segDir.clone().multiplyScalar( s1 ).add( segCenter ) ); - return ( this.distanceToPoint( sphere.center ) <= sphere.radius ); + } + + return sqrDist; + + }, + + isIntersectionSphere: function ( sphere ) { + + return this.distanceToPoint( sphere.center ) <= sphere.radius; }, isIntersectionPlane: function ( plane ) { - // check if the line and plane are non-perpendicular, if they - // eventually they will intersect. - var denominator = plane.normal.dot( this.direction ); - if ( denominator != 0 ) { + // check if the ray lies on the plane first + + var distToPoint = plane.distanceToPoint( this.origin ); + + if ( distToPoint === 0 ) { return true; } - // line is coplanar, return origin - if( plane.distanceToPoint( this.origin ) == 0 ) { + var denominator = plane.normal.dot( this.direction ); + + if ( denominator * distToPoint < 0 ) { - return true; + return true } + // ray origin is behind the plane (and is pointing behind it) + return false; }, @@ -4772,14 +5247,17 @@ THREE.Ray.prototype = { } - // Unsure if this is the correct method to handle this case. - return undefined; + // Null is preferable to undefined since undefined means.... it is undefined + + return null; } var t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - return t; + // Return if the ray never intersects the plane + + return t >= 0 ? t : null; }, @@ -4787,9 +5265,9 @@ THREE.Ray.prototype = { var t = this.distanceToPlane( plane ); - if ( t === undefined ) { + if ( t === null ) { - return undefined; + return null; } return this.at( t, optionalTarget ); @@ -4818,6 +5296,7 @@ THREE.Ray.prototype = { } }; + /** * @author bhouston / http://exocortex.com * @author mrdoob / http://mrdoob.com/ @@ -4842,18 +5321,18 @@ THREE.Sphere.prototype = { return this; }, - setFromCenterAndPoints: function ( center, points ) { + setFromPoints: function ( points ) { - var maxRadiusSq = 0; + var radiusSq, maxRadiusSq = 0; for ( var i = 0, il = points.length; i < il; i ++ ) { - var radiusSq = center.distanceToSquared( points[ i ] ); + radiusSq = points[ i ].lengthSq(); maxRadiusSq = Math.max( maxRadiusSq, radiusSq ); } - this.center = center; + this.center.set( 0, 0, 0 ); this.radius = Math.sqrt( maxRadiusSq ); return this; @@ -4954,6 +5433,7 @@ THREE.Sphere.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -5036,12 +5516,17 @@ THREE.Frustum.prototype = { // this method is expanded inlined for performance reasons. + var geometry = object.geometry; var matrix = object.matrixWorld; - var planes = this.planes; - var negRadius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis(); + + if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + + var negRadius = - geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis(); center.getPositionFromMatrix( matrix ); + var planes = this.planes; + for ( var i = 0; i < 6; i ++ ) { var distance = planes[ i ].distanceToPoint( center ); @@ -5082,6 +5567,44 @@ THREE.Frustum.prototype = { }, + intersectsBox : function() { + + var p1 = new THREE.Vector3(), + p2 = new THREE.Vector3(); + + return function( box ) { + + var planes = this.planes; + + for ( var i = 0; i < 6 ; i ++ ) { + + var plane = planes[i]; + + p1.x = plane.normal.x > 0 ? box.min.x : box.max.x; + p2.x = plane.normal.x > 0 ? box.max.x : box.min.x; + p1.y = plane.normal.y > 0 ? box.min.y : box.max.y; + p2.y = plane.normal.y > 0 ? box.max.y : box.min.y; + p1.z = plane.normal.z > 0 ? box.min.z : box.max.z; + p2.z = plane.normal.z > 0 ? box.max.z : box.min.z; + + var d1 = plane.distanceToPoint( p1 ); + var d2 = plane.distanceToPoint( p2 ); + + // if both outside plane, no intersection + + if ( d1 < 0 && d2 < 0 ) { + + return false; + + } + } + + return true; + }; + + }(), + + containsPoint: function ( point ) { var planes = this.planes; @@ -5107,6 +5630,7 @@ THREE.Frustum.prototype = { } }; + /** * @author bhouston / http://exocortex.com */ @@ -5329,12 +5853,52 @@ THREE.Plane.prototype = { } }; + /** * @author alteredq / http://alteredqualia.com/ + * @author mrdoob / http://mrdoob.com/ */ THREE.Math = { + PI2: Math.PI * 2, + + generateUUID: function () { + + // http://www.broofa.com/Tools/Math.uuid.htm + + var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); + var uuid = new Array(36); + var rnd = 0, r; + + return function () { + + for ( var i = 0; i < 36; i ++ ) { + + if ( i == 8 || i == 13 || i == 18 || i == 23 ) { + + uuid[ i ] = '-'; + + } else if ( i == 14 ) { + + uuid[ i ] = '4'; + + } else { + + if (rnd <= 0x02) rnd = 0x2000000 + (Math.random()*0x1000000)|0; + r = rnd & 0xf; + rnd = rnd >> 4; + uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; + + } + } + + return uuid.join(''); + + }; + + }(), + // Clamp value to range clamp: function ( x, a, b ) { @@ -5447,6 +6011,7 @@ THREE.Math = { }() }; + /** * Spline from Tween.js, slightly optimized (and trashed) * http://sole.github.com/tween.js/examples/05_spline.html @@ -5623,6 +6188,7 @@ THREE.Spline = function ( points ) { }; }; + /** * @author bhouston / http://exocortex.com * @author mrdoob / http://mrdoob.com/ @@ -5813,6 +6379,7 @@ THREE.Triangle.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -5823,6 +6390,7 @@ THREE.Vertex = function ( v ) { return v; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -5833,6 +6401,7 @@ THREE.UV = function ( u, v ) { return new THREE.Vector2( u, v ); }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -5855,8 +6424,8 @@ THREE.Clock.prototype = { start: function () { - this.startTime = window.performance !== undefined && window.performance.now !== undefined - ? window.performance.now() + this.startTime = self.performance !== undefined && self.performance.now !== undefined + ? self.performance.now() : Date.now(); this.oldTime = this.startTime; @@ -5889,8 +6458,8 @@ THREE.Clock.prototype = { if ( this.running ) { - var newTime = window.performance !== undefined && window.performance.now !== undefined - ? window.performance.now() + var newTime = self.performance !== undefined && self.performance.now !== undefined + ? self.performance.now() : Date.now(); diff = 0.001 * ( newTime - this.oldTime ); @@ -5905,6 +6474,7 @@ THREE.Clock.prototype = { } }; + /** * https://github.com/mrdoob/eventdispatcher.js/ */ @@ -5915,6 +6485,15 @@ THREE.EventDispatcher.prototype = { constructor: THREE.EventDispatcher, + apply: function ( object ) { + + object.addEventListener = THREE.EventDispatcher.prototype.addEventListener; + object.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener; + object.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener; + object.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent; + + }, + addEventListener: function ( type, listener ) { if ( this._listeners === undefined ) this._listeners = {}; @@ -5988,6 +6567,7 @@ THREE.EventDispatcher.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author bhouston / http://exocortex.com/ @@ -6056,103 +6636,316 @@ THREE.EventDispatcher.prototype = { } else if ( object instanceof THREE.Mesh ) { + var geometry = object.geometry; + // Checking boundingSphere distance to ray matrixPosition.getPositionFromMatrix( object.matrixWorld ); - sphere.set( - matrixPosition, - object.geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() ); - if ( ! raycaster.ray.isIntersectionSphere( sphere ) ) { + if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + + sphere.set( matrixPosition, geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() ); + + if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { return intersects; } - // Checking faces - - var geometry = object.geometry; var vertices = geometry.vertices; - var isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; - var objectMaterials = isFaceMaterial === true ? object.material.materials : null; + if ( geometry instanceof THREE.BufferGeometry ) { - var side = object.material.side; + var material = object.material; - var a, b, c, d; - var precision = raycaster.precision; + if ( material === undefined ) return intersects; + if ( geometry.dynamic === false ) return intersects; - inverseMatrix.getInverse( object.matrixWorld ); + var isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; + var objectMaterials = isFaceMaterial === true ? object.material.materials : null; - localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); + var side = object.material.side; + + var a, b, c; + var precision = raycaster.precision; + + inverseMatrix.getInverse( object.matrixWorld ); + + localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); + + var fl; + var indexed = false; + + if ( geometry.attributes.index ) { + + indexed = true; + fl = geometry.attributes.index.numItems / 3; + + } else { + + fl = geometry.attributes.position.numItems / 9; + + } + + var vA = new THREE.Vector3(); + var vB = new THREE.Vector3(); + var vC = new THREE.Vector3(); + var vCB = new THREE.Vector3(); + var vAB = new THREE.Vector3(); + + for ( var oi = 0; oi < geometry.offsets.length; ++oi ) { + + var start = geometry.offsets[ oi ].start; + var count = geometry.offsets[ oi ].count; + var index = geometry.offsets[ oi ].index; + + for ( var i = start, il = start + count; i < il; i += 3 ) { + + if ( indexed ) { + + a = index + geometry.attributes.index.array[ i ]; + b = index + geometry.attributes.index.array[ i + 1 ]; + c = index + geometry.attributes.index.array[ i + 2 ]; + + } else { + + a = index; + b = index + 1; + c = index + 2; + + } + + vA.set( + geometry.attributes.position.array[ a * 3 ], + geometry.attributes.position.array[ a * 3 + 1 ], + geometry.attributes.position.array[ a * 3 + 2 ] + ); + vB.set( + geometry.attributes.position.array[ b * 3 ], + geometry.attributes.position.array[ b * 3 + 1 ], + geometry.attributes.position.array[ b * 3 + 2 ] + ); + vC.set( + geometry.attributes.position.array[ c * 3 ], + geometry.attributes.position.array[ c * 3 + 1 ], + geometry.attributes.position.array[ c * 3 + 2 ] + ); + + facePlane.setFromCoplanarPoints( vA, vB, vC ); + + var planeDistance = localRay.distanceToPlane( facePlane ); + + // bail if the ray is too close to the plane + if ( planeDistance < precision ) continue; + + // bail if the ray is behind the plane + if ( planeDistance === null ) continue; + + // check if we hit the wrong side of a single sided face + side = material.side; + + if ( side !== THREE.DoubleSide ) { + + var planeSign = localRay.direction.dot( facePlane.normal ); + - for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { + if ( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) { - var face = geometry.faces[ f ]; + continue; - var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material; + } - if ( material === undefined ) continue; + } - facePlane.setFromNormalAndCoplanarPoint( face.normal, vertices[face.a] ); + // this can be done using the planeDistance from localRay because + // localRay wasn't normalized, but ray was + if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) { - var planeDistance = localRay.distanceToPlane( facePlane ); + continue; - // bail if raycaster and plane are parallel - if ( Math.abs( planeDistance ) < precision ) continue; + } - // if negative distance, then plane is behind raycaster - if ( planeDistance < 0 ) continue; + // passing in intersectPoint avoids a copy + intersectPoint = localRay.at( planeDistance, intersectPoint ); - // check if we hit the wrong side of a single sided face - side = material.side; - if ( side !== THREE.DoubleSide ) { + if ( THREE.Triangle.containsPoint( intersectPoint, vA, vB, vC ) === false ) { + + continue; + + } - var planeSign = localRay.direction.dot( facePlane.normal ); + intersects.push( { - if ( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue; + // this works because the original ray was normalized, + // and the transformed localRay wasn't + distance: planeDistance, + point: raycaster.ray.at( planeDistance ), + face: null, + faceIndex: null, + object: object + } ); + + } } - // this can be done using the planeDistance from localRay because localRay wasn't normalized, but ray was - if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) continue; + } else if ( geometry instanceof THREE.Geometry ) { - intersectPoint = localRay.at( planeDistance, intersectPoint ); // passing in intersectPoint avoids a copy + var isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; + var objectMaterials = isFaceMaterial === true ? object.material.materials : null; - if ( face instanceof THREE.Face3 ) { + var side = object.material.side; - a = vertices[ face.a ]; - b = vertices[ face.b ]; - c = vertices[ face.c ]; + var a, b, c, d; + var precision = raycaster.precision; - if ( ! THREE.Triangle.containsPoint( intersectPoint, a, b, c ) ) continue; + inverseMatrix.getInverse( object.matrixWorld ); - } else if ( face instanceof THREE.Face4 ) { + localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - a = vertices[ face.a ]; - b = vertices[ face.b ]; - c = vertices[ face.c ]; - d = vertices[ face.d ]; + for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { - if ( ( ! THREE.Triangle.containsPoint( intersectPoint, a, b, d ) ) && - ( ! THREE.Triangle.containsPoint( intersectPoint, b, c, d ) ) ) continue; + var face = geometry.faces[ f ]; - } else { + var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material; + + if ( material === undefined ) continue; + + facePlane.setFromNormalAndCoplanarPoint( face.normal, vertices[face.a] ); + + var planeDistance = localRay.distanceToPlane( facePlane ); + + // bail if the ray is too close to the plane + if ( planeDistance < precision ) continue; + + // bail if the ray is behind the plane + if ( planeDistance === null ) continue; + + // check if we hit the wrong side of a single sided face + side = material.side; + if ( side !== THREE.DoubleSide ) { + + var planeSign = localRay.direction.dot( facePlane.normal ); + + if ( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) { + + continue; + + } + + } + + // this can be done using the planeDistance from localRay because localRay + // wasn't normalized, but ray was + if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) continue; + + // passing in intersectPoint avoids a copy + intersectPoint = localRay.at( planeDistance, intersectPoint ); + + if ( face instanceof THREE.Face3 ) { + + a = vertices[ face.a ]; + b = vertices[ face.b ]; + c = vertices[ face.c ]; + + if ( THREE.Triangle.containsPoint( intersectPoint, a, b, c ) === false ) { - // This is added because if we call out of this if/else group when none of the cases - // match it will add a point to the intersection list erroneously. - throw Error( "face type not supported" ); + continue; + + } + + } else if ( face instanceof THREE.Face4 ) { + + a = vertices[ face.a ]; + b = vertices[ face.b ]; + c = vertices[ face.c ]; + d = vertices[ face.d ]; + + if ( THREE.Triangle.containsPoint( intersectPoint, a, b, d ) === false && + THREE.Triangle.containsPoint( intersectPoint, b, c, d ) === false ) { + + continue; + + } + + } else { + + // This is added because if we call out of this if/else group when + // none of the cases match it will add a point to the intersection + // list erroneously. + throw Error( "face type not supported" ); + + } + + intersects.push( { + + // this works because the original ray was normalized, + // and the transformed localRay wasn't + distance: planeDistance, + point: raycaster.ray.at( planeDistance ), + face: face, + faceIndex: f, + object: object + + } ); } - intersects.push( { + } - distance: planeDistance, // this works because the original ray was normalized, and the transformed localRay wasn't - point: raycaster.ray.at( planeDistance ), - face: face, - faceIndex: f, - object: object + } else if ( object instanceof THREE.Line ) { - } ); + var precision = raycaster.linePrecision; + var precisionSq = precision * precision; + + var geometry = object.geometry; + + if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + + // Checking boundingSphere distance to ray + matrixPosition.getPositionFromMatrix(object.matrixWorld); + sphere.set( matrixPosition, geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() ); + + if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { + + return intersects; + + } + + inverseMatrix.getInverse( object.matrixWorld ); + localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); + localRay.direction.normalize(); // for scale matrix + + var vertices = geometry.vertices; + var nbVertices = vertices.length; + var interSegment = new THREE.Vector3(); + var interRay = new THREE.Vector3(); + var step = object.type === THREE.LineStrip ? 1 : 2; + + for ( var i = 0; i < nbVertices - 1; i = i + step ) { + + var distSq = localRay.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); + + if ( distSq <= precisionSq ) { + + var distance = localRay.origin.distanceTo( interRay ); + + if ( raycaster.near <= distance && distance <= raycaster.far ) { + + intersects.push( { + + distance: distance, + // What do we want? intersection point on the ray or on the segment?? + // point: raycaster.ray.at( distance ), + point: interSegment.clone().applyMatrix4( object.matrixWorld ), + face: null, + faceIndex: null, + object: object + + } ); + + } + + } } @@ -6174,6 +6967,7 @@ THREE.EventDispatcher.prototype = { // THREE.Raycaster.prototype.precision = 0.0001; + THREE.Raycaster.prototype.linePrecision = 1; THREE.Raycaster.prototype.set = function ( origin, direction ) { @@ -6219,6 +7013,7 @@ THREE.EventDispatcher.prototype = { intersectDescendants( objects[ i ], this, intersects ); } + } intersects.sort( descSort ); @@ -6228,6 +7023,7 @@ THREE.EventDispatcher.prototype = { }; }( THREE ) ); + /** * @author mrdoob / http://mrdoob.com/ * @author mikael emtinger / http://gomo.se/ @@ -6238,6 +7034,7 @@ THREE.EventDispatcher.prototype = { THREE.Object3D = function () { this.id = THREE.Object3DIdCount ++; + this.uuid = THREE.Math.generateUUID(); this.name = ''; @@ -6247,10 +7044,15 @@ THREE.Object3D = function () { this.up = new THREE.Vector3( 0, 1, 0 ); this.position = new THREE.Vector3(); - this.rotation = new THREE.Vector3(); - this.eulerOrder = THREE.Object3D.defaultEulerOrder; + this.rotation = new THREE.Euler(); + this.quaternion = new THREE.Quaternion(); this.scale = new THREE.Vector3( 1, 1, 1 ); + // keep rotation and quaternion in sync + + this.rotation._quaternion = this.quaternion; + this.quaternion._euler = this.rotation; + this.renderDepth = null; this.rotationAutoUpdate = true; @@ -6261,9 +7063,6 @@ THREE.Object3D = function () { this.matrixAutoUpdate = true; this.matrixWorldNeedsUpdate = true; - this.quaternion = new THREE.Quaternion(); - this.useQuaternion = false; - this.visible = true; this.castShadow = false; @@ -6280,6 +7079,34 @@ THREE.Object3D.prototype = { constructor: THREE.Object3D, + get eulerOrder () { + + console.warn( 'DEPRECATED: Object3D\'s .eulerOrder has been moved to Object3D\'s .rotation.order.' ); + + return this.rotation.order; + + }, + + set eulerOrder ( value ) { + + console.warn( 'DEPRECATED: Object3D\'s .eulerOrder has been moved to Object3D\'s .rotation.order.' ); + + this.rotation.order = value; + + }, + + get useQuaternion () { + + console.warn( 'DEPRECATED: Object3D\'s .useQuaternion has been removed. The library now uses quaternions by default.' ); + + }, + + set useQuaternion ( value ) { + + console.warn( 'DEPRECATED: Object3D\'s .useQuaternion has been removed. The library now uses quaternions by default.' ); + + }, + applyMatrix: function () { var m1 = new THREE.Matrix4(); @@ -6294,19 +7121,41 @@ THREE.Object3D.prototype = { m1.extractRotation( this.matrix ); - if ( this.useQuaternion === true ) { + this.quaternion.setFromRotationMatrix( m1 ); - this.quaternion.setFromRotationMatrix( m1 ); + } - } else { + }(), - this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder ); + setRotationFromAxisAngle: function ( axis, angle ) { - } + // assumes axis is normalized - } + this.quaternion.setFromAxisAngle( axis, angle ); - }(), + }, + + setRotationFromEuler: function ( euler ) { + + this.quaternion.setFromEuler( euler, true ); + + }, + + setRotationFromMatrix: function ( m ) { + + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + + this.quaternion.setFromRotationMatrix( m ); + + }, + + setRotationFromQuaternion: function ( q ) { + + // assumes q is normalized + + this.quaternion.copy( q ); + + }, rotateOnAxis: function() { @@ -6314,28 +7163,52 @@ THREE.Object3D.prototype = { // axis is assumed to be normalized var q1 = new THREE.Quaternion(); - var q2 = new THREE.Quaternion(); return function ( axis, angle ) { q1.setFromAxisAngle( axis, angle ); - if ( this.useQuaternion === true ) { + this.quaternion.multiply( q1 ); - this.quaternion.multiply( q1 ); + return this; - } else { + } - q2.setFromEuler( this.rotation, this.eulerOrder ); - q2.multiply( q1 ); + }(), - this.rotation.setEulerFromQuaternion( q2, this.eulerOrder ); + rotateX: function () { - } + var v1 = new THREE.Vector3( 1, 0, 0 ); - return this; + return function ( angle ) { - } + return this.rotateOnAxis( v1, angle ); + + }; + + }(), + + rotateY: function () { + + var v1 = new THREE.Vector3( 0, 1, 0 ); + + return function ( angle ) { + + return this.rotateOnAxis( v1, angle ); + + }; + + }(), + + rotateZ: function () { + + var v1 = new THREE.Vector3( 0, 0, 1 ); + + return function ( angle ) { + + return this.rotateOnAxis( v1, angle ); + + }; }(), @@ -6350,15 +7223,7 @@ THREE.Object3D.prototype = { v1.copy( axis ); - if ( this.useQuaternion === true ) { - - v1.applyQuaternion( this.quaternion ); - - } else { - - v1.applyEuler( this.rotation, this.eulerOrder ); - - } + v1.applyQuaternion( this.quaternion ); this.position.add( v1.multiplyScalar( distance ) ); @@ -6439,15 +7304,7 @@ THREE.Object3D.prototype = { m1.lookAt( vector, this.position, this.up ); - if ( this.useQuaternion === true ) { - - this.quaternion.setFromRotationMatrix( m1 ); - - } else { - - this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder ); - - } + this.quaternion.setFromRotationMatrix( m1 ); }; @@ -6471,6 +7328,8 @@ THREE.Object3D.prototype = { } object.parent = this; + object.dispatchEvent( { type: 'added' } ); + this.children.push( object ); // add to scene @@ -6500,6 +7359,8 @@ THREE.Object3D.prototype = { if ( index !== - 1 ) { object.parent = undefined; + object.dispatchEvent( { type: 'removed' } ); + this.children.splice( index, 1 ); // remove from scene @@ -6619,17 +7480,7 @@ THREE.Object3D.prototype = { updateMatrix: function () { - // if we are not using a quaternion directly, convert Euler rotation to this.quaternion. - - if ( this.useQuaternion === false ) { - - this.matrix.makeFromPositionEulerScale( this.position, this.rotation, this.eulerOrder, this.scale ); - - } else { - - this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale ); - - } + this.matrix.compose( this.position, this.quaternion, this.scale ); this.matrixWorldNeedsUpdate = true; @@ -6667,17 +7518,17 @@ THREE.Object3D.prototype = { }, - clone: function ( object ) { + clone: function ( object, recursive ) { if ( object === undefined ) object = new THREE.Object3D(); + if ( recursive === undefined ) recursive = true; object.name = this.name; object.up.copy( this.up ); object.position.copy( this.position ); - if ( object.rotation instanceof THREE.Vector3 ) object.rotation.copy( this.rotation ); // because of Sprite madness - object.eulerOrder = this.eulerOrder; + object.quaternion.copy( this.quaternion ); object.scale.copy( this.scale ); object.renderDepth = this.renderDepth; @@ -6690,9 +7541,6 @@ THREE.Object3D.prototype = { object.matrixAutoUpdate = this.matrixAutoUpdate; object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate; - object.quaternion.copy( this.quaternion ); - object.useQuaternion = this.useQuaternion; - object.visible = this.visible; object.castShadow = this.castShadow; @@ -6702,10 +7550,14 @@ THREE.Object3D.prototype = { object.userData = JSON.parse( JSON.stringify( this.userData ) ); - for ( var i = 0; i < this.children.length; i ++ ) { + if ( recursive === true ) { - var child = this.children[ i ]; - object.add( child.clone() ); + for ( var i = 0; i < this.children.length; i ++ ) { + + var child = this.children[ i ]; + object.add( child.clone() ); + + } } @@ -6715,9 +7567,10 @@ THREE.Object3D.prototype = { }; -THREE.Object3D.defaultEulerOrder = 'XYZ', +THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype ); THREE.Object3DIdCount = 0; + /** * @author mrdoob / http://mrdoob.com/ * @author supereggbert / http://www.paulbrunt.co.uk/ @@ -6795,102 +7648,73 @@ THREE.Projector = function () { }; - var projectGraph = function ( root, sortObjects ) { - - _objectCount = 0; - - _renderData.objects.length = 0; - _renderData.sprites.length = 0; - _renderData.lights.length = 0; - - var projectObject = function ( parent ) { - - for ( var c = 0, cl = parent.children.length; c < cl; c ++ ) { - - var object = parent.children[ c ]; - - if ( object.visible === false ) continue; + var getObject = function ( object ) { - if ( object instanceof THREE.Light ) { + _object = getNextObjectInPool(); + _object.id = object.id; + _object.object = object; - _renderData.lights.push( object ); + if ( object.renderDepth !== null ) { - } else if ( object instanceof THREE.Mesh || object instanceof THREE.Line ) { + _object.z = object.renderDepth; - if ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) { - - _object = getNextObjectInPool(); - _object.object = object; - - if ( object.renderDepth !== null ) { - - _object.z = object.renderDepth; - - } else { - - _vector3.getPositionFromMatrix( object.matrixWorld ); - _vector3.applyProjection( _viewProjectionMatrix ); - _object.z = _vector3.z; - - } + } else { - _renderData.objects.push( _object ); + _vector3.getPositionFromMatrix( object.matrixWorld ); + _vector3.applyProjection( _viewProjectionMatrix ); + _object.z = _vector3.z; - } - - } else if ( object instanceof THREE.Sprite || object instanceof THREE.Particle ) { + } - _object = getNextObjectInPool(); - _object.object = object; + return _object; - // TODO: Find an elegant and performant solution and remove this dupe code. + }; - if ( object.renderDepth !== null ) { + var projectObject = function ( object ) { - _object.z = object.renderDepth; + if ( object.visible === false ) return; - } else { + if ( object instanceof THREE.Light ) { - _vector3.getPositionFromMatrix( object.matrixWorld ); - _vector3.applyProjection( _viewProjectionMatrix ); - _object.z = _vector3.z; + _renderData.lights.push( object ); - } + } else if ( object instanceof THREE.Mesh || object instanceof THREE.Line ) { - _renderData.sprites.push( _object ); + if ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) { - } else { + _renderData.objects.push( getObject( object ) ); - _object = getNextObjectInPool(); - _object.object = object; + } - if ( object.renderDepth !== null ) { + } else if ( object instanceof THREE.Sprite || object instanceof THREE.Particle ) { - _object.z = object.renderDepth; + _renderData.sprites.push( getObject( object ) ); - } else { + } - _vector3.getPositionFromMatrix( object.matrixWorld ); - _vector3.applyProjection( _viewProjectionMatrix ); - _object.z = _vector3.z; + for ( var i = 0, l = object.children.length; i < l; i ++ ) { - } + projectObject( object.children[ i ] ); - _renderData.objects.push( _object ); + } - } + }; - projectObject( object ); + var projectGraph = function ( root, sortObjects ) { - } + _objectCount = 0; - }; + _renderData.objects.length = 0; + _renderData.sprites.length = 0; + _renderData.lights.length = 0; projectObject( root ); - if ( sortObjects === true ) _renderData.objects.sort( painterSort ); + if ( sortObjects === true ) { - return _renderData; + _renderData.objects.sort( painterSort ); + + } }; @@ -6918,7 +7742,7 @@ THREE.Projector = function () { _frustum.setFromMatrix( _viewProjectionMatrix ); - _renderData = projectGraph( scene, sortObjects ); + projectGraph( scene, sortObjects ); for ( o = 0, ol = _renderData.objects.length; o < ol; o ++ ) { @@ -6948,9 +7772,11 @@ THREE.Projector = function () { _vertex.positionWorld.copy( vertices[ v ] ).applyMatrix4( _modelMatrix ); _vertex.positionScreen.copy( _vertex.positionWorld ).applyMatrix4( _viewProjectionMatrix ); - _vertex.positionScreen.x /= _vertex.positionScreen.w; - _vertex.positionScreen.y /= _vertex.positionScreen.w; - _vertex.positionScreen.z /= _vertex.positionScreen.w; + var invW = 1 / _vertex.positionScreen.w; + + _vertex.positionScreen.x *= invW; + _vertex.positionScreen.y *= invW; + _vertex.positionScreen.z *= invW; _vertex.visible = ! ( _vertex.positionScreen.x < -1 || _vertex.positionScreen.x > 1 || _vertex.positionScreen.y < -1 || _vertex.positionScreen.y > 1 || @@ -6990,6 +7816,7 @@ THREE.Projector = function () { _face = getNextFace3InPool(); + _face.id = object.id; _face.v1.copy( v1 ); _face.v2.copy( v2 ); _face.v3.copy( v3 ); @@ -7031,6 +7858,7 @@ THREE.Projector = function () { _face = getNextFace4InPool(); + _face.id = object.id; _face.v1.copy( v1 ); _face.v2.copy( v2 ); _face.v3.copy( v3 ); @@ -7142,6 +7970,8 @@ THREE.Projector = function () { _clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w ); _line = getNextLineInPool(); + + _line.id = object.id; _line.v1.positionScreen.copy( _clippedVertex1PositionScreen ); _line.v2.positionScreen.copy( _clippedVertex2PositionScreen ); @@ -7177,15 +8007,18 @@ THREE.Projector = function () { _vector4.set( _modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1 ); _vector4.applyMatrix4( _viewProjectionMatrix ); - _vector4.z /= _vector4.w; + var invW = 1 / _vector4.w; + + _vector4.z *= invW; if ( _vector4.z > 0 && _vector4.z < 1 ) { _particle = getNextParticleInPool(); - _particle.object = object; - _particle.x = _vector4.x / _vector4.w; - _particle.y = _vector4.y / _vector4.w; + _particle.id = object.id; + _particle.x = _vector4.x * invW; + _particle.y = _vector4.y * invW; _particle.z = _vector4.z; + _particle.object = object; _particle.rotation = object.rotation.z; @@ -7311,7 +8144,19 @@ THREE.Projector = function () { function painterSort( a, b ) { - return b.z - a.z; + if ( a.z !== b.z ) { + + return b.z - a.z; + + } else if ( a.id !== b.id ) { + + return a.id - b.id; + + } else { + + return 0; + + } } @@ -7386,6 +8231,7 @@ THREE.Projector = function () { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -7435,6 +8281,7 @@ THREE.Face3.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -7485,6 +8332,7 @@ THREE.Face4.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author kile / http://kile.stravaganza.org/ @@ -7497,6 +8345,7 @@ THREE.Face4.prototype = { THREE.Geometry = function () { this.id = THREE.GeometryIdCount ++; + this.uuid = THREE.Math.generateUUID(); this.name = ''; @@ -7543,11 +8392,6 @@ THREE.Geometry.prototype = { constructor: THREE.Geometry, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - applyMatrix: function ( matrix ) { var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); @@ -7574,6 +8418,18 @@ THREE.Geometry.prototype = { } + if ( this.boundingBox instanceof THREE.Box3 ) { + + this.computeBoundingBox(); + + } + + if ( this.boundingSphere instanceof THREE.Sphere ) { + + this.computeBoundingSphere(); + + } + }, computeCentroids: function () { @@ -8080,7 +8936,7 @@ THREE.Geometry.prototype = { } - this.boundingSphere.setFromCenterAndPoints( this.boundingSphere.center, this.vertices ); + this.boundingSphere.setFromPoints( this.vertices ); }, @@ -8107,7 +8963,7 @@ THREE.Geometry.prototype = { for ( i = 0, il = this.vertices.length; i < il; i ++ ) { v = this.vertices[ i ]; - key = [ Math.round( v.x * precision ), Math.round( v.y * precision ), Math.round( v.z * precision ) ].join( '_' ); + key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); if ( verticesMap[ key ] === undefined ) { @@ -8290,7 +9146,10 @@ THREE.Geometry.prototype = { }; +THREE.EventDispatcher.prototype.apply( THREE.Geometry.prototype ); + THREE.GeometryIdCount = 0; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -8298,6 +9157,7 @@ THREE.GeometryIdCount = 0; THREE.BufferGeometry = function () { this.id = THREE.GeometryIdCount ++; + this.uuid = THREE.Math.generateUUID(); // attributes @@ -8328,11 +9188,6 @@ THREE.BufferGeometry.prototype = { constructor: THREE.BufferGeometry, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - applyMatrix: function ( matrix ) { var positionArray; @@ -8480,8 +9335,7 @@ THREE.BufferGeometry.prototype = { this.attributes[ "normal" ] = { itemSize: 3, - array: new Float32Array( nVertexElements ), - numItems: nVertexElements + array: new Float32Array( nVertexElements ) }; @@ -8664,8 +9518,7 @@ THREE.BufferGeometry.prototype = { this.attributes[ "tangent" ] = { itemSize: 4, - array: new Float32Array( nTangentElements ), - numItems: nTangentElements + array: new Float32Array( nTangentElements ) }; @@ -8845,6 +9698,9 @@ THREE.BufferGeometry.prototype = { } }; + +THREE.EventDispatcher.prototype.apply( THREE.BufferGeometry.prototype ); + /** * @author mrdoob / http://mrdoob.com/ * @author mikael emtinger / http://gomo.se/ @@ -8874,19 +9730,12 @@ THREE.Camera.prototype.lookAt = function () { m1.lookAt( this.position, vector, this.up ); - if ( this.useQuaternion === true ) { - - this.quaternion.setFromRotationMatrix( m1 ); - - } else { - - this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder ); - - } + this.quaternion.setFromRotationMatrix( m1 ); }; }(); + /** * @author alteredq / http://alteredqualia.com/ */ @@ -8914,6 +9763,7 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () { this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far ); }; + /** * @author mrdoob / http://mrdoob.com/ * @author greggman / http://games.greggman.com/ @@ -9030,6 +9880,7 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () { } }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -9056,6 +9907,7 @@ THREE.Light.prototype.clone = function ( light ) { return light; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -9077,6 +9929,7 @@ THREE.AmbientLight.prototype.clone = function () { return light; }; + /** * @author MPanknin / http://www.redplant.de/ * @author alteredq / http://alteredqualia.com/ @@ -9102,6 +9955,7 @@ THREE.AreaLight = function ( hex, intensity ) { THREE.AreaLight.prototype = Object.create( THREE.Light.prototype ); + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -9180,6 +10034,7 @@ THREE.DirectionalLight.prototype.clone = function () { return light; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -9209,6 +10064,7 @@ THREE.HemisphereLight.prototype.clone = function () { return light; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -9236,6 +10092,7 @@ THREE.PointLight.prototype.clone = function () { return light; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -9299,6 +10156,7 @@ THREE.SpotLight.prototype.clone = function () { return light; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -9740,13 +10598,81 @@ THREE.Loader.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ */ -THREE.ImageLoader = function () { +THREE.XHRLoader = function ( manager ) { - this.crossOrigin = null; + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + +}; + +THREE.XHRLoader.prototype = { + + constructor: THREE.XHRLoader, + + load: function ( url, onLoad, onProgress, onError ) { + + var scope = this; + var request = new XMLHttpRequest(); + + if ( onLoad !== undefined ) { + + request.addEventListener( 'load', function ( event ) { + + scope.manager.itemEnd( url ); + onLoad( event.target.responseText ); + + }, false ); + + } + + if ( onProgress !== undefined ) { + + request.addEventListener( 'progress', function ( event ) { + + onProgress( event ); + + }, false ); + + } + + if ( onError !== undefined ) { + + request.addEventListener( 'error', function ( event ) { + + onError( event ); + + }, false ); + + } + + if ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin; + + request.open( 'GET', url, true ); + request.send( null ); + + scope.manager.itemStart( url ); + + }, + + setCrossOrigin: function ( value ) { + + this.crossOrigin = value; + + } + +}; + +/** + * @author mrdoob / http://mrdoob.com/ + */ + +THREE.ImageLoader = function ( manager ) { + + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; }; @@ -9754,36 +10680,58 @@ THREE.ImageLoader.prototype = { constructor: THREE.ImageLoader, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - - load: function ( url, image ) { + load: function ( url, onLoad, onProgress, onError ) { var scope = this; + var image = document.createElement( 'img' ); + + if ( onLoad !== undefined ) { - if ( image === undefined ) image = new Image(); + image.addEventListener( 'load', function ( event ) { - image.addEventListener( 'load', function () { + scope.manager.itemEnd( url ); + onLoad( this ); - scope.dispatchEvent( { type: 'load', content: image } ); + }, false ); - }, false ); + } + + if ( onProgress !== undefined ) { + + image.addEventListener( 'progress', function ( event ) { + + onProgress( event ); + + }, false ); + + } - image.addEventListener( 'error', function () { + if ( onError !== undefined ) { - scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); + image.addEventListener( 'error', function ( event ) { - }, false ); + onError( event ); - if ( scope.crossOrigin ) image.crossOrigin = scope.crossOrigin; + }, false ); + + } + + if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin; image.src = url; + scope.manager.itemStart( url ); + + }, + + setCrossOrigin: function ( value ) { + + this.crossOrigin = value; + } } + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -9893,6 +10841,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { geometry.computeCentroids(); geometry.computeFaceNormals(); + geometry.computeBoundingSphere(); function parseModel( scale ) { @@ -9926,18 +10875,22 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { nUvLayers = 0; - // disregard empty arrays + if ( json.uvs !== undefined ) { - for ( i = 0; i < json.uvs.length; i++ ) { + // disregard empty arrays - if ( json.uvs[ i ].length ) nUvLayers ++; + for ( i = 0; i < json.uvs.length; i++ ) { - } + if ( json.uvs[ i ].length ) nUvLayers ++; + + } - for ( i = 0; i < nUvLayers; i++ ) { + for ( i = 0; i < nUvLayers; i++ ) { - geometry.faceUvs[ i ] = []; - geometry.faceVertexUvs[ i ] = []; + geometry.faceUvs[ i ] = []; + geometry.faceVertexUvs[ i ] = []; + + } } @@ -10228,92 +11181,80 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { } }; + /** * @author mrdoob / http://mrdoob.com/ */ -THREE.LoadingMonitor = function () { +THREE.LoadingManager = function ( onLoad, onProgress, onError ) { var scope = this; - var loaded = 0; - var total = 0; + var loaded = 0, total = 0; - var onLoad = function ( event ) { + this.onLoad = onLoad; + this.onProgress = onProgress; + this.onError = onError; - loaded ++; + this.itemStart = function ( url ) { - scope.dispatchEvent( { type: 'progress', loaded: loaded, total: total } ); + total ++; - if ( loaded === total ) { + }; - scope.dispatchEvent( { type: 'load' } ); + this.itemEnd = function ( url ) { - } + loaded ++; - }; + if ( scope.onProgress !== undefined ) { - this.add = function ( loader ) { + scope.onProgress( url, loaded, total ); - total ++; + } - loader.addEventListener( 'load', onLoad, false ); + if ( loaded === total && scope.onLoad !== undefined ) { - }; + scope.onLoad(); -}; + } -THREE.LoadingMonitor.prototype = { + }; - constructor: THREE.LoadingMonitor, +}; - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent +THREE.DefaultLoadingManager = new THREE.LoadingManager(); -}; /** * @author mrdoob / http://mrdoob.com/ */ -THREE.GeometryLoader = function () {}; -THREE.GeometryLoader.prototype = { - - constructor: THREE.GeometryLoader, - - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, +THREE.GeometryLoader = function ( manager ) { - load: function ( url ) { + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - var scope = this; - var request = new XMLHttpRequest(); - - request.addEventListener( 'load', function ( event ) { +}; - var response = scope.parse( JSON.parse( event.target.responseText ) ); +THREE.GeometryLoader.prototype = { - scope.dispatchEvent( { type: 'load', content: response } ); + constructor: THREE.GeometryLoader, - }, false ); + load: function ( url, onLoad, onProgress, onError ) { - request.addEventListener( 'progress', function ( event ) { + var scope = this; - scope.dispatchEvent( { type: 'progress', loaded: event.loaded, total: event.total } ); + var loader = new THREE.XHRLoader(); + loader.setCrossOrigin( this.crossOrigin ); + loader.load( url, function ( text ) { - }, false ); + onLoad( scope.parse( JSON.parse( text ) ) ); - request.addEventListener( 'error', function () { + } ); - scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); + }, - }, false ); + setCrossOrigin: function ( value ) { - request.open( 'GET', url, true ); - request.send( null ); + this.crossOrigin = value; }, @@ -10324,48 +11265,38 @@ THREE.GeometryLoader.prototype = { } }; + /** * @author mrdoob / http://mrdoob.com/ */ -THREE.MaterialLoader = function () {}; +THREE.MaterialLoader = function ( manager ) { + + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + +}; THREE.MaterialLoader.prototype = { constructor: THREE.MaterialLoader, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - - load: function ( url ) { + load: function ( url, onLoad, onProgress, onError ) { var scope = this; - var request = new XMLHttpRequest(); - - request.addEventListener( 'load', function ( event ) { - - var response = scope.parse( JSON.parse( event.target.responseText ) ); - - scope.dispatchEvent( { type: 'load', content: response } ); - - }, false ); - request.addEventListener( 'progress', function ( event ) { + var loader = new THREE.XHRLoader(); + loader.setCrossOrigin( this.crossOrigin ); + loader.load( url, function ( text ) { - scope.dispatchEvent( { type: 'progress', loaded: event.loaded, total: event.total } ); + onLoad( scope.parse( JSON.parse( text ) ) ); - }, false ); + } ); - request.addEventListener( 'error', function () { - - scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); + }, - }, false ); + setCrossOrigin: function ( value ) { - request.open( 'GET', url, true ); - request.send( null ); + this.crossOrigin = value; }, @@ -10446,1228 +11377,1564 @@ THREE.MaterialLoader.prototype = { } + if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; + return material; } }; + /** - * @author alteredq / http://alteredqualia.com/ + * @author mrdoob / http://mrdoob.com/ */ -THREE.SceneLoader = function () { +THREE.ObjectLoader = function ( manager ) { - this.onLoadStart = function () {}; - this.onLoadProgress = function() {}; - this.onLoadComplete = function () {}; + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - this.callbackSync = function () {}; - this.callbackProgress = function () {}; +}; - this.geometryHandlerMap = {}; - this.hierarchyHandlerMap = {}; +THREE.ObjectLoader.prototype = { - this.addGeometryHandler( "ascii", THREE.JSONLoader ); + constructor: THREE.ObjectLoader, -}; + load: function ( url, onLoad, onProgress, onError ) { -THREE.SceneLoader.prototype.constructor = THREE.SceneLoader; + var scope = this; -THREE.SceneLoader.prototype.load = function ( url, callbackFinished ) { + var loader = new THREE.XHRLoader( scope.manager ); + loader.setCrossOrigin( this.crossOrigin ); + loader.load( url, function ( text ) { - var scope = this; + onLoad( scope.parse( JSON.parse( text ) ) ); - var xhr = new XMLHttpRequest(); + } ); - xhr.onreadystatechange = function () { + }, - if ( xhr.readyState === 4 ) { + setCrossOrigin: function ( value ) { - if ( xhr.status === 200 || xhr.status === 0 ) { + this.crossOrigin = value; - var json = JSON.parse( xhr.responseText ); - scope.parse( json, callbackFinished, url ); + }, - } else { + parse: function ( json ) { + + var geometries = this.parseGeometries( json.geometries ); + var materials = this.parseMaterials( json.materials ); + var object = this.parseObject( json.object, geometries, materials ); + + return object; + + }, + + parseGeometries: function ( json ) { + + var geometries = {}; + + if ( json !== undefined ) { + + var loader = new THREE.JSONLoader(); + + for ( var i = 0, l = json.length; i < l; i ++ ) { + + var geometry; + var data = json[ i ]; + + switch ( data.type ) { + + case 'PlaneGeometry': + + geometry = new THREE.PlaneGeometry( + data.width, + data.height, + data.widthSegments, + data.heightSegments + ); + + break; + + case 'CubeGeometry': + + geometry = new THREE.CubeGeometry( + data.width, + data.height, + data.depth, + data.widthSegments, + data.heightSegments, + data.depthSegments + ); + + break; + + case 'CylinderGeometry': - console.error( "THREE.SceneLoader: Couldn't load [" + url + "] [" + xhr.status + "]" ); + geometry = new THREE.CylinderGeometry( + data.radiusTop, + data.radiusBottom, + data.height, + data.radiusSegments, + data.heightSegments, + data.openEnded + ); + + break; + + case 'SphereGeometry': + + geometry = new THREE.SphereGeometry( + data.radius, + data.widthSegments, + data.heightSegments, + data.phiStart, + data.phiLength, + data.thetaStart, + data.thetaLength + ); + + break; + + case 'IcosahedronGeometry': + + geometry = new THREE.IcosahedronGeometry( + data.radius, + data.detail + ); + + break; + + case 'TorusGeometry': + + geometry = new THREE.TorusGeometry( + data.radius, + data.tube, + data.radialSegments, + data.tubularSegments, + data.arc + ); + + break; + + case 'TorusKnotGeometry': + + geometry = new THREE.TorusKnotGeometry( + data.radius, + data.tube, + data.radialSegments, + data.tubularSegments, + data.p, + data.q, + data.heightScale + ); + + break; + + case 'Geometry': + + geometry = loader.parse( data.data ).geometry; + + break; + + } + + geometry.uuid = data.uuid; + + if ( data.name !== undefined ) geometry.name = data.name; + + geometries[ data.uuid ] = geometry; } } - }; + return geometries; - xhr.open( "GET", url, true ); - xhr.send( null ); + }, -}; + parseMaterials: function ( json ) { + + var materials = {}; + + if ( json !== undefined ) { + + var loader = new THREE.MaterialLoader(); + + for ( var i = 0, l = json.length; i < l; i ++ ) { + + var data = json[ i ]; + var material = loader.parse( data ); + + material.uuid = data.uuid; + + if ( data.name !== undefined ) material.name = data.name; + + materials[ data.uuid ] = material; + + } + + } + + return materials; + + }, + + parseObject: function () { + + var matrix = new THREE.Matrix4(); + + return function ( data, geometries, materials ) { -THREE.SceneLoader.prototype.addGeometryHandler = function ( typeID, loaderClass ) { + var object; - this.geometryHandlerMap[ typeID ] = { "loaderClass": loaderClass }; + switch ( data.type ) { + + case 'Scene': + + object = new THREE.Scene(); + + break; + + case 'PerspectiveCamera': + + object = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); + + break; + + case 'OrthographicCamera': + + object = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); + + break; + + case 'AmbientLight': + + object = new THREE.AmbientLight( data.color ); + + break; + + case 'DirectionalLight': + + object = new THREE.DirectionalLight( data.color, data.intensity ); + + break; + + case 'PointLight': + + object = new THREE.PointLight( data.color, data.intensity, data.distance ); + + break; + + case 'SpotLight': + + object = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent ); + + break; + + case 'HemisphereLight': + + object = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity ); + + break; + + case 'Mesh': + + var geometry = geometries[ data.geometry ]; + var material = materials[ data.material ]; + + if ( geometry === undefined ) { + + console.error( 'THREE.ObjectLoader: Undefined geometry ' + data.geometry ); + + } + + if ( material === undefined ) { + + console.error( 'THREE.ObjectLoader: Undefined material ' + data.material ); + + } + + object = new THREE.Mesh( geometry, material ); + + break; + + default: + + object = new THREE.Object3D(); + + } + + object.uuid = data.uuid; + + if ( data.name !== undefined ) object.name = data.name; + if ( data.matrix !== undefined ) { + + matrix.fromArray( data.matrix ); + matrix.decompose( object.position, object.quaternion, object.scale ); + + } else { + + if ( data.position !== undefined ) object.position.fromArray( data.position ); + if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); + if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); + + } + + if ( data.visible !== undefined ) object.visible = data.visible; + if ( data.userData !== undefined ) object.userData = data.userData; + + if ( data.children !== undefined ) { + + for ( var child in data.children ) { + + object.add( this.parseObject( data.children[ child ], geometries, materials ) ); + + } + + } + + return object; + + } + + }() }; -THREE.SceneLoader.prototype.addHierarchyHandler = function ( typeID, loaderClass ) { +/** + * @author alteredq / http://alteredqualia.com/ + */ + +THREE.SceneLoader = function () { + + this.onLoadStart = function () {}; + this.onLoadProgress = function() {}; + this.onLoadComplete = function () {}; + + this.callbackSync = function () {}; + this.callbackProgress = function () {}; + + this.geometryHandlers = {}; + this.hierarchyHandlers = {}; - this.hierarchyHandlerMap[ typeID ] = { "loaderClass": loaderClass }; + this.addGeometryHandler( "ascii", THREE.JSONLoader ); }; -THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) { +THREE.SceneLoader.prototype = { - var scope = this; + constructor: THREE.SceneLoader, + + load: function ( url, onLoad, onProgress, onError ) { - var urlBase = THREE.Loader.prototype.extractUrlBase( url ); + var scope = this; - var geometry, material, camera, fog, - texture, images, color, - light, hex, intensity, - counter_models, counter_textures, - total_models, total_textures, - result; + var loader = new THREE.XHRLoader( scope.manager ); + loader.setCrossOrigin( this.crossOrigin ); + loader.load( url, function ( text ) { - var target_array = []; + scope.parse( JSON.parse( text ), onLoad, url ); - var data = json; + } ); - // async geometry loaders + }, - for ( var typeID in this.geometryHandlerMap ) { + setCrossOrigin: function ( value ) { - var loaderClass = this.geometryHandlerMap[ typeID ][ "loaderClass" ]; - this.geometryHandlerMap[ typeID ][ "loaderObject" ] = new loaderClass(); + this.crossOrigin = value; - } + }, - // async hierachy loaders + addGeometryHandler: function ( typeID, loaderClass ) { - for ( var typeID in this.hierarchyHandlerMap ) { + this.geometryHandlers[ typeID ] = { "loaderClass": loaderClass }; - var loaderClass = this.hierarchyHandlerMap[ typeID ][ "loaderClass" ]; - this.hierarchyHandlerMap[ typeID ][ "loaderObject" ] = new loaderClass(); + }, - } + addHierarchyHandler: function ( typeID, loaderClass ) { - counter_models = 0; - counter_textures = 0; + this.hierarchyHandlers[ typeID ] = { "loaderClass": loaderClass }; - result = { + }, - scene: new THREE.Scene(), - geometries: {}, - face_materials: {}, - materials: {}, - textures: {}, - objects: {}, - cameras: {}, - lights: {}, - fogs: {}, - empties: {}, - groups: {} + parse: function ( json, callbackFinished, url ) { - }; + var scope = this; - if ( data.transform ) { + var urlBase = THREE.Loader.prototype.extractUrlBase( url ); - var position = data.transform.position, - rotation = data.transform.rotation, - scale = data.transform.scale; + var geometry, material, camera, fog, + texture, images, color, + light, hex, intensity, + counter_models, counter_textures, + total_models, total_textures, + result; - if ( position ) - result.scene.position.set( position[ 0 ], position[ 1 ], position [ 2 ] ); + var target_array = []; - if ( rotation ) - result.scene.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation [ 2 ] ); + var data = json; - if ( scale ) - result.scene.scale.set( scale[ 0 ], scale[ 1 ], scale [ 2 ] ); + // async geometry loaders - if ( position || rotation || scale ) { + for ( var typeID in this.geometryHandlers ) { - result.scene.updateMatrix(); - result.scene.updateMatrixWorld(); + var loaderClass = this.geometryHandlers[ typeID ][ "loaderClass" ]; + this.geometryHandlers[ typeID ][ "loaderObject" ] = new loaderClass(); } - } + // async hierachy loaders - function get_url( source_url, url_type ) { + for ( var typeID in this.hierarchyHandlers ) { - if ( url_type == "relativeToHTML" ) { + var loaderClass = this.hierarchyHandlers[ typeID ][ "loaderClass" ]; + this.hierarchyHandlers[ typeID ][ "loaderObject" ] = new loaderClass(); - return source_url; + } - } else { + counter_models = 0; + counter_textures = 0; - return urlBase + "/" + source_url; + result = { - } + scene: new THREE.Scene(), + geometries: {}, + face_materials: {}, + materials: {}, + textures: {}, + objects: {}, + cameras: {}, + lights: {}, + fogs: {}, + empties: {}, + groups: {} - }; + }; - // toplevel loader function, delegates to handle_children + if ( data.transform ) { - function handle_objects() { + var position = data.transform.position, + rotation = data.transform.rotation, + scale = data.transform.scale; - handle_children( result.scene, data.objects ); + if ( position ) { - } + result.scene.position.fromArray( position ); - // handle all the children from the loaded json and attach them to given parent + } - function handle_children( parent, children ) { + if ( rotation ) { - var mat, dst, pos, rot, scl, quat; + result.scene.rotation.fromArray( rotation ); - for ( var objID in children ) { + } - // check by id if child has already been handled, - // if not, create new object + if ( scale ) { - if ( result.objects[ objID ] === undefined ) { + result.scene.scale.fromArray( scale ); - var objJSON = children[ objID ]; + } - var object = null; + if ( position || rotation || scale ) { - // meshes + result.scene.updateMatrix(); + result.scene.updateMatrixWorld(); - if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlerMap ) ) { + } - if ( objJSON.loading === undefined ) { + } - var reservedTypes = { "type": 1, "url": 1, "material": 1, - "position": 1, "rotation": 1, "scale" : 1, - "visible": 1, "children": 1, "userData": 1, - "skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1 }; + function get_url( source_url, url_type ) { - var loaderParameters = {}; + if ( url_type == "relativeToHTML" ) { - for ( var parType in objJSON ) { + return source_url; - if ( ! ( parType in reservedTypes ) ) { + } else { - loaderParameters[ parType ] = objJSON[ parType ]; + return urlBase + "/" + source_url; - } + } - } + }; - material = result.materials[ objJSON.material ]; + // toplevel loader function, delegates to handle_children - objJSON.loading = true; + function handle_objects() { - var loader = scope.hierarchyHandlerMap[ objJSON.type ][ "loaderObject" ]; + handle_children( result.scene, data.objects ); - // ColladaLoader + } - if ( loader.options ) { + // handle all the children from the loaded json and attach them to given parent - loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) ); + function handle_children( parent, children ) { - // UTF8Loader - // OBJLoader + var mat, dst, pos, rot, scl, quat; - } else { + for ( var objID in children ) { - loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ), loaderParameters ); + // check by id if child has already been handled, + // if not, create new object - } + var object = result.objects[ objID ]; + var objJSON = children[ objID ]; - } + if ( object === undefined ) { - } else if ( objJSON.geometry !== undefined ) { + // meshes - geometry = result.geometries[ objJSON.geometry ]; + if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) { - // geometry already loaded + if ( objJSON.loading === undefined ) { - if ( geometry ) { + var reservedTypes = { + "type": 1, "url": 1, "material": 1, + "position": 1, "rotation": 1, "scale" : 1, + "visible": 1, "children": 1, "userData": 1, + "skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1 + }; - var needsTangents = false; + var loaderParameters = {}; - material = result.materials[ objJSON.material ]; - needsTangents = material instanceof THREE.ShaderMaterial; + for ( var parType in objJSON ) { - pos = objJSON.position; - rot = objJSON.rotation; - scl = objJSON.scale; - mat = objJSON.matrix; - quat = objJSON.quaternion; + if ( ! ( parType in reservedTypes ) ) { - // use materials from the model file - // if there is no material specified in the object + loaderParameters[ parType ] = objJSON[ parType ]; - if ( ! objJSON.material ) { + } - material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); + } - } + material = result.materials[ objJSON.material ]; - // use materials from the model file - // if there is just empty face material - // (must create new material as each model has its own face material) + objJSON.loading = true; - if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) { + var loader = scope.hierarchyHandlers[ objJSON.type ][ "loaderObject" ]; - material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); + // ColladaLoader - } + if ( loader.options ) { + + loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) ); - if ( material instanceof THREE.MeshFaceMaterial ) { + // UTF8Loader + // OBJLoader - for ( var i = 0; i < material.materials.length; i ++ ) { + } else { - needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial ); + loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ), loaderParameters ); } } - if ( needsTangents ) { + } else if ( objJSON.geometry !== undefined ) { - geometry.computeTangents(); + geometry = result.geometries[ objJSON.geometry ]; - } + // geometry already loaded + + if ( geometry ) { - if ( objJSON.skin ) { + var needsTangents = false; - object = new THREE.SkinnedMesh( geometry, material ); + material = result.materials[ objJSON.material ]; + needsTangents = material instanceof THREE.ShaderMaterial; - } else if ( objJSON.morph ) { + pos = objJSON.position; + rot = objJSON.rotation; + scl = objJSON.scale; + mat = objJSON.matrix; + quat = objJSON.quaternion; - object = new THREE.MorphAnimMesh( geometry, material ); + // use materials from the model file + // if there is no material specified in the object - if ( objJSON.duration !== undefined ) { + if ( ! objJSON.material ) { - object.duration = objJSON.duration; + material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); } - if ( objJSON.time !== undefined ) { + // use materials from the model file + // if there is just empty face material + // (must create new material as each model has its own face material) + + if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) { - object.time = objJSON.time; + material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); } - if ( objJSON.mirroredLoop !== undefined ) { + if ( material instanceof THREE.MeshFaceMaterial ) { - object.mirroredLoop = objJSON.mirroredLoop; + for ( var i = 0; i < material.materials.length; i ++ ) { + + needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial ); + + } } - if ( material.morphNormals ) { + if ( needsTangents ) { - geometry.computeMorphNormals(); + geometry.computeTangents(); } - } else { + if ( objJSON.skin ) { - object = new THREE.Mesh( geometry, material ); + object = new THREE.SkinnedMesh( geometry, material ); - } + } else if ( objJSON.morph ) { - object.name = objID; + object = new THREE.MorphAnimMesh( geometry, material ); - if ( mat ) { + if ( objJSON.duration !== undefined ) { - object.matrixAutoUpdate = false; - object.matrix.set( - mat[0], mat[1], mat[2], mat[3], - mat[4], mat[5], mat[6], mat[7], - mat[8], mat[9], mat[10], mat[11], - mat[12], mat[13], mat[14], mat[15] - ); + object.duration = objJSON.duration; - } else { + } + + if ( objJSON.time !== undefined ) { + + object.time = objJSON.time; + + } - object.position.set( pos[0], pos[1], pos[2] ); + if ( objJSON.mirroredLoop !== undefined ) { - if ( quat ) { + object.mirroredLoop = objJSON.mirroredLoop; - object.quaternion.set( quat[0], quat[1], quat[2], quat[3] ); - object.useQuaternion = true; + } + + if ( material.morphNormals ) { + + geometry.computeMorphNormals(); + + } } else { - object.rotation.set( rot[0], rot[1], rot[2] ); + object = new THREE.Mesh( geometry, material ); } - object.scale.set( scl[0], scl[1], scl[2] ); + object.name = objID; - } + if ( mat ) { - object.visible = objJSON.visible; - object.castShadow = objJSON.castShadow; - object.receiveShadow = objJSON.receiveShadow; + object.matrixAutoUpdate = false; + object.matrix.set( + mat[0], mat[1], mat[2], mat[3], + mat[4], mat[5], mat[6], mat[7], + mat[8], mat[9], mat[10], mat[11], + mat[12], mat[13], mat[14], mat[15] + ); - parent.add( object ); - - result.objects[ objID ] = object; + } else { - } + object.position.fromArray( pos ); - // lights + if ( quat ) { - } else if ( objJSON.type === "DirectionalLight" || objJSON.type === "PointLight" || objJSON.type === "AmbientLight" ) { + object.quaternion.fromArray( quat ); - hex = ( objJSON.color !== undefined ) ? objJSON.color : 0xffffff; - intensity = ( objJSON.intensity !== undefined ) ? objJSON.intensity : 1; + } else { - if ( objJSON.type === "DirectionalLight" ) { + object.rotation.fromArray( rot ); - pos = objJSON.direction; + } - light = new THREE.DirectionalLight( hex, intensity ); - light.position.set( pos[0], pos[1], pos[2] ); + object.scale.fromArray( scl ); - if ( objJSON.target ) { + } - target_array.push( { "object": light, "targetName" : objJSON.target } ); + object.visible = objJSON.visible; + object.castShadow = objJSON.castShadow; + object.receiveShadow = objJSON.receiveShadow; - // kill existing default target - // otherwise it gets added to scene when parent gets added + parent.add( object ); - light.target = null; + result.objects[ objID ] = object; } - } else if ( objJSON.type === "PointLight" ) { + // lights - pos = objJSON.position; - dst = objJSON.distance; + } else if ( objJSON.type === "DirectionalLight" || objJSON.type === "PointLight" || objJSON.type === "AmbientLight" ) { - light = new THREE.PointLight( hex, intensity, dst ); - light.position.set( pos[0], pos[1], pos[2] ); + hex = ( objJSON.color !== undefined ) ? objJSON.color : 0xffffff; + intensity = ( objJSON.intensity !== undefined ) ? objJSON.intensity : 1; - } else if ( objJSON.type === "AmbientLight" ) { + if ( objJSON.type === "DirectionalLight" ) { - light = new THREE.AmbientLight( hex ); + pos = objJSON.direction; - } + light = new THREE.DirectionalLight( hex, intensity ); + light.position.fromArray( pos ); - parent.add( light ); + if ( objJSON.target ) { - light.name = objID; - result.lights[ objID ] = light; - result.objects[ objID ] = light; + target_array.push( { "object": light, "targetName" : objJSON.target } ); - // cameras + // kill existing default target + // otherwise it gets added to scene when parent gets added - } else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) { + light.target = null; - pos = objJSON.position; - rot = objJSON.rotation; - quat = objJSON.quaternion; + } - if ( objJSON.type === "PerspectiveCamera" ) { + } else if ( objJSON.type === "PointLight" ) { - camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far ); + pos = objJSON.position; + dst = objJSON.distance; - } else if ( objJSON.type === "OrthographicCamera" ) { + light = new THREE.PointLight( hex, intensity, dst ); + light.position.fromArray( pos ); - camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far ); + } else if ( objJSON.type === "AmbientLight" ) { - } + light = new THREE.AmbientLight( hex ); - camera.name = objID; - camera.position.set( pos[0], pos[1], pos[2] ); + } - if ( quat !== undefined ) { + parent.add( light ); - camera.quaternion.set( quat[0], quat[1], quat[2], quat[3] ); - camera.useQuaternion = true; + light.name = objID; + result.lights[ objID ] = light; + result.objects[ objID ] = light; - } else if ( rot !== undefined ) { + // cameras - camera.rotation.set( rot[0], rot[1], rot[2] ); + } else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) { - } + pos = objJSON.position; + rot = objJSON.rotation; + quat = objJSON.quaternion; - parent.add( camera ); + if ( objJSON.type === "PerspectiveCamera" ) { - result.cameras[ objID ] = camera; - result.objects[ objID ] = camera; + camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far ); - // pure Object3D + } else if ( objJSON.type === "OrthographicCamera" ) { - } else { + camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far ); - pos = objJSON.position; - rot = objJSON.rotation; - scl = objJSON.scale; - quat = objJSON.quaternion; + } - object = new THREE.Object3D(); - object.name = objID; - object.position.set( pos[0], pos[1], pos[2] ); + camera.name = objID; + camera.position.fromArray( pos ); - if ( quat ) { + if ( quat !== undefined ) { - object.quaternion.set( quat[0], quat[1], quat[2], quat[3] ); - object.useQuaternion = true; + camera.quaternion.fromArray( quat ); - } else { + } else if ( rot !== undefined ) { - object.rotation.set( rot[0], rot[1], rot[2] ); + camera.rotation.fromArray( rot ); - } + } - object.scale.set( scl[0], scl[1], scl[2] ); - object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false; + parent.add( camera ); - parent.add( object ); + result.cameras[ objID ] = camera; + result.objects[ objID ] = camera; - result.objects[ objID ] = object; - result.empties[ objID ] = object; + // pure Object3D - } + } else { + + pos = objJSON.position; + rot = objJSON.rotation; + scl = objJSON.scale; + quat = objJSON.quaternion; + + object = new THREE.Object3D(); + object.name = objID; + object.position.fromArray( pos ); - if ( object ) { + if ( quat ) { - if ( objJSON.userData !== undefined ) { + object.quaternion.fromArray( quat ); - for ( var key in objJSON.userData ) { + } else { - var value = objJSON.userData[ key ]; - object.userData[ key ] = value; + object.rotation.fromArray( rot ); } - } + object.scale.fromArray( scl ); + object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false; + + parent.add( object ); + + result.objects[ objID ] = object; + result.empties[ objID ] = object; - if ( objJSON.groups !== undefined ) { + } - for ( var i = 0; i < objJSON.groups.length; i ++ ) { + if ( object ) { - var groupID = objJSON.groups[ i ]; + if ( objJSON.userData !== undefined ) { - if ( result.groups[ groupID ] === undefined ) { + for ( var key in objJSON.userData ) { - result.groups[ groupID ] = []; + var value = objJSON.userData[ key ]; + object.userData[ key ] = value; } - result.groups[ groupID ].push( objID ); + } + + if ( objJSON.groups !== undefined ) { + + for ( var i = 0; i < objJSON.groups.length; i ++ ) { + + var groupID = objJSON.groups[ i ]; + + if ( result.groups[ groupID ] === undefined ) { + + result.groups[ groupID ] = []; + + } + + result.groups[ groupID ].push( objID ); + + } } } - if ( objJSON.children !== undefined ) { + } - handle_children( object, objJSON.children ); + if ( object !== undefined && objJSON.children !== undefined ) { - } + handle_children( object, objJSON.children ); } } - } + }; - }; + function handle_mesh( geo, mat, id ) { - function handle_mesh( geo, mat, id ) { + result.geometries[ id ] = geo; + result.face_materials[ id ] = mat; + handle_objects(); - result.geometries[ id ] = geo; - result.face_materials[ id ] = mat; - handle_objects(); + }; - }; + function handle_hierarchy( node, id, parent, material, obj ) { - function handle_hierarchy( node, id, parent, material, obj ) { + var p = obj.position; + var r = obj.rotation; + var q = obj.quaternion; + var s = obj.scale; - var p = obj.position; - var r = obj.rotation; - var q = obj.quaternion; - var s = obj.scale; + node.position.fromArray( p ); - node.position.set( p[0], p[1], p[2] ); + if ( q ) { - if ( q ) { + node.quaternion.fromArray( q ); - node.quaternion.set( q[0], q[1], q[2], q[3] ); - node.useQuaternion = true; + } else { - } else { + node.rotation.fromArray( r ); - node.rotation.set( r[0], r[1], r[2] ); + } - } + node.scale.fromArray( s ); - node.scale.set( s[0], s[1], s[2] ); + // override children materials + // if object material was specified in JSON explicitly - // override children materials - // if object material was specified in JSON explicitly + if ( material ) { - if ( material ) { + node.traverse( function ( child ) { - node.traverse( function ( child ) { + child.material = material; - child.material = material; + } ); - } ); + } - } + // override children visibility + // with root node visibility as specified in JSON - // override children visibility - // with root node visibility as specified in JSON + var visible = ( obj.visible !== undefined ) ? obj.visible : true; - var visible = ( obj.visible !== undefined ) ? obj.visible : true; + node.traverse( function ( child ) { - node.traverse( function ( child ) { + child.visible = visible; - child.visible = visible; + } ); - } ); + parent.add( node ); - parent.add( node ); + node.name = id; - node.name = id; + result.objects[ id ] = node; + handle_objects(); - result.objects[ id ] = node; - handle_objects(); + }; - }; + function create_callback_geometry( id ) { - function create_callback_geometry( id ) { + return function ( geo, mat ) { - return function ( geo, mat ) { + geo.name = id; - geo.name = id; + handle_mesh( geo, mat, id ); - handle_mesh( geo, mat, id ); + counter_models -= 1; - counter_models -= 1; + scope.onLoadComplete(); - scope.onLoadComplete(); + async_callback_gate(); - async_callback_gate(); + } - } + }; - }; + function create_callback_hierachy( id, parent, material, obj ) { + + return function ( event ) { - function create_callback_hierachy( id, parent, material, obj ) { + var result; - return function ( event ) { + // loaders which use EventDispatcher - var result; + if ( event.content ) { - // loaders which use EventDispatcher + result = event.content; - if ( event.content ) { + // ColladaLoader - result = event.content; + } else if ( event.dae ) { - // ColladaLoader + result = event.scene; - } else if ( event.dae ) { - result = event.scene; + // UTF8Loader + } else { - // UTF8Loader + result = event; - } else { + } + + handle_hierarchy( result, id, parent, material, obj ); + + counter_models -= 1; + + scope.onLoadComplete(); - result = event; + async_callback_gate(); } - handle_hierarchy( result, id, parent, material, obj ); + }; - counter_models -= 1; + function create_callback_embed( id ) { - scope.onLoadComplete(); + return function ( geo, mat ) { - async_callback_gate(); + geo.name = id; - } + result.geometries[ id ] = geo; + result.face_materials[ id ] = mat; - }; + } - function create_callback_embed( id ) { + }; - return function ( geo, mat ) { + function async_callback_gate() { - geo.name = id; + var progress = { - result.geometries[ id ] = geo; - result.face_materials[ id ] = mat; + totalModels : total_models, + totalTextures : total_textures, + loadedModels : total_models - counter_models, + loadedTextures : total_textures - counter_textures - } + }; - }; + scope.callbackProgress( progress, result ); - function async_callback_gate() { + scope.onLoadProgress(); - var progress = { + if ( counter_models === 0 && counter_textures === 0 ) { - totalModels : total_models, - totalTextures : total_textures, - loadedModels : total_models - counter_models, - loadedTextures : total_textures - counter_textures + finalize(); + callbackFinished( result ); + + } }; - scope.callbackProgress( progress, result ); + function finalize() { - scope.onLoadProgress(); + // take care of targets which could be asynchronously loaded objects - if ( counter_models === 0 && counter_textures === 0 ) { + for ( var i = 0; i < target_array.length; i ++ ) { - finalize(); - callbackFinished( result ); + var ta = target_array[ i ]; - } + var target = result.objects[ ta.targetName ]; - }; + if ( target ) { - function finalize() { + ta.object.target = target; - // take care of targets which could be asynchronously loaded objects + } else { - for ( var i = 0; i < target_array.length; i ++ ) { + // if there was error and target of specified name doesn't exist in the scene file + // create instead dummy target + // (target must be added to scene explicitly as parent is already added) - var ta = target_array[ i ]; + ta.object.target = new THREE.Object3D(); + result.scene.add( ta.object.target ); - var target = result.objects[ ta.targetName ]; + } - if ( target ) { + ta.object.target.userData.targetInverse = ta.object; - ta.object.target = target; + } - } else { + }; - // if there was error and target of specified name doesn't exist in the scene file - // create instead dummy target - // (target must be added to scene explicitly as parent is already added) + var callbackTexture = function ( count ) { - ta.object.target = new THREE.Object3D(); - result.scene.add( ta.object.target ); + counter_textures -= count; + async_callback_gate(); - } + scope.onLoadComplete(); - ta.object.target.userData.targetInverse = ta.object; + }; - } + // must use this instead of just directly calling callbackTexture + // because of closure in the calling context loop - }; + var generateTextureCallback = function ( count ) { - var callbackTexture = function ( count ) { + return function () { - counter_textures -= count; - async_callback_gate(); + callbackTexture( count ); - scope.onLoadComplete(); + }; - }; + }; - // must use this instead of just directly calling callbackTexture - // because of closure in the calling context loop + function traverse_json_hierarchy( objJSON, callback ) { - var generateTextureCallback = function ( count ) { + callback( objJSON ); - return function () { + if ( objJSON.children !== undefined ) { + + for ( var objChildID in objJSON.children ) { + + traverse_json_hierarchy( objJSON.children[ objChildID ], callback ); + + } - callbackTexture( count ); + } }; - }; + // first go synchronous elements - // first go synchronous elements + // fogs - // fogs + var fogID, fogJSON; - var fogID, fogJSON; + for ( fogID in data.fogs ) { - for ( fogID in data.fogs ) { + fogJSON = data.fogs[ fogID ]; - fogJSON = data.fogs[ fogID ]; + if ( fogJSON.type === "linear" ) { - if ( fogJSON.type === "linear" ) { + fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far ); - fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far ); + } else if ( fogJSON.type === "exp2" ) { - } else if ( fogJSON.type === "exp2" ) { + fog = new THREE.FogExp2( 0x000000, fogJSON.density ); - fog = new THREE.FogExp2( 0x000000, fogJSON.density ); + } - } + color = fogJSON.color; + fog.color.setRGB( color[0], color[1], color[2] ); - color = fogJSON.color; - fog.color.setRGB( color[0], color[1], color[2] ); + result.fogs[ fogID ] = fog; - result.fogs[ fogID ] = fog; + } - } + // now come potentially asynchronous elements - // now come potentially asynchronous elements + // geometries - // geometries + // count how many geometries will be loaded asynchronously - // count how many geometries will be loaded asynchronously + var geoID, geoJSON; - var geoID, geoJSON; + for ( geoID in data.geometries ) { - for ( geoID in data.geometries ) { + geoJSON = data.geometries[ geoID ]; - geoJSON = data.geometries[ geoID ]; + if ( geoJSON.type in this.geometryHandlers ) { - if ( geoJSON.type in this.geometryHandlerMap ) { + counter_models += 1; - counter_models += 1; + scope.onLoadStart(); - scope.onLoadStart(); + } } - } + // count how many hierarchies will be loaded asynchronously - // count how many hierarchies will be loaded asynchronously + for ( var objID in data.objects ) { - var objID, objJSON; + traverse_json_hierarchy( data.objects[ objID ], function ( objJSON ) { - for ( objID in data.objects ) { + if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) { - objJSON = data.objects[ objID ]; + counter_models += 1; - if ( objJSON.type && ( objJSON.type in this.hierarchyHandlerMap ) ) { + scope.onLoadStart(); - counter_models += 1; + } - scope.onLoadStart(); + }); } - } + total_models = counter_models; - total_models = counter_models; + for ( geoID in data.geometries ) { - for ( geoID in data.geometries ) { + geoJSON = data.geometries[ geoID ]; - geoJSON = data.geometries[ geoID ]; + if ( geoJSON.type === "cube" ) { - if ( geoJSON.type === "cube" ) { + geometry = new THREE.CubeGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.CubeGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type === "plane" ) { - } else if ( geoJSON.type === "plane" ) { + geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type === "sphere" ) { - } else if ( geoJSON.type === "sphere" ) { + geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type === "cylinder" ) { - } else if ( geoJSON.type === "cylinder" ) { + geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type === "torus" ) { - } else if ( geoJSON.type === "torus" ) { + geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type === "icosahedron" ) { - } else if ( geoJSON.type === "icosahedron" ) { + geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions ); + geometry.name = geoID; + result.geometries[ geoID ] = geometry; - geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; + } else if ( geoJSON.type in this.geometryHandlers ) { - } else if ( geoJSON.type in this.geometryHandlerMap ) { + var loaderParameters = {}; - var loaderParameters = {}; + for ( var parType in geoJSON ) { - for ( var parType in geoJSON ) { + if ( parType !== "type" && parType !== "url" ) { - if ( parType !== "type" && parType !== "url" ) { + loaderParameters[ parType ] = geoJSON[ parType ]; - loaderParameters[ parType ] = geoJSON[ parType ]; + } } - } + var loader = this.geometryHandlers[ geoJSON.type ][ "loaderObject" ]; + loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ), loaderParameters ); - var loader = this.geometryHandlerMap[ geoJSON.type ][ "loaderObject" ]; - loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ), loaderParameters ); + } else if ( geoJSON.type === "embedded" ) { - } else if ( geoJSON.type === "embedded" ) { + var modelJson = data.embeds[ geoJSON.id ], + texture_path = ""; - var modelJson = data.embeds[ geoJSON.id ], - texture_path = ""; + // pass metadata along to jsonLoader so it knows the format version - // pass metadata along to jsonLoader so it knows the format version + modelJson.metadata = data.metadata; - modelJson.metadata = data.metadata; + if ( modelJson ) { - if ( modelJson ) { + var jsonLoader = this.geometryHandlers[ "ascii" ][ "loaderObject" ]; + var model = jsonLoader.parse( modelJson, texture_path ); + create_callback_embed( geoID )( model.geometry, model.materials ); - var jsonLoader = this.geometryHandlerMap[ "ascii" ][ "loaderObject" ]; - var model = jsonLoader.parse( modelJson, texture_path ); - create_callback_embed( geoID )( model.geometry, model.materials ); + } } } - } + // textures - // textures + // count how many textures will be loaded asynchronously - // count how many textures will be loaded asynchronously + var textureID, textureJSON; - var textureID, textureJSON; + for ( textureID in data.textures ) { - for ( textureID in data.textures ) { + textureJSON = data.textures[ textureID ]; - textureJSON = data.textures[ textureID ]; + if ( textureJSON.url instanceof Array ) { - if ( textureJSON.url instanceof Array ) { + counter_textures += textureJSON.url.length; - counter_textures += textureJSON.url.length; + for( var n = 0; n < textureJSON.url.length; n ++ ) { - for( var n = 0; n < textureJSON.url.length; n ++ ) { + scope.onLoadStart(); - scope.onLoadStart(); + } - } + } else { - } else { + counter_textures += 1; - counter_textures += 1; + scope.onLoadStart(); - scope.onLoadStart(); + } } - } + total_textures = counter_textures; - total_textures = counter_textures; + for ( textureID in data.textures ) { - for ( textureID in data.textures ) { + textureJSON = data.textures[ textureID ]; - textureJSON = data.textures[ textureID ]; + if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) { - if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) { + textureJSON.mapping = new THREE[ textureJSON.mapping ](); - textureJSON.mapping = new THREE[ textureJSON.mapping ](); + } - } + if ( textureJSON.url instanceof Array ) { - if ( textureJSON.url instanceof Array ) { + var count = textureJSON.url.length; + var url_array = []; - var count = textureJSON.url.length; - var url_array = []; + for( var i = 0; i < count; i ++ ) { - for( var i = 0; i < count; i ++ ) { + url_array[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType ); - url_array[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType ); + } - } + var isCompressed = /\.dds$/i.test( url_array[ 0 ] ); - var isCompressed = /\.dds$/i.test( url_array[ 0 ] ); + if ( isCompressed ) { - if ( isCompressed ) { + texture = THREE.ImageUtils.loadCompressedTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); - texture = THREE.ImageUtils.loadCompressedTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); + } else { - } else { + texture = THREE.ImageUtils.loadTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); - texture = THREE.ImageUtils.loadTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); + } - } + } else { - } else { + var isCompressed = /\.dds$/i.test( textureJSON.url ); + var fullUrl = get_url( textureJSON.url, data.urlBaseType ); + var textureCallback = generateTextureCallback( 1 ); - var isCompressed = /\.dds$/i.test( textureJSON.url ); - var fullUrl = get_url( textureJSON.url, data.urlBaseType ); - var textureCallback = generateTextureCallback( 1 ); + if ( isCompressed ) { - if ( isCompressed ) { + texture = THREE.ImageUtils.loadCompressedTexture( fullUrl, textureJSON.mapping, textureCallback ); - texture = THREE.ImageUtils.loadCompressedTexture( fullUrl, textureJSON.mapping, textureCallback ); + } else { - } else { + texture = THREE.ImageUtils.loadTexture( fullUrl, textureJSON.mapping, textureCallback ); - texture = THREE.ImageUtils.loadTexture( fullUrl, textureJSON.mapping, textureCallback ); + } - } + if ( THREE[ textureJSON.minFilter ] !== undefined ) + texture.minFilter = THREE[ textureJSON.minFilter ]; - if ( THREE[ textureJSON.minFilter ] !== undefined ) - texture.minFilter = THREE[ textureJSON.minFilter ]; + if ( THREE[ textureJSON.magFilter ] !== undefined ) + texture.magFilter = THREE[ textureJSON.magFilter ]; - if ( THREE[ textureJSON.magFilter ] !== undefined ) - texture.magFilter = THREE[ textureJSON.magFilter ]; + if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy; - if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy; + if ( textureJSON.repeat ) { - if ( textureJSON.repeat ) { + texture.repeat.set( textureJSON.repeat[ 0 ], textureJSON.repeat[ 1 ] ); - texture.repeat.set( textureJSON.repeat[ 0 ], textureJSON.repeat[ 1 ] ); + if ( textureJSON.repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping; + if ( textureJSON.repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping; - if ( textureJSON.repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping; - if ( textureJSON.repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping; + } - } + if ( textureJSON.offset ) { - if ( textureJSON.offset ) { + texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] ); - texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] ); + } - } + // handle wrap after repeat so that default repeat can be overriden - // handle wrap after repeat so that default repeat can be overriden + if ( textureJSON.wrap ) { - if ( textureJSON.wrap ) { + var wrapMap = { + "repeat": THREE.RepeatWrapping, + "mirror": THREE.MirroredRepeatWrapping + } - var wrapMap = { - "repeat" : THREE.RepeatWrapping, - "mirror" : THREE.MirroredRepeatWrapping - } + if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ]; + if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ]; - if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ]; - if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ]; + } } + result.textures[ textureID ] = texture; + } - result.textures[ textureID ] = texture; + // materials - } + var matID, matJSON; + var parID; - // materials + for ( matID in data.materials ) { - var matID, matJSON; - var parID; + matJSON = data.materials[ matID ]; - for ( matID in data.materials ) { + for ( parID in matJSON.parameters ) { - matJSON = data.materials[ matID ]; + if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" ) { - for ( parID in matJSON.parameters ) { + matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ]; - if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" ) { + } else if ( parID === "shading" ) { - matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ]; + matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading; - } else if ( parID === "shading" ) { + } else if ( parID === "side" ) { - matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading; + if ( matJSON.parameters[ parID ] == "double" ) { - } else if ( parID === "side" ) { + matJSON.parameters[ parID ] = THREE.DoubleSide; - if ( matJSON.parameters[ parID ] == "double" ) { + } else if ( matJSON.parameters[ parID ] == "back" ) { - matJSON.parameters[ parID ] = THREE.DoubleSide; + matJSON.parameters[ parID ] = THREE.BackSide; - } else if ( matJSON.parameters[ parID ] == "back" ) { + } else { - matJSON.parameters[ parID ] = THREE.BackSide; + matJSON.parameters[ parID ] = THREE.FrontSide; - } else { + } - matJSON.parameters[ parID ] = THREE.FrontSide; + } else if ( parID === "blending" ) { - } + matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.NormalBlending; + + } else if ( parID === "combine" ) { - } else if ( parID === "blending" ) { + matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation; - matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.NormalBlending; + } else if ( parID === "vertexColors" ) { - } else if ( parID === "combine" ) { + if ( matJSON.parameters[ parID ] == "face" ) { - matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation; + matJSON.parameters[ parID ] = THREE.FaceColors; - } else if ( parID === "vertexColors" ) { + // default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false - if ( matJSON.parameters[ parID ] == "face" ) { + } else if ( matJSON.parameters[ parID ] ) { - matJSON.parameters[ parID ] = THREE.FaceColors; + matJSON.parameters[ parID ] = THREE.VertexColors; - // default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false + } - } else if ( matJSON.parameters[ parID ] ) { + } else if ( parID === "wrapRGB" ) { - matJSON.parameters[ parID ] = THREE.VertexColors; + var v3 = matJSON.parameters[ parID ]; + matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] ); } - } else if ( parID === "wrapRGB" ) { + } + + if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) { - var v3 = matJSON.parameters[ parID ]; - matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] ); + matJSON.parameters.transparent = true; } - } + if ( matJSON.parameters.normalMap ) { - if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) { + var shader = THREE.ShaderLib[ "normalmap" ]; + var uniforms = THREE.UniformsUtils.clone( shader.uniforms ); - matJSON.parameters.transparent = true; + var diffuse = matJSON.parameters.color; + var specular = matJSON.parameters.specular; + var ambient = matJSON.parameters.ambient; + var shininess = matJSON.parameters.shininess; - } + uniforms[ "tNormal" ].value = result.textures[ matJSON.parameters.normalMap ]; - if ( matJSON.parameters.normalMap ) { + if ( matJSON.parameters.normalScale ) { - var shader = THREE.ShaderLib[ "normalmap" ]; - var uniforms = THREE.UniformsUtils.clone( shader.uniforms ); + uniforms[ "uNormalScale" ].value.set( matJSON.parameters.normalScale[ 0 ], matJSON.parameters.normalScale[ 1 ] ); - var diffuse = matJSON.parameters.color; - var specular = matJSON.parameters.specular; - var ambient = matJSON.parameters.ambient; - var shininess = matJSON.parameters.shininess; + } - uniforms[ "tNormal" ].value = result.textures[ matJSON.parameters.normalMap ]; + if ( matJSON.parameters.map ) { - if ( matJSON.parameters.normalScale ) { + uniforms[ "tDiffuse" ].value = matJSON.parameters.map; + uniforms[ "enableDiffuse" ].value = true; - uniforms[ "uNormalScale" ].value.set( matJSON.parameters.normalScale[ 0 ], matJSON.parameters.normalScale[ 1 ] ); + } - } + if ( matJSON.parameters.envMap ) { - if ( matJSON.parameters.map ) { + uniforms[ "tCube" ].value = matJSON.parameters.envMap; + uniforms[ "enableReflection" ].value = true; + uniforms[ "uReflectivity" ].value = matJSON.parameters.reflectivity; - uniforms[ "tDiffuse" ].value = matJSON.parameters.map; - uniforms[ "enableDiffuse" ].value = true; + } - } + if ( matJSON.parameters.lightMap ) { - if ( matJSON.parameters.envMap ) { + uniforms[ "tAO" ].value = matJSON.parameters.lightMap; + uniforms[ "enableAO" ].value = true; - uniforms[ "tCube" ].value = matJSON.parameters.envMap; - uniforms[ "enableReflection" ].value = true; - uniforms[ "uReflectivity" ].value = matJSON.parameters.reflectivity; + } - } + if ( matJSON.parameters.specularMap ) { - if ( matJSON.parameters.lightMap ) { + uniforms[ "tSpecular" ].value = result.textures[ matJSON.parameters.specularMap ]; + uniforms[ "enableSpecular" ].value = true; - uniforms[ "tAO" ].value = matJSON.parameters.lightMap; - uniforms[ "enableAO" ].value = true; + } - } + if ( matJSON.parameters.displacementMap ) { - if ( matJSON.parameters.specularMap ) { + uniforms[ "tDisplacement" ].value = result.textures[ matJSON.parameters.displacementMap ]; + uniforms[ "enableDisplacement" ].value = true; - uniforms[ "tSpecular" ].value = result.textures[ matJSON.parameters.specularMap ]; - uniforms[ "enableSpecular" ].value = true; + uniforms[ "uDisplacementBias" ].value = matJSON.parameters.displacementBias; + uniforms[ "uDisplacementScale" ].value = matJSON.parameters.displacementScale; - } + } - if ( matJSON.parameters.displacementMap ) { + uniforms[ "uDiffuseColor" ].value.setHex( diffuse ); + uniforms[ "uSpecularColor" ].value.setHex( specular ); + uniforms[ "uAmbientColor" ].value.setHex( ambient ); - uniforms[ "tDisplacement" ].value = result.textures[ matJSON.parameters.displacementMap ]; - uniforms[ "enableDisplacement" ].value = true; + uniforms[ "uShininess" ].value = shininess; - uniforms[ "uDisplacementBias" ].value = matJSON.parameters.displacementBias; - uniforms[ "uDisplacementScale" ].value = matJSON.parameters.displacementScale; + if ( matJSON.parameters.opacity ) { - } + uniforms[ "uOpacity" ].value = matJSON.parameters.opacity; - uniforms[ "uDiffuseColor" ].value.setHex( diffuse ); - uniforms[ "uSpecularColor" ].value.setHex( specular ); - uniforms[ "uAmbientColor" ].value.setHex( ambient ); + } - uniforms[ "uShininess" ].value = shininess; + var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true }; - if ( matJSON.parameters.opacity ) { + material = new THREE.ShaderMaterial( parameters ); - uniforms[ "uOpacity" ].value = matJSON.parameters.opacity; + } else { - } + material = new THREE[ matJSON.type ]( matJSON.parameters ); - var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true }; + } - material = new THREE.ShaderMaterial( parameters ); + material.name = matID; - } else { - - material = new THREE[ matJSON.type ]( matJSON.parameters ); + result.materials[ matID ] = material; } - material.name = matID; - - result.materials[ matID ] = material; + // second pass through all materials to initialize MeshFaceMaterials + // that could be referring to other materials out of order - } + for ( matID in data.materials ) { - // second pass through all materials to initialize MeshFaceMaterials - // that could be referring to other materials out of order + matJSON = data.materials[ matID ]; - for ( matID in data.materials ) { + if ( matJSON.parameters.materials ) { - matJSON = data.materials[ matID ]; + var materialArray = []; - if ( matJSON.parameters.materials ) { + for ( var i = 0; i < matJSON.parameters.materials.length; i ++ ) { - var materialArray = []; + var label = matJSON.parameters.materials[ i ]; + materialArray.push( result.materials[ label ] ); - for ( var i = 0; i < matJSON.parameters.materials.length; i ++ ) { + } - var label = matJSON.parameters.materials[ i ]; - materialArray.push( result.materials[ label ] ); + result.materials[ matID ].materials = materialArray; } - result.materials[ matID ].materials = materialArray; - } - } + // objects ( synchronous init of procedural primitives ) - // objects ( synchronous init of procedural primitives ) + handle_objects(); - handle_objects(); + // defaults - // defaults + if ( result.cameras && data.defaults.camera ) { - if ( result.cameras && data.defaults.camera ) { + result.currentCamera = result.cameras[ data.defaults.camera ]; - result.currentCamera = result.cameras[ data.defaults.camera ]; + } - } + if ( result.fogs && data.defaults.fog ) { - if ( result.fogs && data.defaults.fog ) { + result.scene.fog = result.fogs[ data.defaults.fog ]; - result.scene.fog = result.fogs[ data.defaults.fog ]; + } - } + // synchronous callback - // synchronous callback + scope.callbackSync( result ); - scope.callbackSync( result ); + // just in case there are no async elements - // just in case there are no async elements + async_callback_gate(); - async_callback_gate(); + } + +} -}; /** * @author mrdoob / http://mrdoob.com/ */ -THREE.TextureLoader = function () { +THREE.TextureLoader = function ( manager ) { - this.crossOrigin = null; + this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; }; @@ -11675,39 +12942,35 @@ THREE.TextureLoader.prototype = { constructor: THREE.TextureLoader, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - - load: function ( url ) { + load: function ( url, onLoad, onProgress, onError ) { var scope = this; - var image = new Image(); - - image.addEventListener( 'load', function () { + var loader = new THREE.ImageLoader( scope.manager ); + loader.setCrossOrigin( this.crossOrigin ); + loader.load( url, function ( image ) { var texture = new THREE.Texture( image ); texture.needsUpdate = true; - scope.dispatchEvent( { type: 'load', content: texture } ); + if ( onLoad !== undefined ) { - }, false ); + onLoad( texture ); - image.addEventListener( 'error', function () { + } - scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); + } ); - }, false ); + }, - if ( scope.crossOrigin ) image.crossOrigin = scope.crossOrigin; + setCrossOrigin: function ( value ) { - image.src = url; + this.crossOrigin = value; } }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -11716,6 +12979,7 @@ THREE.TextureLoader.prototype = { THREE.Material = function () { this.id = THREE.MaterialIdCount ++; + this.uuid = THREE.Math.generateUUID(); this.name = ''; @@ -11739,7 +13003,7 @@ THREE.Material = function () { this.alphaTest = 0; - this.overdraw = false; // Boolean for fixing antialiasing gaps in CanvasRenderer + this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer this.visible = true; @@ -11751,11 +13015,6 @@ THREE.Material.prototype = { constructor: THREE.Material, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - setValues: function ( values ) { if ( values === undefined ) return; @@ -11783,6 +13042,11 @@ THREE.Material.prototype = { currentValue.copy( newValue ); + } else if ( key == 'overdraw') { + + // ensure overdraw is backwards-compatable with legacy boolean type + this[ key ] = Number(newValue); + } else { this[ key ] = newValue; @@ -11837,7 +13101,10 @@ THREE.Material.prototype = { }; +THREE.EventDispatcher.prototype.apply( THREE.Material.prototype ); + THREE.MaterialIdCount = 0; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -11899,6 +13166,7 @@ THREE.LineBasicMaterial.prototype.clone = function () { return material; }; + /** * @author alteredq / http://alteredqualia.com/ * @@ -11965,6 +13233,7 @@ THREE.LineDashedMaterial.prototype.clone = function () { return material; }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12073,6 +13342,7 @@ THREE.MeshBasicMaterial.prototype.clone = function () { return material; }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12197,160 +13467,162 @@ THREE.MeshLambertMaterial.prototype.clone = function () { return material; }; -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: , - * ambient: , - * emissive: , - * specular: , - * shininess: , - * opacity: , - * - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalScale: , - * - * specularMap: new THREE.Texture( ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: , - * refractionRatio: , - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: , - * depthWrite: , - * - * wireframe: , - * wireframeLinewidth: , - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: , - * morphTargets: , - * morphNormals: , - * - * fog: - * } - */ - -THREE.MeshPhongMaterial = function ( parameters ) { - - THREE.Material.call( this ); - this.color = new THREE.Color( 0xffffff ); // diffuse - this.ambient = new THREE.Color( 0xffffff ); - this.emissive = new THREE.Color( 0x000000 ); - this.specular = new THREE.Color( 0x111111 ); - this.shininess = 30; - - this.metal = false; - this.perPixel = true; - - this.wrapAround = false; - this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); - - this.map = null; - - this.lightMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new THREE.Vector2( 1, 1 ); - - this.specularMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -}; - -THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshPhongMaterial.prototype.clone = function () { - - var material = new THREE.MeshPhongMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.ambient.copy( this.ambient ); - material.emissive.copy( this.emissive ); - material.specular.copy( this.specular ); - material.shininess = this.shininess; - - material.metal = this.metal; - material.perPixel = this.perPixel; - - material.wrapAround = this.wrapAround; - material.wrapRGB.copy( this.wrapRGB ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.bumpMap = this.bumpMap; - material.bumpScale = this.bumpScale; - - material.normalMap = this.normalMap; - material.normalScale.copy( this.normalScale ); - - material.specularMap = this.specularMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; +/** + * @author mrdoob / http://mrdoob.com/ + * @author alteredq / http://alteredqualia.com/ + * + * parameters = { + * color: , + * ambient: , + * emissive: , + * specular: , + * shininess: , + * opacity: , + * + * map: new THREE.Texture( ), + * + * lightMap: new THREE.Texture( ), + * + * bumpMap: new THREE.Texture( ), + * bumpScale: , + * + * normalMap: new THREE.Texture( ), + * normalScale: , + * + * specularMap: new THREE.Texture( ), + * + * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), + * combine: THREE.Multiply, + * reflectivity: , + * refractionRatio: , + * + * shading: THREE.SmoothShading, + * blending: THREE.NormalBlending, + * depthTest: , + * depthWrite: , + * + * wireframe: , + * wireframeLinewidth: , + * + * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, + * + * skinning: , + * morphTargets: , + * morphNormals: , + * + * fog: + * } + */ + +THREE.MeshPhongMaterial = function ( parameters ) { + + THREE.Material.call( this ); + + this.color = new THREE.Color( 0xffffff ); // diffuse + this.ambient = new THREE.Color( 0xffffff ); + this.emissive = new THREE.Color( 0x000000 ); + this.specular = new THREE.Color( 0x111111 ); + this.shininess = 30; + + this.metal = false; + this.perPixel = true; + + this.wrapAround = false; + this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); + + this.map = null; + + this.lightMap = null; + + this.bumpMap = null; + this.bumpScale = 1; + + this.normalMap = null; + this.normalScale = new THREE.Vector2( 1, 1 ); + + this.specularMap = null; + + this.envMap = null; + this.combine = THREE.MultiplyOperation; + this.reflectivity = 1; + this.refractionRatio = 0.98; + + this.fog = true; + + this.shading = THREE.SmoothShading; + + this.wireframe = false; + this.wireframeLinewidth = 1; + this.wireframeLinecap = 'round'; + this.wireframeLinejoin = 'round'; + + this.vertexColors = THREE.NoColors; + + this.skinning = false; + this.morphTargets = false; + this.morphNormals = false; + + this.setValues( parameters ); + +}; + +THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); + +THREE.MeshPhongMaterial.prototype.clone = function () { + + var material = new THREE.MeshPhongMaterial(); + + THREE.Material.prototype.clone.call( this, material ); + + material.color.copy( this.color ); + material.ambient.copy( this.ambient ); + material.emissive.copy( this.emissive ); + material.specular.copy( this.specular ); + material.shininess = this.shininess; + + material.metal = this.metal; + material.perPixel = this.perPixel; + + material.wrapAround = this.wrapAround; + material.wrapRGB.copy( this.wrapRGB ); + + material.map = this.map; + + material.lightMap = this.lightMap; + + material.bumpMap = this.bumpMap; + material.bumpScale = this.bumpScale; + + material.normalMap = this.normalMap; + material.normalScale.copy( this.normalScale ); + + material.specularMap = this.specularMap; + + material.envMap = this.envMap; + material.combine = this.combine; + material.reflectivity = this.reflectivity; + material.refractionRatio = this.refractionRatio; + + material.fog = this.fog; + + material.shading = this.shading; + + material.wireframe = this.wireframe; + material.wireframeLinewidth = this.wireframeLinewidth; + material.wireframeLinecap = this.wireframeLinecap; + material.wireframeLinejoin = this.wireframeLinejoin; + + material.vertexColors = this.vertexColors; + + material.skinning = this.skinning; + material.morphTargets = this.morphTargets; + material.morphNormals = this.morphNormals; + + return material; + +}; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12392,6 +13664,7 @@ THREE.MeshDepthMaterial.prototype.clone = function () { return material; }; + /** * @author mrdoob / http://mrdoob.com/ * @@ -12439,6 +13712,7 @@ THREE.MeshNormalMaterial.prototype.clone = function () { return material; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -12454,6 +13728,7 @@ THREE.MeshFaceMaterial.prototype.clone = function () { return new THREE.MeshFaceMaterial( this.materials.slice( 0 ) ); }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12516,6 +13791,7 @@ THREE.ParticleBasicMaterial.prototype.clone = function () { return material; }; + /** * @author mrdoob / http://mrdoob.com/ * @@ -12552,6 +13828,7 @@ THREE.ParticleCanvasMaterial.prototype.clone = function () { return material; }; + /** * @author alteredq / http://alteredqualia.com/ * @@ -12650,6 +13927,7 @@ THREE.ShaderMaterial.prototype.clone = function () { return material; }; + /** * @author alteredq / http://alteredqualia.com/ * @@ -12745,6 +14023,7 @@ THREE.SpriteAlignment.centerRight = new THREE.Vector2( -1, 0 ); THREE.SpriteAlignment.bottomLeft = new THREE.Vector2( 1, 1 ); THREE.SpriteAlignment.bottomCenter = new THREE.Vector2( 0, 1 ); THREE.SpriteAlignment.bottomRight = new THREE.Vector2( -1, 1 ); + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12754,6 +14033,7 @@ THREE.SpriteAlignment.bottomRight = new THREE.Vector2( -1, 1 ); THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { this.id = THREE.TextureIdCount ++; + this.uuid = THREE.Math.generateUUID(); this.name = ''; @@ -12790,11 +14070,6 @@ THREE.Texture.prototype = { constructor: THREE.Texture, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - clone: function ( texture ) { if ( texture === undefined ) texture = new THREE.Texture(); @@ -12835,7 +14110,10 @@ THREE.Texture.prototype = { }; +THREE.EventDispatcher.prototype.apply( THREE.Texture.prototype ); + THREE.TextureIdCount = 0; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -12862,6 +14140,7 @@ THREE.CompressedTexture.prototype.clone = function () { return texture; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -12885,6 +14164,7 @@ THREE.DataTexture.prototype.clone = function () { return texture; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -12908,6 +14188,7 @@ THREE.Particle.prototype.clone = function ( object ) { return object; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -12916,23 +14197,10 @@ THREE.ParticleSystem = function ( geometry, material ) { THREE.Object3D.call( this ); - this.geometry = geometry; - this.material = ( material !== undefined ) ? material : new THREE.ParticleBasicMaterial( { color: Math.random() * 0xffffff } ); + this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); + this.material = material !== undefined ? material : new THREE.ParticleBasicMaterial( { color: Math.random() * 0xffffff } ); this.sortParticles = false; - - if ( this.geometry ) { - - // calc bound radius - - if( this.geometry.boundingSphere === null ) { - - this.geometry.computeBoundingSphere(); - - } - - } - this.frustumCulled = false; }; @@ -12942,6 +14210,7 @@ THREE.ParticleSystem.prototype = Object.create( THREE.Object3D.prototype ); THREE.ParticleSystem.prototype.clone = function ( object ) { if ( object === undefined ) object = new THREE.ParticleSystem( this.geometry, this.material ); + object.sortParticles = this.sortParticles; THREE.Object3D.prototype.clone.call( this, object ); @@ -12949,6 +14218,7 @@ THREE.ParticleSystem.prototype.clone = function ( object ) { return object; }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -12957,19 +14227,10 @@ THREE.Line = function ( geometry, material, type ) { THREE.Object3D.call( this ); - this.geometry = geometry; - this.material = ( material !== undefined ) ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } ); - this.type = ( type !== undefined ) ? type : THREE.LineStrip; - - if ( this.geometry ) { - - if ( ! this.geometry.boundingSphere ) { - - this.geometry.computeBoundingSphere(); - - } + this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); + this.material = material !== undefined ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } ); - } + this.type = ( type !== undefined ) ? type : THREE.LineStrip; }; @@ -12987,6 +14248,7 @@ THREE.Line.prototype.clone = function ( object ) { return object; }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -12998,48 +14260,15 @@ THREE.Mesh = function ( geometry, material ) { THREE.Object3D.call( this ); - this.geometry = null; - this.material = null; + this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); + this.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ); - this.setGeometry( geometry ); - this.setMaterial( material ); + this.updateMorphTargets(); }; THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Mesh.prototype.setGeometry = function ( geometry ) { - - if ( geometry !== undefined ) { - - this.geometry = geometry; - - if ( this.geometry.boundingSphere === null ) { - - this.geometry.computeBoundingSphere(); - - } - - this.updateMorphTargets(); - - } - -}; - -THREE.Mesh.prototype.setMaterial = function ( material ) { - - if ( material !== undefined ) { - - this.material = material; - - } else { - - this.material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } ); - - } - -}; - THREE.Mesh.prototype.updateMorphTargets = function () { if ( this.geometry.morphTargets.length > 0 ) { @@ -13083,6 +14312,7 @@ THREE.Mesh.prototype.clone = function ( object ) { return object; }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -13140,6 +14370,7 @@ THREE.Bone.prototype.update = function ( parentSkinMatrix, forceUpdate ) { }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -13177,8 +14408,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { bone.name = gbone.name; bone.position.set( p[0], p[1], p[2] ); bone.quaternion.set( q[0], q[1], q[2], q[3] ); - bone.useQuaternion = true; - + if ( s !== undefined ) { bone.scale.set( s[0], s[1], s[2] ); @@ -13270,119 +14500,140 @@ THREE.SkinnedMesh.prototype.addBone = function( bone ) { }; -THREE.SkinnedMesh.prototype.updateMatrixWorld = function ( force ) { +THREE.SkinnedMesh.prototype.updateMatrixWorld = function () { - this.matrixAutoUpdate && this.updateMatrix(); + var offsetMatrix = new THREE.Matrix4(); - // update matrixWorld + return function ( force ) { - if ( this.matrixWorldNeedsUpdate || force ) { + this.matrixAutoUpdate && this.updateMatrix(); - if ( this.parent ) { + // update matrixWorld - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); + if ( this.matrixWorldNeedsUpdate || force ) { - } else { + if ( this.parent ) { - this.matrixWorld.copy( this.matrix ); + this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - } + } else { - this.matrixWorldNeedsUpdate = false; + this.matrixWorld.copy( this.matrix ); - force = true; + } - } + this.matrixWorldNeedsUpdate = false; - // update children + force = true; - for ( var i = 0, l = this.children.length; i < l; i ++ ) { + } - var child = this.children[ i ]; + // update children - if ( child instanceof THREE.Bone ) { + for ( var i = 0, l = this.children.length; i < l; i ++ ) { - child.update( this.identityMatrix, false ); + var child = this.children[ i ]; - } else { + if ( child instanceof THREE.Bone ) { + + child.update( this.identityMatrix, false ); - child.updateMatrixWorld( true ); + } else { + + child.updateMatrixWorld( true ); + + } } - } + // make a snapshot of the bones' rest position - // make a snapshot of the bones' rest position + if ( this.boneInverses == undefined ) { - if ( this.boneInverses == undefined ) { + this.boneInverses = []; - this.boneInverses = []; + for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { + var inverse = new THREE.Matrix4(); - var inverse = new THREE.Matrix4(); + inverse.getInverse( this.bones[ b ].skinMatrix ); - inverse.getInverse( this.bones[ b ].skinMatrix ); + this.boneInverses.push( inverse ); - this.boneInverses.push( inverse ); + } } - } - - // flatten bone matrices to array + // flatten bone matrices to array - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { + for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - // compute the offset between the current and the original transform; + // compute the offset between the current and the original transform; - //TODO: we could get rid of this multiplication step if the skinMatrix - // was already representing the offset; however, this requires some - // major changes to the animation system + // TODO: we could get rid of this multiplication step if the skinMatrix + // was already representing the offset; however, this requires some + // major changes to the animation system - THREE.SkinnedMesh.offsetMatrix.multiplyMatrices( this.bones[ b ].skinMatrix, this.boneInverses[ b ] ); + offsetMatrix.multiplyMatrices( this.bones[ b ].skinMatrix, this.boneInverses[ b ] ); + offsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); - THREE.SkinnedMesh.offsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); + } - } + if ( this.useVertexTexture ) { - if ( this.useVertexTexture ) { + this.boneTexture.needsUpdate = true; - this.boneTexture.needsUpdate = true; + } - } + }; -}; +}(); THREE.SkinnedMesh.prototype.pose = function () { this.updateMatrixWorld( true ); - for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) { + this.normalizeSkinWeights(); - // normalize weights +}; - var sw = this.geometry.skinWeights[ i ]; +THREE.SkinnedMesh.prototype.normalizeSkinWeights = function () { - var scale = 1.0 / sw.lengthManhattan(); + if ( this.geometry instanceof THREE.Geometry ) { - if ( scale !== Infinity ) { + for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) { - sw.multiplyScalar( scale ); + var sw = this.geometry.skinWeights[ i ]; - } else { + var scale = 1.0 / sw.lengthManhattan(); + + if ( scale !== Infinity ) { + + sw.multiplyScalar( scale ); + + } else { - sw.set( 1 ); // this will be normalized by the shader anyway + sw.set( 1 ); // this will be normalized by the shader anyway + + } } + } else { + + // skinning weights assumed to be normalized for THREE.BufferGeometry + } }; THREE.SkinnedMesh.prototype.clone = function ( object ) { - if ( object === undefined ) object = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture ); + if ( object === undefined ) { + + object = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture ); + + } THREE.Mesh.prototype.clone.call( this, object ); @@ -13390,7 +14641,6 @@ THREE.SkinnedMesh.prototype.clone = function ( object ) { }; -THREE.SkinnedMesh.offsetMatrix = new THREE.Matrix4(); /** * @author alteredq / http://alteredqualia.com/ */ @@ -13587,6 +14837,7 @@ THREE.MorphAnimMesh.prototype.clone = function ( object ) { return object; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -13611,6 +14862,7 @@ THREE.Ribbon.prototype.clone = function ( object ) { return object; }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -13713,6 +14965,7 @@ THREE.LOD.prototype.clone = function () { // TODO }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -13737,9 +14990,9 @@ THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype ); THREE.Sprite.prototype.updateMatrix = function () { - this.rotation3d.set( 0, 0, this.rotation ); - this.quaternion.setFromEuler( this.rotation3d, this.eulerOrder ); - this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale ); + this.rotation3d.set( 0, 0, this.rotation, this.rotation3d.order ); + this.quaternion.setFromEuler( this.rotation3d ); + this.matrix.compose( this.position, this.quaternion, this.scale ); this.matrixWorldNeedsUpdate = true; @@ -13755,6 +15008,7 @@ THREE.Sprite.prototype.clone = function ( object ) { }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -13866,6 +15120,23 @@ THREE.Scene.prototype.__removeObject = function ( object ) { } }; + +THREE.Scene.prototype.clone = function ( object ) { + + if ( object === undefined ) object = new THREE.Scene(); + + THREE.Object3D.prototype.clone.call(this, object); + + if ( this.fog !== null ) object.fog = this.fog.clone(); + if ( this.overrideMaterial !== null ) object.overrideMaterial = this.overrideMaterial.clone(); + + object.autoUpdate = this.autoUpdate; + object.matrixAutoUpdate = this.matrixAutoUpdate; + + return object; + +}; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -13887,6 +15158,7 @@ THREE.Fog.prototype.clone = function () { return new THREE.Fog( this.color.getHex(), this.near, this.far ); }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -13895,6 +15167,7 @@ THREE.Fog.prototype.clone = function () { THREE.FogExp2 = function ( hex, density ) { this.name = ''; + this.color = new THREE.Color( hex ); this.density = ( density !== undefined ) ? density : 0.00025; @@ -13905,6 +15178,7 @@ THREE.FogExp2.prototype.clone = function () { return new THREE.FogExp2( this.color.getHex(), this.density ); }; + /** * @author mrdoob / http://mrdoob.com/ */ @@ -13941,6 +15215,8 @@ THREE.CanvasRenderer = function ( parameters ) { _contextDashSize = null, _contextGapSize = 0, + _camera, + _v1, _v2, _v3, _v4, _v5 = new THREE.RenderableVertex(), _v6 = new THREE.RenderableVertex(), @@ -14171,6 +15447,7 @@ THREE.CanvasRenderer = function ( parameters ) { _renderData = _projector.projectScene( scene, camera, this.sortObjects, this.sortElements ); _elements = _renderData.elements; _lights = _renderData.lights; + _camera = camera; /* DEBUG setFillStyle( 'rgba( 0, 255, 255, 0.5 )' ); @@ -14226,11 +15503,11 @@ THREE.CanvasRenderer = function ( parameters ) { _v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf; _v3.positionScreen.x *= _canvasWidthHalf; _v3.positionScreen.y *= _canvasHeightHalf; - if ( material.overdraw === true ) { + if ( material.overdraw > 0 ) { - expand( _v1.positionScreen, _v2.positionScreen ); - expand( _v2.positionScreen, _v3.positionScreen ); - expand( _v3.positionScreen, _v1.positionScreen ); + expand( _v1.positionScreen, _v2.positionScreen, material.overdraw ); + expand( _v2.positionScreen, _v3.positionScreen, material.overdraw ); + expand( _v3.positionScreen, _v1.positionScreen, material.overdraw ); } @@ -14263,14 +15540,14 @@ THREE.CanvasRenderer = function ( parameters ) { _v5.positionScreen.copy( _v2.positionScreen ); _v6.positionScreen.copy( _v4.positionScreen ); - if ( material.overdraw === true ) { + if ( material.overdraw > 0 ) { - expand( _v1.positionScreen, _v2.positionScreen ); - expand( _v2.positionScreen, _v4.positionScreen ); - expand( _v4.positionScreen, _v1.positionScreen ); + expand( _v1.positionScreen, _v2.positionScreen, material.overdraw ); + expand( _v2.positionScreen, _v4.positionScreen, material.overdraw ); + expand( _v4.positionScreen, _v1.positionScreen, material.overdraw ); - expand( _v3.positionScreen, _v5.positionScreen ); - expand( _v3.positionScreen, _v6.positionScreen ); + expand( _v3.positionScreen, _v5.positionScreen, material.overdraw ); + expand( _v3.positionScreen, _v6.positionScreen, material.overdraw ); } @@ -14307,171 +15584,137 @@ THREE.CanvasRenderer = function ( parameters ) { _context.setTransform( 1, 0, 0, 1, 0, 0 ); - // + }; - function calculateLights() { + // - _ambientLight.setRGB( 0, 0, 0 ); - _directionalLights.setRGB( 0, 0, 0 ); - _pointLights.setRGB( 0, 0, 0 ); + function calculateLights() { - for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { + _ambientLight.setRGB( 0, 0, 0 ); + _directionalLights.setRGB( 0, 0, 0 ); + _pointLights.setRGB( 0, 0, 0 ); - var light = _lights[ l ]; - var lightColor = light.color; + for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { - if ( light instanceof THREE.AmbientLight ) { + var light = _lights[ l ]; + var lightColor = light.color; - _ambientLight.add( lightColor ); + if ( light instanceof THREE.AmbientLight ) { - } else if ( light instanceof THREE.DirectionalLight ) { + _ambientLight.add( lightColor ); - // for particles + } else if ( light instanceof THREE.DirectionalLight ) { - _directionalLights.add( lightColor ); + // for particles - } else if ( light instanceof THREE.PointLight ) { + _directionalLights.add( lightColor ); - // for particles + } else if ( light instanceof THREE.PointLight ) { - _pointLights.add( lightColor ); + // for particles - } + _pointLights.add( lightColor ); } } - function calculateLight( position, normal, color ) { + } - for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { + function calculateLight( position, normal, color ) { - var light = _lights[ l ]; + for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { - _lightColor.copy( light.color ); + var light = _lights[ l ]; - if ( light instanceof THREE.DirectionalLight ) { + _lightColor.copy( light.color ); - var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ).normalize(); + if ( light instanceof THREE.DirectionalLight ) { - var amount = normal.dot( lightPosition ); + var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ).normalize(); - if ( amount <= 0 ) continue; + var amount = normal.dot( lightPosition ); - amount *= light.intensity; + if ( amount <= 0 ) continue; - color.add( _lightColor.multiplyScalar( amount ) ); + amount *= light.intensity; - } else if ( light instanceof THREE.PointLight ) { + color.add( _lightColor.multiplyScalar( amount ) ); - var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ); + } else if ( light instanceof THREE.PointLight ) { - var amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() ); + var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ); - if ( amount <= 0 ) continue; + var amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() ); - amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 ); + if ( amount <= 0 ) continue; - if ( amount == 0 ) continue; + amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 ); - amount *= light.intensity; + if ( amount == 0 ) continue; - color.add( _lightColor.multiplyScalar( amount ) ); + amount *= light.intensity; - } + color.add( _lightColor.multiplyScalar( amount ) ); } } - function renderParticle( v1, element, material ) { - - setOpacity( material.opacity ); - setBlending( material.blending ); - - var width, height, scaleX, scaleY, - bitmap, bitmapWidth, bitmapHeight; - - if ( material instanceof THREE.ParticleBasicMaterial ) { - - if ( material.map === null ) { - - scaleX = element.object.scale.x; - scaleY = element.object.scale.y; - - // TODO: Be able to disable this - - scaleX *= element.scale.x * _canvasWidthHalf; - scaleY *= element.scale.y * _canvasHeightHalf; - - _elemBox.min.set( v1.x - scaleX, v1.y - scaleY ); - _elemBox.max.set( v1.x + scaleX, v1.y + scaleY ); - - if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { + } - _elemBox.makeEmpty(); - return; + function renderParticle( v1, element, material ) { - } + setOpacity( material.opacity ); + setBlending( material.blending ); - setFillStyle( material.color.getStyle() ); + var width, height, scaleX, scaleY, + bitmap, bitmapWidth, bitmapHeight; - _context.save(); - _context.translate( v1.x, v1.y ); - _context.rotate( - element.rotation ); - _context.scale( scaleX, scaleY ); - _context.fillRect( -1, -1, 2, 2 ); - _context.restore(); + if ( material instanceof THREE.ParticleBasicMaterial ) { - } else { + if ( material.map === null ) { - bitmap = material.map.image; - bitmapWidth = bitmap.width >> 1; - bitmapHeight = bitmap.height >> 1; + scaleX = element.object.scale.x; + scaleY = element.object.scale.y; - scaleX = element.scale.x * _canvasWidthHalf; - scaleY = element.scale.y * _canvasHeightHalf; + // TODO: Be able to disable this - width = scaleX * bitmapWidth; - height = scaleY * bitmapHeight; + scaleX *= element.scale.x * _canvasWidthHalf; + scaleY *= element.scale.y * _canvasHeightHalf; - // TODO: Rotations break this... + _elemBox.min.set( v1.x - scaleX, v1.y - scaleY ); + _elemBox.max.set( v1.x + scaleX, v1.y + scaleY ); - _elemBox.min.set( v1.x - width, v1.y - height ); - _elemBox.max.set( v1.x + width, v1.y + height ); + if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { - if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { + _elemBox.makeEmpty(); + return; - _elemBox.makeEmpty(); - return; + } - } + setFillStyle( material.color.getStyle() ); - _context.save(); - _context.translate( v1.x, v1.y ); - _context.rotate( - element.rotation ); - _context.scale( scaleX, - scaleY ); + _context.save(); + _context.translate( v1.x, v1.y ); + _context.rotate( - element.rotation ); + _context.scale( scaleX, scaleY ); + _context.fillRect( -1, -1, 2, 2 ); + _context.restore(); - _context.translate( - bitmapWidth, - bitmapHeight ); - _context.drawImage( bitmap, 0, 0 ); - _context.restore(); + } else { - } + bitmap = material.map.image; + bitmapWidth = bitmap.width >> 1; + bitmapHeight = bitmap.height >> 1; - /* DEBUG - setStrokeStyle( 'rgb(255,255,0)' ); - _context.beginPath(); - _context.moveTo( v1.x - 10, v1.y ); - _context.lineTo( v1.x + 10, v1.y ); - _context.moveTo( v1.x, v1.y - 10 ); - _context.lineTo( v1.x, v1.y + 10 ); - _context.stroke(); - */ + scaleX = element.scale.x * _canvasWidthHalf; + scaleY = element.scale.y * _canvasHeightHalf; - } else if ( material instanceof THREE.ParticleCanvasMaterial ) { + width = scaleX * bitmapWidth; + height = scaleY * bitmapHeight; - width = element.scale.x * _canvasWidthHalf; - height = element.scale.y * _canvasHeightHalf; + // TODO: Rotations break this... _elemBox.min.set( v1.x - width, v1.y - height ); _elemBox.max.set( v1.x + width, v1.y + height ); @@ -14483,347 +15726,365 @@ THREE.CanvasRenderer = function ( parameters ) { } - setStrokeStyle( material.color.getStyle() ); - setFillStyle( material.color.getStyle() ); - _context.save(); _context.translate( v1.x, v1.y ); _context.rotate( - element.rotation ); - _context.scale( width, height ); - - material.program( _context ); + _context.scale( scaleX, - scaleY ); + _context.translate( - bitmapWidth, - bitmapHeight ); + _context.drawImage( bitmap, 0, 0 ); _context.restore(); } - } + /* DEBUG + setStrokeStyle( 'rgb(255,255,0)' ); + _context.beginPath(); + _context.moveTo( v1.x - 10, v1.y ); + _context.lineTo( v1.x + 10, v1.y ); + _context.moveTo( v1.x, v1.y - 10 ); + _context.lineTo( v1.x, v1.y + 10 ); + _context.stroke(); + */ - function renderLine( v1, v2, element, material ) { + } else if ( material instanceof THREE.ParticleCanvasMaterial ) { - setOpacity( material.opacity ); - setBlending( material.blending ); + width = element.scale.x * _canvasWidthHalf; + height = element.scale.y * _canvasHeightHalf; - _context.beginPath(); - _context.moveTo( v1.positionScreen.x, v1.positionScreen.y ); - _context.lineTo( v2.positionScreen.x, v2.positionScreen.y ); + _elemBox.min.set( v1.x - width, v1.y - height ); + _elemBox.max.set( v1.x + width, v1.y + height ); - if ( material instanceof THREE.LineBasicMaterial ) { + if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { - setLineWidth( material.linewidth ); - setLineCap( material.linecap ); - setLineJoin( material.linejoin ); + _elemBox.makeEmpty(); + return; - if ( material.vertexColors !== THREE.VertexColors ) { + } - setStrokeStyle( material.color.getStyle() ); + setStrokeStyle( material.color.getStyle() ); + setFillStyle( material.color.getStyle() ); - } else { + _context.save(); + _context.translate( v1.x, v1.y ); + _context.rotate( - element.rotation ); + _context.scale( width, height ); - var colorStyle1 = element.vertexColors[0].getStyle(); - var colorStyle2 = element.vertexColors[1].getStyle(); + material.program( _context ); - if ( colorStyle1 === colorStyle2 ) { + _context.restore(); - setStrokeStyle( colorStyle1 ); + } - } else { + } - try { + function renderLine( v1, v2, element, material ) { - var grad = _context.createLinearGradient( - v1.positionScreen.x, - v1.positionScreen.y, - v2.positionScreen.x, - v2.positionScreen.y - ); - grad.addColorStop( 0, colorStyle1 ); - grad.addColorStop( 1, colorStyle2 ); + setOpacity( material.opacity ); + setBlending( material.blending ); - } catch ( exception ) { + _context.beginPath(); + _context.moveTo( v1.positionScreen.x, v1.positionScreen.y ); + _context.lineTo( v2.positionScreen.x, v2.positionScreen.y ); - grad = colorStyle1; + if ( material instanceof THREE.LineBasicMaterial ) { - } + setLineWidth( material.linewidth ); + setLineCap( material.linecap ); + setLineJoin( material.linejoin ); - setStrokeStyle( grad ); + if ( material.vertexColors !== THREE.VertexColors ) { - } + setStrokeStyle( material.color.getStyle() ); - } + } else { - _context.stroke(); - _elemBox.expandByScalar( material.linewidth * 2 ); + var colorStyle1 = element.vertexColors[0].getStyle(); + var colorStyle2 = element.vertexColors[1].getStyle(); - } else if ( material instanceof THREE.LineDashedMaterial ) { + if ( colorStyle1 === colorStyle2 ) { - setLineWidth( material.linewidth ); - setLineCap( material.linecap ); - setLineJoin( material.linejoin ); - setStrokeStyle( material.color.getStyle() ); - setDashAndGap( material.dashSize, material.gapSize ); + setStrokeStyle( colorStyle1 ); - _context.stroke(); + } else { - _elemBox.expandByScalar( material.linewidth * 2 ); + try { - setDashAndGap( null, null ); + var grad = _context.createLinearGradient( + v1.positionScreen.x, + v1.positionScreen.y, + v2.positionScreen.x, + v2.positionScreen.y + ); + grad.addColorStop( 0, colorStyle1 ); + grad.addColorStop( 1, colorStyle2 ); - } + } catch ( exception ) { - } + grad = colorStyle1; - function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) { + } - _this.info.render.vertices += 3; - _this.info.render.faces ++; + setStrokeStyle( grad ); - setOpacity( material.opacity ); - setBlending( material.blending ); + } - _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y; - _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y; - _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y; + } - drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y ); + _context.stroke(); + _elemBox.expandByScalar( material.linewidth * 2 ); - if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) { + } else if ( material instanceof THREE.LineDashedMaterial ) { - _diffuseColor.copy( material.color ); - _emissiveColor.copy( material.emissive ); + setLineWidth( material.linewidth ); + setLineCap( material.linecap ); + setLineJoin( material.linejoin ); + setStrokeStyle( material.color.getStyle() ); + setDashAndGap( material.dashSize, material.gapSize ); - if ( material.vertexColors === THREE.FaceColors ) { + _context.stroke(); - _diffuseColor.multiply( element.color ); + _elemBox.expandByScalar( material.linewidth * 2 ); - } + setDashAndGap( null, null ); - if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) { + } - _color1.copy( _ambientLight ); - _color2.copy( _ambientLight ); - _color3.copy( _ambientLight ); + } - calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 ); - calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 ); - calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 ); + function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) { - _color1.multiply( _diffuseColor ).add( _emissiveColor ); - _color2.multiply( _diffuseColor ).add( _emissiveColor ); - _color3.multiply( _diffuseColor ).add( _emissiveColor ); - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); + _this.info.render.vertices += 3; + _this.info.render.faces ++; - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + setOpacity( material.opacity ); + setBlending( material.blending ); - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); + _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y; + _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y; + _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y; - } else { + drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y ); - _color.copy( _ambientLight ); + if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) { - calculateLight( element.centroidModel, element.normalModel, _color ); + _diffuseColor.copy( material.color ); + _emissiveColor.copy( material.emissive ); - _color.multiply( _diffuseColor ).add( _emissiveColor ); + if ( material.vertexColors === THREE.FaceColors ) { - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); + _diffuseColor.multiply( element.color ); - } + } - } else if ( material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) { + if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) { - if ( material.map !== null ) { + _color1.copy( _ambientLight ); + _color2.copy( _ambientLight ); + _color3.copy( _ambientLight ); - if ( material.map.mapping instanceof THREE.UVMapping ) { + calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 ); + calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 ); + calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 ); - _uvs = element.uvs[ 0 ]; - patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map ); + _color1.multiply( _diffuseColor ).add( _emissiveColor ); + _color2.multiply( _diffuseColor ).add( _emissiveColor ); + _color3.multiply( _diffuseColor ).add( _emissiveColor ); + _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - } + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - } else if ( material.envMap !== null ) { + } else { - if ( material.envMap.mapping instanceof THREE.SphericalReflectionMapping ) { + _color.copy( _ambientLight ); - _vector3.copy( element.vertexNormalsModelView[ uv1 ] ); - _uv1x = 0.5 * _vector3.x + 0.5; - _uv1y = 0.5 * _vector3.y + 0.5; + calculateLight( element.centroidModel, element.normalModel, _color ); - _vector3.copy( element.vertexNormalsModelView[ uv2 ] ); - _uv2x = 0.5 * _vector3.x + 0.5; - _uv2y = 0.5 * _vector3.y + 0.5; + _color.multiply( _diffuseColor ).add( _emissiveColor ); - _vector3.copy( element.vertexNormalsModelView[ uv3 ] ); - _uv3x = 0.5 * _vector3.x + 0.5; - _uv3y = 0.5 * _vector3.y + 0.5; + material.wireframe === true + ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) + : fillPath( _color ); - patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); + } - }/* else if ( material.envMap.mapping == THREE.SphericalRefractionMapping ) { + } else if ( material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) { + if ( material.map !== null ) { + if ( material.map.mapping instanceof THREE.UVMapping ) { - }*/ + _uvs = element.uvs[ 0 ]; + patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map ); + } - } else { - _color.copy( material.color ); + } else if ( material.envMap !== null ) { - if ( material.vertexColors === THREE.FaceColors ) { + if ( material.envMap.mapping instanceof THREE.SphericalReflectionMapping ) { - _color.multiply( element.color ); + _vector3.copy( element.vertexNormalsModelView[ uv1 ] ); + _uv1x = 0.5 * _vector3.x + 0.5; + _uv1y = 0.5 * _vector3.y + 0.5; - } + _vector3.copy( element.vertexNormalsModelView[ uv2 ] ); + _uv2x = 0.5 * _vector3.x + 0.5; + _uv2y = 0.5 * _vector3.y + 0.5; - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); + _vector3.copy( element.vertexNormalsModelView[ uv3 ] ); + _uv3x = 0.5 * _vector3.x + 0.5; + _uv3y = 0.5 * _vector3.y + 0.5; - } + patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); - } else if ( material instanceof THREE.MeshDepthMaterial ) { + }/* else if ( material.envMap.mapping == THREE.SphericalRefractionMapping ) { - _near = camera.near; - _far = camera.far; - _color1.r = _color1.g = _color1.b = 1 - smoothstep( v1.positionScreen.z * v1.positionScreen.w, _near, _far ); - _color2.r = _color2.g = _color2.b = 1 - smoothstep( v2.positionScreen.z * v2.positionScreen.w, _near, _far ); - _color3.r = _color3.g = _color3.b = 1 - smoothstep( v3.positionScreen.z * v3.positionScreen.w, _near, _far ); - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + }*/ - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - } else if ( material instanceof THREE.MeshNormalMaterial ) { + } else { + + _color.copy( material.color ); - var normal; + if ( material.vertexColors === THREE.FaceColors ) { - if ( material.shading == THREE.FlatShading ) { + _color.multiply( element.color ); - normal = element.normalModelView; + } - _color.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + material.wireframe === true + ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) + : fillPath( _color ); - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); + } - } else if ( material.shading == THREE.SmoothShading ) { + } else if ( material instanceof THREE.MeshDepthMaterial ) { - normal = element.vertexNormalsModelView[ uv1 ]; - _color1.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + _near = _camera.near; + _far = _camera.far; - normal = element.vertexNormalsModelView[ uv2 ]; - _color2.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + _color1.r = _color1.g = _color1.b = 1 - smoothstep( v1.positionScreen.z * v1.positionScreen.w, _near, _far ); + _color2.r = _color2.g = _color2.b = 1 - smoothstep( v2.positionScreen.z * v2.positionScreen.w, _near, _far ); + _color3.r = _color3.g = _color3.b = 1 - smoothstep( v3.positionScreen.z * v3.positionScreen.w, _near, _far ); + _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - normal = element.vertexNormalsModelView[ uv3 ]; - _color3.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); + clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + } else if ( material instanceof THREE.MeshNormalMaterial ) { - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); + var normal; - } + if ( material.shading == THREE.FlatShading ) { - } + normal = element.normalModelView; - } + _color.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - function renderFace4( v1, v2, v3, v4, v5, v6, element, material ) { + material.wireframe === true + ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) + : fillPath( _color ); - _this.info.render.vertices += 4; - _this.info.render.faces ++; + } else if ( material.shading == THREE.SmoothShading ) { - setOpacity( material.opacity ); - setBlending( material.blending ); + normal = element.vertexNormalsModelView[ uv1 ]; + _color1.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - if ( ( material.map !== undefined && material.map !== null ) || ( material.envMap !== undefined && material.envMap !== null ) ) { + normal = element.vertexNormalsModelView[ uv2 ]; + _color2.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - // Let renderFace3() handle this + normal = element.vertexNormalsModelView[ uv3 ]; + _color3.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - renderFace3( v1, v2, v4, 0, 1, 3, element, material ); - renderFace3( v5, v3, v6, 1, 2, 3, element, material ); + _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - return; + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + + clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); } - _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y; - _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y; - _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y; - _v4x = v4.positionScreen.x; _v4y = v4.positionScreen.y; - _v5x = v5.positionScreen.x; _v5y = v5.positionScreen.y; - _v6x = v6.positionScreen.x; _v6y = v6.positionScreen.y; + } - if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) { + } - _diffuseColor.copy( material.color ); - _emissiveColor.copy( material.emissive ); + function renderFace4( v1, v2, v3, v4, v5, v6, element, material ) { - if ( material.vertexColors === THREE.FaceColors ) { + _this.info.render.vertices += 4; + _this.info.render.faces ++; - _diffuseColor.multiply( element.color ); + setOpacity( material.opacity ); + setBlending( material.blending ); - } + if ( ( material.map !== undefined && material.map !== null ) || ( material.envMap !== undefined && material.envMap !== null ) ) { - if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) { + // Let renderFace3() handle this - _color1.copy( _ambientLight ); - _color2.copy( _ambientLight ); - _color3.copy( _ambientLight ); - _color4.copy( _ambientLight ); + renderFace3( v1, v2, v4, 0, 1, 3, element, material ); + renderFace3( v5, v3, v6, 1, 2, 3, element, material ); - calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 ); - calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 ); - calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 ); - calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 ); + return; - _color1.multiply( _diffuseColor ).add( _emissiveColor ); - _color2.multiply( _diffuseColor ).add( _emissiveColor ); - _color3.multiply( _diffuseColor ).add( _emissiveColor ); - _color4.multiply( _diffuseColor ).add( _emissiveColor ); + } - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y; + _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y; + _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y; + _v4x = v4.positionScreen.x; _v4y = v4.positionScreen.y; + _v5x = v5.positionScreen.x; _v5y = v5.positionScreen.y; + _v6x = v6.positionScreen.x; _v6y = v6.positionScreen.y; - // TODO: UVs are incorrect, v4->v3? + if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) { - drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y ); - clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image ); + _diffuseColor.copy( material.color ); + _emissiveColor.copy( material.emissive ); - drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y ); - clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image ); + if ( material.vertexColors === THREE.FaceColors ) { - } else { + _diffuseColor.multiply( element.color ); - _color.copy( _ambientLight ); + } - calculateLight( element.centroidModel, element.normalModel, _color ); + if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) { - _color.multiply( _diffuseColor ).add( _emissiveColor ); + _color1.copy( _ambientLight ); + _color2.copy( _ambientLight ); + _color3.copy( _ambientLight ); + _color4.copy( _ambientLight ); - drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y ); + calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 ); + calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 ); + calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 ); + calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 ); - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); + _color1.multiply( _diffuseColor ).add( _emissiveColor ); + _color2.multiply( _diffuseColor ).add( _emissiveColor ); + _color3.multiply( _diffuseColor ).add( _emissiveColor ); + _color4.multiply( _diffuseColor ).add( _emissiveColor ); - } + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - } else if ( material instanceof THREE.MeshBasicMaterial ) { + // TODO: UVs are incorrect, v4->v3? - _color.copy( material.color ); + drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y ); + clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image ); - if ( material.vertexColors === THREE.FaceColors ) { + drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y ); + clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image ); - _color.multiply( element.color ); + } else { - } + _color.copy( _ambientLight ); + + calculateLight( element.centroidModel, element.normalModel, _color ); + + _color.multiply( _diffuseColor ).add( _emissiveColor ); drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y ); @@ -14831,58 +16092,54 @@ THREE.CanvasRenderer = function ( parameters ) { ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color ); - } else if ( material instanceof THREE.MeshNormalMaterial ) { + } - var normal; + } else if ( material instanceof THREE.MeshBasicMaterial ) { - if ( material.shading == THREE.FlatShading ) { + _color.copy( material.color ); - normal = element.normalModelView; - _color.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + if ( material.vertexColors === THREE.FaceColors ) { - drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y ); + _color.multiply( element.color ); - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); + } - } else if ( material.shading == THREE.SmoothShading ) { + drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y ); - normal = element.vertexNormalsModelView[ 0 ]; - _color1.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + material.wireframe === true + ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) + : fillPath( _color ); - normal = element.vertexNormalsModelView[ 1 ]; - _color2.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + } else if ( material instanceof THREE.MeshNormalMaterial ) { - normal = element.vertexNormalsModelView[ 3 ]; - _color3.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + var normal; - normal = element.vertexNormalsModelView[ 2 ]; - _color4.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); + if ( material.shading == THREE.FlatShading ) { - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + normal = element.normalModelView; + _color.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y ); - clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image ); + drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y ); - drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y ); - clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image ); + material.wireframe === true + ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) + : fillPath( _color ); - } + } else if ( material.shading == THREE.SmoothShading ) { - } else if ( material instanceof THREE.MeshDepthMaterial ) { + normal = element.vertexNormalsModelView[ 0 ]; + _color1.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - _near = camera.near; - _far = camera.far; + normal = element.vertexNormalsModelView[ 1 ]; + _color2.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - _color1.r = _color1.g = _color1.b = 1 - smoothstep( v1.positionScreen.z * v1.positionScreen.w, _near, _far ); - _color2.r = _color2.g = _color2.b = 1 - smoothstep( v2.positionScreen.z * v2.positionScreen.w, _near, _far ); - _color3.r = _color3.g = _color3.b = 1 - smoothstep( v4.positionScreen.z * v4.positionScreen.w, _near, _far ); - _color4.r = _color4.g = _color4.b = 1 - smoothstep( v3.positionScreen.z * v3.positionScreen.w, _near, _far ); + normal = element.vertexNormalsModelView[ 3 ]; + _color3.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); + normal = element.vertexNormalsModelView[ 2 ]; + _color4.setRGB( normal.x, normal.y, normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - // TODO: UVs are incorrect, v4->v3? + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y ); clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image ); @@ -14892,228 +16149,249 @@ THREE.CanvasRenderer = function ( parameters ) { } - } + } else if ( material instanceof THREE.MeshDepthMaterial ) { - // + _near = _camera.near; + _far = _camera.far; - function drawTriangle( x0, y0, x1, y1, x2, y2 ) { + _color1.r = _color1.g = _color1.b = 1 - smoothstep( v1.positionScreen.z * v1.positionScreen.w, _near, _far ); + _color2.r = _color2.g = _color2.b = 1 - smoothstep( v2.positionScreen.z * v2.positionScreen.w, _near, _far ); + _color3.r = _color3.g = _color3.b = 1 - smoothstep( v4.positionScreen.z * v4.positionScreen.w, _near, _far ); + _color4.r = _color4.g = _color4.b = 1 - smoothstep( v3.positionScreen.z * v3.positionScreen.w, _near, _far ); - _context.beginPath(); - _context.moveTo( x0, y0 ); - _context.lineTo( x1, y1 ); - _context.lineTo( x2, y2 ); - _context.closePath(); + _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - } + // TODO: UVs are incorrect, v4->v3? - function drawQuad( x0, y0, x1, y1, x2, y2, x3, y3 ) { + drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y ); + clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image ); - _context.beginPath(); - _context.moveTo( x0, y0 ); - _context.lineTo( x1, y1 ); - _context.lineTo( x2, y2 ); - _context.lineTo( x3, y3 ); - _context.closePath(); + drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y ); + clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image ); } - function strokePath( color, linewidth, linecap, linejoin ) { + } + + // - setLineWidth( linewidth ); - setLineCap( linecap ); - setLineJoin( linejoin ); - setStrokeStyle( color.getStyle() ); + function drawTriangle( x0, y0, x1, y1, x2, y2 ) { - _context.stroke(); + _context.beginPath(); + _context.moveTo( x0, y0 ); + _context.lineTo( x1, y1 ); + _context.lineTo( x2, y2 ); + _context.closePath(); - _elemBox.expandByScalar( linewidth * 2 ); + } - } + function drawQuad( x0, y0, x1, y1, x2, y2, x3, y3 ) { - function fillPath( color ) { + _context.beginPath(); + _context.moveTo( x0, y0 ); + _context.lineTo( x1, y1 ); + _context.lineTo( x2, y2 ); + _context.lineTo( x3, y3 ); + _context.closePath(); - setFillStyle( color.getStyle() ); - _context.fill(); + } - } + function strokePath( color, linewidth, linecap, linejoin ) { - function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { + setLineWidth( linewidth ); + setLineCap( linecap ); + setLineJoin( linejoin ); + setStrokeStyle( color.getStyle() ); - if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; + _context.stroke(); - if ( texture.needsUpdate === true ) { + _elemBox.expandByScalar( linewidth * 2 ); - var repeatX = texture.wrapS == THREE.RepeatWrapping; - var repeatY = texture.wrapT == THREE.RepeatWrapping; + } - _patterns[ texture.id ] = _context.createPattern( - texture.image, repeatX === true && repeatY === true - ? 'repeat' - : repeatX === true && repeatY === false - ? 'repeat-x' - : repeatX === false && repeatY === true - ? 'repeat-y' - : 'no-repeat' - ); + function fillPath( color ) { - texture.needsUpdate = false; + setFillStyle( color.getStyle() ); + _context.fill(); - } + } - _patterns[ texture.id ] === undefined - ? setFillStyle( 'rgba(0,0,0,1)' ) - : setFillStyle( _patterns[ texture.id ] ); + function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { - // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 + if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; - var a, b, c, d, e, f, det, idet, - offsetX = texture.offset.x / texture.repeat.x, - offsetY = texture.offset.y / texture.repeat.y, - width = texture.image.width * texture.repeat.x, - height = texture.image.height * texture.repeat.y; + if ( texture.needsUpdate === true ) { - u0 = ( u0 + offsetX ) * width; - v0 = ( 1.0 - v0 + offsetY ) * height; + var repeatX = texture.wrapS == THREE.RepeatWrapping; + var repeatY = texture.wrapT == THREE.RepeatWrapping; - u1 = ( u1 + offsetX ) * width; - v1 = ( 1.0 - v1 + offsetY ) * height; + _patterns[ texture.id ] = _context.createPattern( + texture.image, repeatX === true && repeatY === true + ? 'repeat' + : repeatX === true && repeatY === false + ? 'repeat-x' + : repeatX === false && repeatY === true + ? 'repeat-y' + : 'no-repeat' + ); - u2 = ( u2 + offsetX ) * width; - v2 = ( 1.0 - v2 + offsetY ) * height; + texture.needsUpdate = false; - x1 -= x0; y1 -= y0; - x2 -= x0; y2 -= y0; + } - u1 -= u0; v1 -= v0; - u2 -= u0; v2 -= v0; + _patterns[ texture.id ] === undefined + ? setFillStyle( 'rgba(0,0,0,1)' ) + : setFillStyle( _patterns[ texture.id ] ); - det = u1 * v2 - u2 * v1; + // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 - if ( det === 0 ) { + var a, b, c, d, e, f, det, idet, + offsetX = texture.offset.x / texture.repeat.x, + offsetY = texture.offset.y / texture.repeat.y, + width = texture.image.width * texture.repeat.x, + height = texture.image.height * texture.repeat.y; - if ( _imagedatas[ texture.id ] === undefined ) { + u0 = ( u0 + offsetX ) * width; + v0 = ( 1.0 - v0 + offsetY ) * height; - var canvas = document.createElement( 'canvas' ) - canvas.width = texture.image.width; - canvas.height = texture.image.height; + u1 = ( u1 + offsetX ) * width; + v1 = ( 1.0 - v1 + offsetY ) * height; - var context = canvas.getContext( '2d' ); - context.drawImage( texture.image, 0, 0 ); + u2 = ( u2 + offsetX ) * width; + v2 = ( 1.0 - v2 + offsetY ) * height; - _imagedatas[ texture.id ] = context.getImageData( 0, 0, texture.image.width, texture.image.height ).data; + x1 -= x0; y1 -= y0; + x2 -= x0; y2 -= y0; - } + u1 -= u0; v1 -= v0; + u2 -= u0; v2 -= v0; - var data = _imagedatas[ texture.id ]; - var index = ( Math.floor( u0 ) + Math.floor( v0 ) * texture.image.width ) * 4; + det = u1 * v2 - u2 * v1; - _color.setRGB( data[ index ] / 255, data[ index + 1 ] / 255, data[ index + 2 ] / 255 ); - fillPath( _color ); + if ( det === 0 ) { - return; + if ( _imagedatas[ texture.id ] === undefined ) { - } + var canvas = document.createElement( 'canvas' ) + canvas.width = texture.image.width; + canvas.height = texture.image.height; - idet = 1 / det; + var context = canvas.getContext( '2d' ); + context.drawImage( texture.image, 0, 0 ); - a = ( v2 * x1 - v1 * x2 ) * idet; - b = ( v2 * y1 - v1 * y2 ) * idet; - c = ( u1 * x2 - u2 * x1 ) * idet; - d = ( u1 * y2 - u2 * y1 ) * idet; + _imagedatas[ texture.id ] = context.getImageData( 0, 0, texture.image.width, texture.image.height ).data; - e = x0 - a * u0 - c * v0; - f = y0 - b * u0 - d * v0; + } - _context.save(); - _context.transform( a, b, c, d, e, f ); - _context.fill(); - _context.restore(); + var data = _imagedatas[ texture.id ]; + var index = ( Math.floor( u0 ) + Math.floor( v0 ) * texture.image.width ) * 4; + + _color.setRGB( data[ index ] / 255, data[ index + 1 ] / 255, data[ index + 2 ] / 255 ); + fillPath( _color ); + + return; } - function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { + idet = 1 / det; - // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 + a = ( v2 * x1 - v1 * x2 ) * idet; + b = ( v2 * y1 - v1 * y2 ) * idet; + c = ( u1 * x2 - u2 * x1 ) * idet; + d = ( u1 * y2 - u2 * y1 ) * idet; - var a, b, c, d, e, f, det, idet, - width = image.width - 1, - height = image.height - 1; + e = x0 - a * u0 - c * v0; + f = y0 - b * u0 - d * v0; - u0 *= width; v0 *= height; - u1 *= width; v1 *= height; - u2 *= width; v2 *= height; + _context.save(); + _context.transform( a, b, c, d, e, f ); + _context.fill(); + _context.restore(); - x1 -= x0; y1 -= y0; - x2 -= x0; y2 -= y0; + } - u1 -= u0; v1 -= v0; - u2 -= u0; v2 -= v0; + function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { - det = u1 * v2 - u2 * v1; + // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 - idet = 1 / det; + var a, b, c, d, e, f, det, idet, + width = image.width - 1, + height = image.height - 1; - a = ( v2 * x1 - v1 * x2 ) * idet; - b = ( v2 * y1 - v1 * y2 ) * idet; - c = ( u1 * x2 - u2 * x1 ) * idet; - d = ( u1 * y2 - u2 * y1 ) * idet; + u0 *= width; v0 *= height; + u1 *= width; v1 *= height; + u2 *= width; v2 *= height; - e = x0 - a * u0 - c * v0; - f = y0 - b * u0 - d * v0; + x1 -= x0; y1 -= y0; + x2 -= x0; y2 -= y0; - _context.save(); - _context.transform( a, b, c, d, e, f ); - _context.clip(); - _context.drawImage( image, 0, 0 ); - _context.restore(); + u1 -= u0; v1 -= v0; + u2 -= u0; v2 -= v0; - } + det = u1 * v2 - u2 * v1; - function getGradientTexture( color1, color2, color3, color4 ) { + idet = 1 / det; - // http://mrdoob.com/blog/post/710 + a = ( v2 * x1 - v1 * x2 ) * idet; + b = ( v2 * y1 - v1 * y2 ) * idet; + c = ( u1 * x2 - u2 * x1 ) * idet; + d = ( u1 * y2 - u2 * y1 ) * idet; - _pixelMapData[ 0 ] = ( color1.r * 255 ) | 0; - _pixelMapData[ 1 ] = ( color1.g * 255 ) | 0; - _pixelMapData[ 2 ] = ( color1.b * 255 ) | 0; + e = x0 - a * u0 - c * v0; + f = y0 - b * u0 - d * v0; - _pixelMapData[ 4 ] = ( color2.r * 255 ) | 0; - _pixelMapData[ 5 ] = ( color2.g * 255 ) | 0; - _pixelMapData[ 6 ] = ( color2.b * 255 ) | 0; + _context.save(); + _context.transform( a, b, c, d, e, f ); + _context.clip(); + _context.drawImage( image, 0, 0 ); + _context.restore(); - _pixelMapData[ 8 ] = ( color3.r * 255 ) | 0; - _pixelMapData[ 9 ] = ( color3.g * 255 ) | 0; - _pixelMapData[ 10 ] = ( color3.b * 255 ) | 0; + } - _pixelMapData[ 12 ] = ( color4.r * 255 ) | 0; - _pixelMapData[ 13 ] = ( color4.g * 255 ) | 0; - _pixelMapData[ 14 ] = ( color4.b * 255 ) | 0; + function getGradientTexture( color1, color2, color3, color4 ) { - _pixelMapContext.putImageData( _pixelMapImage, 0, 0 ); - _gradientMapContext.drawImage( _pixelMap, 0, 0 ); + // http://mrdoob.com/blog/post/710 - return _gradientMap; + _pixelMapData[ 0 ] = ( color1.r * 255 ) | 0; + _pixelMapData[ 1 ] = ( color1.g * 255 ) | 0; + _pixelMapData[ 2 ] = ( color1.b * 255 ) | 0; - } + _pixelMapData[ 4 ] = ( color2.r * 255 ) | 0; + _pixelMapData[ 5 ] = ( color2.g * 255 ) | 0; + _pixelMapData[ 6 ] = ( color2.b * 255 ) | 0; - // Hide anti-alias gaps + _pixelMapData[ 8 ] = ( color3.r * 255 ) | 0; + _pixelMapData[ 9 ] = ( color3.g * 255 ) | 0; + _pixelMapData[ 10 ] = ( color3.b * 255 ) | 0; - function expand( v1, v2 ) { + _pixelMapData[ 12 ] = ( color4.r * 255 ) | 0; + _pixelMapData[ 13 ] = ( color4.g * 255 ) | 0; + _pixelMapData[ 14 ] = ( color4.b * 255 ) | 0; - var x = v2.x - v1.x, y = v2.y - v1.y, - det = x * x + y * y, idet; + _pixelMapContext.putImageData( _pixelMapImage, 0, 0 ); + _gradientMapContext.drawImage( _pixelMap, 0, 0 ); - if ( det === 0 ) return; + return _gradientMap; - idet = 1 / Math.sqrt( det ); + } - x *= idet; y *= idet; + // Hide anti-alias gaps - v2.x += x; v2.y += y; - v1.x -= x; v1.y -= y; + function expand( v1, v2, pixels ) { - } - }; + var x = v2.x - v1.x, y = v2.y - v1.y, + det = x * x + y * y, idet; + + if ( det === 0 ) return; + + idet = pixels / Math.sqrt( det ); + + x *= idet; y *= idet; + + v2.x += x; v2.y += y; + v1.x -= x; v1.y -= y; + + } // Context cached methods. @@ -15224,6 +16502,7 @@ THREE.CanvasRenderer = function ( parameters ) { } }; + /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ @@ -18426,6 +19705,7 @@ THREE.ShaderLib = { } }; + /** * @author supereggbert / http://www.paulbrunt.co.uk/ * @author mrdoob / http://mrdoob.com/ @@ -18619,6 +19899,7 @@ THREE.WebGLRenderer = function ( parameters ) { var _gl; var _glExtensionTextureFloat; + var _glExtensionTextureFloatLinear; var _glExtensionStandardDerivatives; var _glExtensionTextureFilterAnisotropic; var _glExtensionCompressedTextureS3TC; @@ -19152,86 +20433,6 @@ THREE.WebGLRenderer = function ( parameters ) { // - /* - function deleteParticleBuffers ( geometry ) { - - _gl.deleteBuffer( geometry.__webglVertexBuffer ); - _gl.deleteBuffer( geometry.__webglColorBuffer ); - - deleteCustomAttributesBuffers( geometry ); - - _this.info.memory.geometries --; - - }; - - function deleteLineBuffers ( geometry ) { - - _gl.deleteBuffer( geometry.__webglVertexBuffer ); - _gl.deleteBuffer( geometry.__webglColorBuffer ); - _gl.deleteBuffer( geometry.__webglLineDistanceBuffer ); - - deleteCustomAttributesBuffers( geometry ); - - _this.info.memory.geometries --; - - }; - - function deleteRibbonBuffers ( geometry ) { - - _gl.deleteBuffer( geometry.__webglVertexBuffer ); - _gl.deleteBuffer( geometry.__webglColorBuffer ); - _gl.deleteBuffer( geometry.__webglNormalBuffer ); - - deleteCustomAttributesBuffers( geometry ); - - _this.info.memory.geometries --; - - }; - - function deleteMeshBuffers ( geometryGroup ) { - - _gl.deleteBuffer( geometryGroup.__webglVertexBuffer ); - _gl.deleteBuffer( geometryGroup.__webglNormalBuffer ); - _gl.deleteBuffer( geometryGroup.__webglTangentBuffer ); - _gl.deleteBuffer( geometryGroup.__webglColorBuffer ); - _gl.deleteBuffer( geometryGroup.__webglUVBuffer ); - _gl.deleteBuffer( geometryGroup.__webglUV2Buffer ); - - _gl.deleteBuffer( geometryGroup.__webglSkinIndicesBuffer ); - _gl.deleteBuffer( geometryGroup.__webglSkinWeightsBuffer ); - - _gl.deleteBuffer( geometryGroup.__webglFaceBuffer ); - _gl.deleteBuffer( geometryGroup.__webglLineBuffer ); - - var m, ml; - - if ( geometryGroup.numMorphTargets ) { - - for ( m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphTargetsBuffers[ m ] ); - - } - - } - - if ( geometryGroup.numMorphNormals ) { - - for ( m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphNormalsBuffers[ m ] ); - - } - - } - - deleteCustomAttributesBuffers( geometryGroup ); - - _this.info.memory.geometries --; - - }; - */ - function deleteCustomAttributesBuffers( geometry ) { if ( geometry.__webglCustomAttributesList ) { @@ -19578,6 +20779,12 @@ THREE.WebGLRenderer = function ( parameters ) { attribute = geometry.attributes[ a ]; + if ( attribute.numItems === undefined ) { + + attribute.numItems = attribute.array.length; + + } + attribute.buffer = _gl.createBuffer(); _gl.bindBuffer( type, attribute.buffer ); @@ -21711,7 +22918,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( dispose && ! attributeItem.dynamic ) { - delete attributeItem.array; + attributeItem.array = null; } @@ -21818,13 +23025,13 @@ THREE.WebGLRenderer = function ( parameters ) { if ( material.visible === false ) return; - var program, programAttributes, linewidth, primitives, a, attribute, geometryAttributes; + var linewidth, a, attribute; var attributeItem, attributeName, attributePointer, attributeSize; - program = setProgram( camera, lights, fog, material, object ); + var program = setProgram( camera, lights, fog, material, object ); - programAttributes = program.attributes; - geometryAttributes = geometry.attributes; + var programAttributes = program.attributes; + var geometryAttributes = geometry.attributes; var updateBuffers = false, wireframeBit = material.wireframe ? 1 : 0, @@ -21994,11 +23201,13 @@ THREE.WebGLRenderer = function ( parameters ) { // render lines + var primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; + setLineWidth( material.linewidth ); var position = geometryAttributes[ "position" ]; - _gl.drawArrays( _gl.LINE_STRIP, 0, position.numItems / 3 ); + _gl.drawArrays( primitives, 0, position.numItems / 3 ); _this.info.render.calls ++; _this.info.render.points += position.numItems; @@ -22013,11 +23222,11 @@ THREE.WebGLRenderer = function ( parameters ) { if ( material.visible === false ) return; - var program, attributes, linewidth, primitives, a, attribute, i, il; + var linewidth, a, attribute, i, il; - program = setProgram( camera, lights, fog, material, object ); + var program = setProgram( camera, lights, fog, material, object ); - attributes = program.attributes; + var attributes = program.attributes; var updateBuffers = false, wireframeBit = material.wireframe ? 1 : 0, @@ -22187,7 +23396,7 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( object instanceof THREE.Line ) { - primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; + var primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; setLineWidth( material.linewidth ); @@ -23109,10 +24318,12 @@ THREE.WebGLRenderer = function ( parameters ) { objlist.push( { + id: null, buffer: buffer, object: object, opaque: null, - transparent: null + transparent: null, + z: 0 } ); @@ -23122,9 +24333,11 @@ THREE.WebGLRenderer = function ( parameters ) { objlist.push( { + id: null, object: object, opaque: null, - transparent: null + transparent: null, + z: 0 } ); @@ -24147,6 +25360,10 @@ THREE.WebGLRenderer = function ( parameters ) { } + } else { + + console.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type ); + } } @@ -25236,6 +26453,8 @@ THREE.WebGLRenderer = function ( parameters ) { if ( ! texture.image.__webglTextureCube ) { + texture.addEventListener( 'dispose', onTextureDispose ); + texture.image.__webglTextureCube = _gl.createTexture(); _this.info.memory.textures ++; @@ -25644,15 +26863,16 @@ THREE.WebGLRenderer = function ( parameters ) { }; - function allocateLights ( lights ) { + function allocateLights( lights ) { - var l, ll, light, dirLights, pointLights, spotLights, hemiLights; + var dirLights = 0; + var pointLights = 0; + var spotLights = 0; + var hemiLights = 0; - dirLights = pointLights = spotLights = hemiLights = 0; + for ( var l = 0, ll = lights.length; l < ll; l ++ ) { - for ( l = 0, ll = lights.length; l < ll; l ++ ) { - - light = lights[ l ]; + var light = lights[ l ]; if ( light.onlyShadow ) continue; @@ -25667,13 +26887,13 @@ THREE.WebGLRenderer = function ( parameters ) { }; - function allocateShadows ( lights ) { + function allocateShadows( lights ) { - var l, ll, light, maxShadows = 0; + var maxShadows = 0; - for ( l = 0, ll = lights.length; l < ll; l++ ) { + for ( var l = 0, ll = lights.length; l < ll; l++ ) { - light = lights[ l ]; + var light = lights[ l ]; if ( ! light.castShadow ) continue; @@ -25688,7 +26908,7 @@ THREE.WebGLRenderer = function ( parameters ) { // Initialization - function initGL () { + function initGL() { try { @@ -25705,16 +26925,12 @@ THREE.WebGLRenderer = function ( parameters ) { } _glExtensionTextureFloat = _gl.getExtension( 'OES_texture_float' ); + _glExtensionTextureFloatLinear = _gl.getExtension( 'OES_texture_float_linear' ); _glExtensionStandardDerivatives = _gl.getExtension( 'OES_standard_derivatives' ); - _glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || - _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || - _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - + _glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - _glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || - _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || - _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); + _glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); if ( ! _glExtensionTextureFloat ) { @@ -25785,6 +27001,7 @@ THREE.WebGLRenderer = function ( parameters ) { this.addPostPlugin( new THREE.LensFlarePlugin() ); }; + /** * @author szimek / https://github.com/szimek/ * @author alteredq / http://alteredqualia.com/ @@ -25824,11 +27041,6 @@ THREE.WebGLRenderTarget.prototype = { constructor: THREE.WebGLRenderTarget, - addEventListener: THREE.EventDispatcher.prototype.addEventListener, - hasEventListener: THREE.EventDispatcher.prototype.hasEventListener, - removeEventListener: THREE.EventDispatcher.prototype.removeEventListener, - dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent, - clone: function () { var tmp = new THREE.WebGLRenderTarget( this.width, this.height ); @@ -25865,6 +27077,9 @@ THREE.WebGLRenderTarget.prototype = { } }; + +THREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype ); + /** * @author alteredq / http://alteredqualia.com */ @@ -25878,6 +27093,7 @@ THREE.WebGLRenderTargetCube = function ( width, height, options ) { }; THREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype ); + /** * @author mrdoob / http://mrdoob.com/ */ @@ -25897,12 +27113,15 @@ THREE.RenderableVertex.prototype.copy = function ( vertex ) { this.positionScreen.copy( vertex.positionScreen ); }; + /** * @author mrdoob / http://mrdoob.com/ */ THREE.RenderableFace3 = function () { + this.id = 0; + this.v1 = new THREE.RenderableVertex(); this.v2 = new THREE.RenderableVertex(); this.v3 = new THREE.RenderableVertex(); @@ -25920,15 +27139,18 @@ THREE.RenderableFace3 = function () { this.material = null; this.uvs = [[]]; - this.z = null; + this.z = 0; }; + /** * @author mrdoob / http://mrdoob.com/ */ THREE.RenderableFace4 = function () { + this.id = 0; + this.v1 = new THREE.RenderableVertex(); this.v2 = new THREE.RenderableVertex(); this.v3 = new THREE.RenderableVertex(); @@ -25947,30 +27169,36 @@ THREE.RenderableFace4 = function () { this.material = null; this.uvs = [[]]; - this.z = null; + this.z = 0; }; + /** * @author mrdoob / http://mrdoob.com/ */ THREE.RenderableObject = function () { + this.id = 0; + this.object = null; - this.z = null; + this.z = 0; }; + /** * @author mrdoob / http://mrdoob.com/ */ THREE.RenderableParticle = function () { + this.id = 0; + this.object = null; - this.x = null; - this.y = null; - this.z = null; + this.x = 0; + this.y = 0; + this.z = 0; this.rotation = null; this.scale = new THREE.Vector2(); @@ -25978,13 +27206,14 @@ THREE.RenderableParticle = function () { this.material = null; }; + /** * @author mrdoob / http://mrdoob.com/ */ THREE.RenderableLine = function () { - this.z = null; + this.id = 0; this.v1 = new THREE.RenderableVertex(); this.v2 = new THREE.RenderableVertex(); @@ -25992,7 +27221,10 @@ THREE.RenderableLine = function () { this.vertexColors = [ new THREE.Color(), new THREE.Color() ]; this.material = null; + this.z = 0; + }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -26149,40 +27381,44 @@ THREE.GeometryUtils = { // (uniform distribution) // http://www.cgafaq.info/wiki/Random_Point_In_Triangle - randomPointInTriangle: function ( vectorA, vectorB, vectorC ) { + randomPointInTriangle: function () { - var a, b, c, - point = new THREE.Vector3(), - tmp = THREE.GeometryUtils.__v1; + var vector = new THREE.Vector3(); - a = THREE.GeometryUtils.random(); - b = THREE.GeometryUtils.random(); + return function ( vectorA, vectorB, vectorC ) { - if ( ( a + b ) > 1 ) { + var point = new THREE.Vector3(); - a = 1 - a; - b = 1 - b; + var a = THREE.Math.random16(); + var b = THREE.Math.random16(); - } + if ( ( a + b ) > 1 ) { - c = 1 - a - b; + a = 1 - a; + b = 1 - b; - point.copy( vectorA ); - point.multiplyScalar( a ); + } - tmp.copy( vectorB ); - tmp.multiplyScalar( b ); + var c = 1 - a - b; - point.add( tmp ); + point.copy( vectorA ); + point.multiplyScalar( a ); - tmp.copy( vectorC ); - tmp.multiplyScalar( c ); + vector.copy( vectorB ); + vector.multiplyScalar( b ); - point.add( tmp ); + point.add( vector ); - return point; + vector.copy( vectorC ); + vector.multiplyScalar( c ); - }, + point.add( vector ); + + return point; + + }; + + }(), // Get random point in face (triangle / quad) // (uniform distribution) @@ -26232,7 +27468,7 @@ THREE.GeometryUtils = { } - var r = THREE.GeometryUtils.random() * ( area1 + area2 ); + var r = THREE.Math.random16() * ( area1 + area2 ); if ( r < area1 ) { @@ -26342,7 +27578,7 @@ THREE.GeometryUtils = { for ( i = 0; i < n; i ++ ) { - r = THREE.GeometryUtils.random() * totalArea; + r = THREE.Math.random16() * totalArea; index = binarySearchIndices( r ); @@ -26367,18 +27603,22 @@ THREE.GeometryUtils = { // Get triangle area (half of parallelogram) // http://mathworld.wolfram.com/TriangleArea.html - triangleArea: function ( vectorA, vectorB, vectorC ) { + triangleArea: function () { - var tmp1 = THREE.GeometryUtils.__v1, - tmp2 = THREE.GeometryUtils.__v2; + var vector1 = new THREE.Vector3(); + var vector2 = new THREE.Vector3(); - tmp1.subVectors( vectorB, vectorA ); - tmp2.subVectors( vectorC, vectorA ); - tmp1.cross( tmp2 ); + return function ( vectorA, vectorB, vectorC ) { - return 0.5 * tmp1.length(); + vector1.subVectors( vectorB, vectorA ); + vector2.subVectors( vectorC, vectorA ); + vector1.cross( vector2 ); - }, + return 0.5 * vector1.length(); + + }; + + }(), // Center geometry so that 0,0,0 is in center of bounding box @@ -26400,30 +27640,6 @@ THREE.GeometryUtils = { }, - // Normalize UVs to be from <0,1> - // (for now just the first set of UVs) - - normalizeUVs: function ( geometry ) { - - var uvSet = geometry.faceVertexUvs[ 0 ]; - - for ( var i = 0, il = uvSet.length; i < il; i ++ ) { - - var uvs = uvSet[ i ]; - - for ( var j = 0, jl = uvs.length; j < jl; j ++ ) { - - // texture repeat - - if( uvs[ j ].x !== 1.0 ) uvs[ j ].x = uvs[ j ].x - Math.floor( uvs[ j ].x ); - if( uvs[ j ].y !== 1.0 ) uvs[ j ].y = uvs[ j ].y - Math.floor( uvs[ j ].y ); - - } - - } - - }, - triangulateQuads: function ( geometry ) { var i, il, j, jl; @@ -26566,10 +27782,6 @@ THREE.GeometryUtils = { }; -THREE.GeometryUtils.random = THREE.Math.random16; - -THREE.GeometryUtils.__v1 = new THREE.Vector3(); -THREE.GeometryUtils.__v2 = new THREE.Vector3(); /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ @@ -26585,25 +27797,16 @@ THREE.ImageUtils = { var texture = new THREE.Texture( image, mapping ); var loader = new THREE.ImageLoader(); + loader.crossOrigin = this.crossOrigin; + loader.load( url, function ( image ) { - loader.addEventListener( 'load', function ( event ) { - - texture.image = event.content; + texture.image = image; texture.needsUpdate = true; if ( onLoad ) onLoad( texture ); } ); - loader.addEventListener( 'error', function ( event ) { - - if ( onError ) onError( event.message ); - - } ); - - loader.crossOrigin = this.crossOrigin; - loader.load( url, image ); - texture.sourceFile = url; return texture; @@ -27123,6 +28326,7 @@ THREE.ImageUtils = { } }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -27163,6 +28367,7 @@ THREE.SceneUtils = { } }; + /** * @author zz85 / http://www.lab4games.net/zz85/blog * @author alteredq / http://alteredqualia.com/ @@ -27623,6 +28828,7 @@ THREE.FontUtils.generateShapes = function( text, parameters ) { // To use the typeface.js face files, hook up the API self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; THREE.typeface_js = self._typeface_js; + /** * @author zz85 / http://www.lab4games.net/zz85/blog * Extensible curve object @@ -27634,10 +28840,9 @@ THREE.typeface_js = self._typeface_js; * .getLength() * .updateArcLengths() * - * This file contains following classes: + * This following classes subclasses THREE.Curve: * * -- 2d classes -- - * THREE.Curve * THREE.LineCurve * THREE.QuadraticBezierCurve * THREE.CubicBezierCurve @@ -27888,216 +29093,8 @@ THREE.Curve.prototype.getTangentAt = function ( u ) { }; -/************************************************************** - * Line - **************************************************************/ - -THREE.LineCurve = function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.LineCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.LineCurve.prototype.getPoint = function ( t ) { - - var point = this.v2.clone().sub(this.v1); - point.multiplyScalar( t ).add( this.v1 ); - - return point; - -}; - -// Line curve is linear, so we can overwrite default getPointAt - -THREE.LineCurve.prototype.getPointAt = function ( u ) { - - return this.getPoint( u ); - -}; - -THREE.LineCurve.prototype.getTangent = function( t ) { - - var tangent = this.v2.clone().sub(this.v1); - - return tangent.normalize(); - -}; - -/************************************************************** - * Quadratic Bezier curve - **************************************************************/ - - -THREE.QuadraticBezierCurve = function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype ); - - -THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) { - - var tx, ty; - - tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - - return new THREE.Vector2( tx, ty ); - -}; - - -THREE.QuadraticBezierCurve.prototype.getTangent = function( t ) { - - var tx, ty; - - tx = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ); - - // returns unit vector - - var tangent = new THREE.Vector2( tx, ty ); - tangent.normalize(); - return tangent; -}; - - -/************************************************************** - * Cubic Bezier curve - **************************************************************/ - -THREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - -}; - -THREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.CubicBezierCurve.prototype.getPoint = function ( t ) { - - var tx, ty; - - tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - return new THREE.Vector2( tx, ty ); - -}; - -THREE.CubicBezierCurve.prototype.getTangent = function( t ) { - - var tx, ty; - - tx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - var tangent = new THREE.Vector2( tx, ty ); - tangent.normalize(); - - return tangent; - -}; - - -/************************************************************** - * Spline curve - **************************************************************/ - -THREE.SplineCurve = function ( points /* array of Vector2 */ ) { - - this.points = (points == undefined) ? [] : points; - -}; - -THREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.SplineCurve.prototype.getPoint = function ( t ) { - - var v = new THREE.Vector2(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 1 ) * t; - - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? points.length -1 : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? points.length -1 : intPoint + 2; - - v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); - v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); - - return v; - -}; - -/************************************************************** - * Ellipse curve - **************************************************************/ - -THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, - aClockwise ) { - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - -}; - -THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.EllipseCurve.prototype.getPoint = function ( t ) { - - var deltaAngle = this.aEndAngle - this.aStartAngle; - - if ( !this.aClockwise ) { - - t = 1 - t; - - } - - var angle = this.aStartAngle + t * deltaAngle; - - var tx = this.aX + this.xRadius * Math.cos( angle ); - var ty = this.aY + this.yRadius * Math.sin( angle ); - - return new THREE.Vector2( tx, ty ); - -}; - -/************************************************************** - * Arc curve - **************************************************************/ - -THREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - THREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); -}; - -THREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype ); /************************************************************** @@ -28168,208 +29165,6 @@ THREE.Curve.create = function ( constructor, getPointFunc ) { }; - -/************************************************************** - * Line3D - **************************************************************/ - -THREE.LineCurve3 = THREE.Curve.create( - - function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var r = new THREE.Vector3(); - - - r.subVectors( this.v2, this.v1 ); // diff - r.multiplyScalar( t ); - r.add( this.v1 ); - - return r; - - } - -); - - -/************************************************************** - * Quadratic Bezier 3D curve - **************************************************************/ - -THREE.QuadraticBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var tx, ty, tz; - - tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - tz = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z ); - - return new THREE.Vector3( tx, ty, tz ); - - } - -); - - - -/************************************************************** - * Cubic Bezier 3D curve - **************************************************************/ - -THREE.CubicBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - }, - - function ( t ) { - - var tx, ty, tz; - - tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - tz = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z ); - - return new THREE.Vector3( tx, ty, tz ); - - } - -); - - - -/************************************************************** - * Spline 3D curve - **************************************************************/ - - -THREE.SplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = (points == undefined) ? [] : points; - - }, - - function ( t ) { - - var v = new THREE.Vector3(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 1 ) * t; - - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - - var pt0 = points[ c[0] ], - pt1 = points[ c[1] ], - pt2 = points[ c[2] ], - pt3 = points[ c[3] ]; - - v.x = THREE.Curve.Utils.interpolate(pt0.x, pt1.x, pt2.x, pt3.x, weight); - v.y = THREE.Curve.Utils.interpolate(pt0.y, pt1.y, pt2.y, pt3.y, weight); - v.z = THREE.Curve.Utils.interpolate(pt0.z, pt1.z, pt2.z, pt3.z, weight); - - return v; - - } - -); - - -// THREE.SplineCurve3.prototype.getTangent = function(t) { -// var v = new THREE.Vector3(); -// var c = []; -// var points = this.points, point, intPoint, weight; -// point = ( points.length - 1 ) * t; - -// intPoint = Math.floor( point ); -// weight = point - intPoint; - -// c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; -// c[ 1 ] = intPoint; -// c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1; -// c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - -// var pt0 = points[ c[0] ], -// pt1 = points[ c[1] ], -// pt2 = points[ c[2] ], -// pt3 = points[ c[3] ]; - -// // t = weight; -// v.x = THREE.Curve.Utils.tangentSpline( t, pt0.x, pt1.x, pt2.x, pt3.x ); -// v.y = THREE.Curve.Utils.tangentSpline( t, pt0.y, pt1.y, pt2.y, pt3.y ); -// v.z = THREE.Curve.Utils.tangentSpline( t, pt0.z, pt1.z, pt2.z, pt3.z ); - -// return v; - -// } - -/************************************************************** - * Closed Spline 3D curve - **************************************************************/ - - -THREE.ClosedSplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = (points == undefined) ? [] : points; - - }, - - function ( t ) { - - var v = new THREE.Vector3(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 0 ) * t; - // This needs to be from 0-length +1 - - intPoint = Math.floor( point ); - weight = point - intPoint; - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; - c[ 0 ] = ( intPoint - 1 ) % points.length; - c[ 1 ] = ( intPoint ) % points.length; - c[ 2 ] = ( intPoint + 1 ) % points.length; - c[ 3 ] = ( intPoint + 2 ) % points.length; - - v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); - v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); - v.z = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].z, points[ c[ 1 ] ].z, points[ c[ 2 ] ].z, points[ c[ 3 ] ].z, weight ); - - return v; - - } - -); /** * @author zz85 / http://www.lab4games.net/zz85/blog * @@ -28695,6 +29490,7 @@ THREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) { }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -28719,10 +29515,10 @@ THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) { this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - this.matrixWorld.decompose( this.translationWorld, this.rotationWorld, this.scaleWorld ); - this.matrix.decompose( this.translationObject, this.rotationObject, this.scaleObject ); + this.matrixWorld.decompose( this.translationWorld, this.quaternionWorld, this.scaleWorld ); + this.matrix.decompose( this.translationObject, this.quaternionObject, this.scaleObject ); - this.matrixWorld.makeFromPositionQuaternionScale( this.translationWorld, this.rotationObject, this.scaleWorld ); + this.matrixWorld.compose( this.translationWorld, this.quaternionObject, this.scaleWorld ); } else { @@ -28750,11 +29546,12 @@ THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) { THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3(); THREE.Gyroscope.prototype.translationObject = new THREE.Vector3(); -THREE.Gyroscope.prototype.rotationWorld = new THREE.Quaternion(); -THREE.Gyroscope.prototype.rotationObject = new THREE.Quaternion(); +THREE.Gyroscope.prototype.quaternionWorld = new THREE.Quaternion(); +THREE.Gyroscope.prototype.quaternionObject = new THREE.Quaternion(); THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3(); THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3(); + /** * @author zz85 / http://www.lab4games.net/zz85/blog * Creates free form 2d path using series of points, lines or curves. @@ -28849,8 +29646,8 @@ THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) { }; THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY ) { + aCP2x, aCP2y, + aX, aY ) { var args = Array.prototype.slice.call( arguments ); @@ -28898,14 +29695,14 @@ THREE.Path.prototype.arc = function ( aX, aY, aRadius, this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise ); - + }; THREE.Path.prototype.absarc = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); }; - + THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) { @@ -28917,7 +29714,7 @@ THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ); }; - + THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) { @@ -29031,7 +29828,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) { points.push( new THREE.Vector2( tx, ty ) ); - } + } break; @@ -29181,7 +29978,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) { var lastPoint = points[ points.length - 1]; var EPSILON = 0.0000000001; if ( Math.abs(lastPoint.x - points[ 0 ].x) < EPSILON && - Math.abs(lastPoint.y - points[ 0 ].y) < EPSILON) + Math.abs(lastPoint.y - points[ 0 ].y) < EPSILON) points.splice( points.length - 1, 1); if ( closedPath ) { @@ -29195,7 +29992,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) { // Breaks path into shapes -THREE.Path.prototype.toShapes = function() { +THREE.Path.prototype.toShapes = function( isCCW ) { var i, il, item, action, args; @@ -29233,19 +30030,23 @@ THREE.Path.prototype.toShapes = function() { if ( subPaths.length == 0 ) return []; - var tmpPath, tmpShape, shapes = []; - - var holesFirst = !THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() ); - // console.log("Holes first", holesFirst); + var solid, tmpPath, tmpShape, shapes = []; if ( subPaths.length == 1) { + tmpPath = subPaths[0]; tmpShape = new THREE.Shape(); tmpShape.actions = tmpPath.actions; tmpShape.curves = tmpPath.curves; shapes.push( tmpShape ); return shapes; - }; + + } + + var holesFirst = !THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() ); + holesFirst = isCCW ? !holesFirst : holesFirst; + + // console.log("Holes first", holesFirst); if ( holesFirst ) { @@ -29254,8 +30055,10 @@ THREE.Path.prototype.toShapes = function() { for ( i = 0, il = subPaths.length; i < il; i ++ ) { tmpPath = subPaths[ i ]; + solid = THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ); + solid = isCCW ? !solid : solid; - if ( THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ) ) { + if ( solid ) { tmpShape.actions = tmpPath.actions; tmpShape.curves = tmpPath.curves; @@ -29278,13 +30081,15 @@ THREE.Path.prototype.toShapes = function() { } else { // Shapes first + tmpShape = undefined; for ( i = 0, il = subPaths.length; i < il; i ++ ) { tmpPath = subPaths[ i ]; + solid = THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ); + solid = isCCW ? !solid : solid; - if ( THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ) ) { - + if ( solid ) { if ( tmpShape ) shapes.push( tmpShape ); @@ -29309,6 +30114,7 @@ THREE.Path.prototype.toShapes = function() { return shapes; }; + /** * @author zz85 / http://www.lab4games.net/zz85/blog * Defines a 2d shape plane using paths. @@ -29609,238 +30415,635 @@ THREE.Shape.Utils = { ]; - verts.push( trianglea ); - verts.push( triangleb ); + verts.push( trianglea ); + verts.push( triangleb ); + + shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 ); + + } + + return { + + shape:shape, /* shape with no holes */ + isolatedPts: verts, /* isolated faces */ + allpoints: allpoints + + } + + + }, + + triangulateShape: function ( contour, holes ) { + + var shapeWithoutHoles = THREE.Shape.Utils.removeHoles( contour, holes ); + + var shape = shapeWithoutHoles.shape, + allpoints = shapeWithoutHoles.allpoints, + isolatedPts = shapeWithoutHoles.isolatedPts; + + var triangles = THREE.FontUtils.Triangulate( shape, false ); // True returns indices for points of spooled shape + + // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. + + //console.log( "triangles",triangles, triangles.length ); + //console.log( "allpoints",allpoints, allpoints.length ); + + var i, il, f, face, + key, index, + allPointsMap = {}, + isolatedPointsMap = {}; + + // prepare all points map + + for ( i = 0, il = allpoints.length; i < il; i ++ ) { + + key = allpoints[ i ].x + ":" + allpoints[ i ].y; + + if ( allPointsMap[ key ] !== undefined ) { + + console.log( "Duplicate point", key ); + + } + + allPointsMap[ key ] = i; + + } + + // check all face vertices against all points map + + for ( i = 0, il = triangles.length; i < il; i ++ ) { + + face = triangles[ i ]; + + for ( f = 0; f < 3; f ++ ) { + + key = face[ f ].x + ":" + face[ f ].y; + + index = allPointsMap[ key ]; + + if ( index !== undefined ) { + + face[ f ] = index; + + } + + } + + } + + // check isolated points vertices against all points map + + for ( i = 0, il = isolatedPts.length; i < il; i ++ ) { + + face = isolatedPts[ i ]; + + for ( f = 0; f < 3; f ++ ) { + + key = face[ f ].x + ":" + face[ f ].y; + + index = allPointsMap[ key ]; + + if ( index !== undefined ) { + + face[ f ] = index; + + } + + } + + } + + return triangles.concat( isolatedPts ); + + }, // end triangulate shapes + + /* + triangulate2 : function( pts, holes ) { + + // For use with Poly2Tri.js + + var allpts = pts.concat(); + var shape = []; + for (var p in pts) { + shape.push(new js.poly2tri.Point(pts[p].x, pts[p].y)); + } + + var swctx = new js.poly2tri.SweepContext(shape); + + for (var h in holes) { + var aHole = holes[h]; + var newHole = [] + for (i in aHole) { + newHole.push(new js.poly2tri.Point(aHole[i].x, aHole[i].y)); + allpts.push(aHole[i]); + } + swctx.AddHole(newHole); + } + + var find; + var findIndexForPt = function (pt) { + find = new THREE.Vector2(pt.x, pt.y); + var p; + for (p=0, pl = allpts.length; p points.length - 2 ? points.length -1 : intPoint + 1; + c[ 3 ] = intPoint > points.length - 3 ? points.length -1 : intPoint + 2; - } + v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); + v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); - return { + return v; - shape:shape, /* shape with no holes */ - isolatedPts: verts, /* isolated faces */ - allpoints: allpoints +}; +/************************************************************** + * Ellipse curve + **************************************************************/ - } +THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, + aStartAngle, aEndAngle, + aClockwise ) { + this.aX = aX; + this.aY = aY; - }, + this.xRadius = xRadius; + this.yRadius = yRadius; - triangulateShape: function ( contour, holes ) { + this.aStartAngle = aStartAngle; + this.aEndAngle = aEndAngle; - var shapeWithoutHoles = THREE.Shape.Utils.removeHoles( contour, holes ); + this.aClockwise = aClockwise; - var shape = shapeWithoutHoles.shape, - allpoints = shapeWithoutHoles.allpoints, - isolatedPts = shapeWithoutHoles.isolatedPts; +}; - var triangles = THREE.FontUtils.Triangulate( shape, false ); // True returns indices for points of spooled shape +THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype ); - // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. +THREE.EllipseCurve.prototype.getPoint = function ( t ) { - //console.log( "triangles",triangles, triangles.length ); - //console.log( "allpoints",allpoints, allpoints.length ); + var deltaAngle = this.aEndAngle - this.aStartAngle; - var i, il, f, face, - key, index, - allPointsMap = {}, - isolatedPointsMap = {}; + if ( !this.aClockwise ) { - // prepare all points map + t = 1 - t; - for ( i = 0, il = allpoints.length; i < il; i ++ ) { + } - key = allpoints[ i ].x + ":" + allpoints[ i ].y; + var angle = this.aStartAngle + t * deltaAngle; - if ( allPointsMap[ key ] !== undefined ) { + var tx = this.aX + this.xRadius * Math.cos( angle ); + var ty = this.aY + this.yRadius * Math.sin( angle ); - console.log( "Duplicate point", key ); + return new THREE.Vector2( tx, ty ); - } +}; +/************************************************************** + * Arc curve + **************************************************************/ - allPointsMap[ key ] = i; +THREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - } + THREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); +}; - // check all face vertices against all points map +THREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype ); +/************************************************************** + * Line3D + **************************************************************/ - for ( i = 0, il = triangles.length; i < il; i ++ ) { +THREE.LineCurve3 = THREE.Curve.create( - face = triangles[ i ]; + function ( v1, v2 ) { - for ( f = 0; f < 3; f ++ ) { + this.v1 = v1; + this.v2 = v2; - key = face[ f ].x + ":" + face[ f ].y; + }, - index = allPointsMap[ key ]; + function ( t ) { - if ( index !== undefined ) { + var r = new THREE.Vector3(); - face[ f ] = index; - } + r.subVectors( this.v2, this.v1 ); // diff + r.multiplyScalar( t ); + r.add( this.v1 ); - } + return r; - } + } - // check isolated points vertices against all points map +); - for ( i = 0, il = isolatedPts.length; i < il; i ++ ) { +/************************************************************** + * Quadratic Bezier 3D curve + **************************************************************/ - face = isolatedPts[ i ]; +THREE.QuadraticBezierCurve3 = THREE.Curve.create( - for ( f = 0; f < 3; f ++ ) { + function ( v0, v1, v2 ) { - key = face[ f ].x + ":" + face[ f ].y; + this.v0 = v0; + this.v1 = v1; + this.v2 = v2; - index = allPointsMap[ key ]; + }, - if ( index !== undefined ) { + function ( t ) { - face[ f ] = index; + var tx, ty, tz; - } + tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); + ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); + tz = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z ); - } + return new THREE.Vector3( tx, ty, tz ); - } + } - return triangles.concat( isolatedPts ); +); +/************************************************************** + * Cubic Bezier 3D curve + **************************************************************/ - }, // end triangulate shapes +THREE.CubicBezierCurve3 = THREE.Curve.create( - /* - triangulate2 : function( pts, holes ) { + function ( v0, v1, v2, v3 ) { - // For use with Poly2Tri.js + this.v0 = v0; + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; - var allpts = pts.concat(); - var shape = []; - for (var p in pts) { - shape.push(new js.poly2tri.Point(pts[p].x, pts[p].y)); - } + }, - var swctx = new js.poly2tri.SweepContext(shape); + function ( t ) { - for (var h in holes) { - var aHole = holes[h]; - var newHole = [] - for (i in aHole) { - newHole.push(new js.poly2tri.Point(aHole[i].x, aHole[i].y)); - allpts.push(aHole[i]); - } - swctx.AddHole(newHole); - } + var tx, ty, tz; - var find; - var findIndexForPt = function (pt) { - find = new THREE.Vector2(pt.x, pt.y); - var p; - for (p=0, pl = allpts.length; p points.length - 2 ? points.length - 1 : intPoint + 1; + c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - return 2 * ( 1 - t ) * t * p; + var pt0 = points[ c[0] ], + pt1 = points[ c[1] ], + pt2 = points[ c[2] ], + pt3 = points[ c[3] ]; - }, + v.x = THREE.Curve.Utils.interpolate(pt0.x, pt1.x, pt2.x, pt3.x, weight); + v.y = THREE.Curve.Utils.interpolate(pt0.y, pt1.y, pt2.y, pt3.y, weight); + v.z = THREE.Curve.Utils.interpolate(pt0.z, pt1.z, pt2.z, pt3.z, weight); - b2p2: function ( t, p ) { + return v; - return t * t * p; + } - }, +); - b2: function ( t, p0, p1, p2 ) { - return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 ); +// THREE.SplineCurve3.prototype.getTangent = function(t) { +// var v = new THREE.Vector3(); +// var c = []; +// var points = this.points, point, intPoint, weight; +// point = ( points.length - 1 ) * t; - }, +// intPoint = Math.floor( point ); +// weight = point - intPoint; - // Cubic Bezier Functions +// c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; +// c[ 1 ] = intPoint; +// c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1; +// c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - b3p0: function ( t, p ) { +// var pt0 = points[ c[0] ], +// pt1 = points[ c[1] ], +// pt2 = points[ c[2] ], +// pt3 = points[ c[3] ]; - var k = 1 - t; - return k * k * k * p; +// // t = weight; +// v.x = THREE.Curve.Utils.tangentSpline( t, pt0.x, pt1.x, pt2.x, pt3.x ); +// v.y = THREE.Curve.Utils.tangentSpline( t, pt0.y, pt1.y, pt2.y, pt3.y ); +// v.z = THREE.Curve.Utils.tangentSpline( t, pt0.z, pt1.z, pt2.z, pt3.z ); - }, +// return v; - b3p1: function ( t, p ) { +// } +/************************************************************** + * Closed Spline 3D curve + **************************************************************/ - var k = 1 - t; - return 3 * k * k * t * p; - }, +THREE.ClosedSplineCurve3 = THREE.Curve.create( - b3p2: function ( t, p ) { + function ( points /* array of Vector3 */) { - var k = 1 - t; - return 3 * k * t * t * p; + this.points = (points == undefined) ? [] : points; }, - b3p3: function ( t, p ) { + function ( t ) { - return t * t * t * p; + var v = new THREE.Vector3(); + var c = []; + var points = this.points, point, intPoint, weight; + point = ( points.length - 0 ) * t; + // This needs to be from 0-length +1 - }, + intPoint = Math.floor( point ); + weight = point - intPoint; - b3: function ( t, p0, p1, p2, p3 ) { + intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; + c[ 0 ] = ( intPoint - 1 ) % points.length; + c[ 1 ] = ( intPoint ) % points.length; + c[ 2 ] = ( intPoint + 1 ) % points.length; + c[ 3 ] = ( intPoint + 2 ) % points.length; - return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) + this.b3p3( t, p3 ); + v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); + v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); + v.z = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].z, points[ c[ 1 ] ].z, points[ c[ 2 ] ].z, points[ c[ 3 ] ].z, weight ); - } + return v; -}; + } +); /** * @author mikael emtinger / http://gomo.se/ */ @@ -30099,6 +31302,7 @@ THREE.AnimationHandler = (function() { return that; }()); + /** * @author mikael emtinger / http://gomo.se/ * @author mrdoob / http://mrdoob.com/ @@ -30142,12 +31346,6 @@ THREE.Animation.prototype.play = function ( loop, startTimeMS ) { object = this.hierarchy[ h ]; - if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - object.useQuaternion = true; - - } - object.matrixAutoUpdate = true; if ( object.animationCache === undefined ) { @@ -30485,6 +31683,7 @@ THREE.Animation.prototype.getPrevKeyWith = function ( type, h, key ) { return this.data.hierarchy[ h ].keys[ keys.length - 1 ]; }; + /** * @author mikael emtinger / http://gomo.se/ * @author mrdoob / http://mrdoob.com/ @@ -30562,7 +31761,6 @@ THREE.KeyFrameAnimation.prototype.play = function( loop, startTimeMS ) { object = this.hierarchy[ h ]; node = this.data.hierarchy[ h ]; - object.useQuaternion = true; if ( node.animationCache === undefined ) { @@ -30908,6 +32106,7 @@ THREE.KeyFrameAnimation.prototype.getPrevKeyWith = function( sid, h, key ) { return keys[ keys.length - 1 ]; }; + /** * Camera for rendering cube maps * - renders scene into axis-aligned cube @@ -30985,6 +32184,7 @@ THREE.CubeCamera = function ( near, far, cubeResolution ) { }; THREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype ); + /* * @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog * @@ -31222,6 +32422,7 @@ THREE.CombinedCamera.prototype.toBottomView = function() { }; + /** * @author hughes */ @@ -31276,6 +32477,7 @@ THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) { }; THREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author mrdoob / http://mrdoob.com/ * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as @@ -31388,11 +32590,12 @@ THREE.CubeGeometry = function ( width, height, depth, widthSegments, heightSegme }; THREE.CubeGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author mrdoob / http://mrdoob.com/ */ -THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ) { +THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded ) { THREE.Geometry.call( this ); @@ -31400,7 +32603,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme this.radiusBottom = radiusBottom = radiusBottom !== undefined ? radiusBottom : 20; this.height = height = height !== undefined ? height : 100; - this.radiusSegments = radiusSegments = radiusSegments || 8; + this.radialSegments = radialSegments = radialSegments || 8; this.heightSegments = heightSegments = heightSegments || 1; this.openEnded = openEnded = openEnded !== undefined ? openEnded : false; @@ -31417,9 +32620,9 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme var v = y / heightSegments; var radius = v * ( radiusBottom - radiusTop ) + radiusTop; - for ( x = 0; x <= radiusSegments; x ++ ) { + for ( x = 0; x <= radialSegments; x ++ ) { - var u = x / radiusSegments; + var u = x / radialSegments; var vertex = new THREE.Vector3(); vertex.x = radius * Math.sin( u * Math.PI * 2 ); @@ -31441,7 +32644,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme var tanTheta = ( radiusBottom - radiusTop ) / height; var na, nb; - for ( x = 0; x < radiusSegments; x ++ ) { + for ( x = 0; x < radialSegments; x ++ ) { if ( radiusTop !== 0 ) { @@ -31488,7 +32691,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) ); - for ( x = 0; x < radiusSegments; x ++ ) { + for ( x = 0; x < radialSegments; x ++ ) { var v1 = vertices[ 0 ][ x ]; var v2 = vertices[ 0 ][ x + 1 ]; @@ -31515,7 +32718,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) ); - for ( x = 0; x < radiusSegments; x ++ ) { + for ( x = 0; x < radialSegments; x ++ ) { var v1 = vertices[ y ][ x + 1 ]; var v2 = vertices[ y ][ x ]; @@ -31542,6 +32745,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegme } THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author zz85 / http://www.lab4games.net/zz85/blog * @@ -32275,6 +33479,7 @@ THREE.ExtrudeGeometry.__v3 = new THREE.Vector2(); THREE.ExtrudeGeometry.__v4 = new THREE.Vector2(); THREE.ExtrudeGeometry.__v5 = new THREE.Vector2(); THREE.ExtrudeGeometry.__v6 = new THREE.Vector2(); + /** * @author jonobr1 / http://jonobr1.com * @@ -32411,6 +33616,7 @@ THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) { } }; + /** * @author astrodud / http://astrodud.isgreat.org/ * @author zz85 / https://github.com/zz85 @@ -32497,6 +33703,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { }; THREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author mrdoob / http://mrdoob.com/ * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as @@ -32570,6 +33777,7 @@ THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) }; THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author Kaleb Murphy */ @@ -32642,6 +33850,7 @@ THREE.RingGeometry = function ( innerRadius, outerRadius, thetaSegments, phiSegm }; THREE.RingGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author mrdoob / http://mrdoob.com/ */ @@ -32738,6 +33947,7 @@ THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStar }; THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author zz85 / http://www.lab4games.net/zz85/blog * @author alteredq / http://alteredqualia.com/ @@ -32797,6 +34007,7 @@ THREE.TextGeometry = function ( text, parameters ) { }; THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype ); + /** * @author oosmoxiecode * @author mrdoob / http://mrdoob.com/ @@ -32869,6 +34080,7 @@ THREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments, }; THREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author oosmoxiecode * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473 @@ -32896,31 +34108,29 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen for ( var i = 0; i < this.radialSegments; ++ i ) { this.grid[ i ] = new Array( this.tubularSegments ); + var u = i / this.radialSegments * 2 * this.p * Math.PI; + var p1 = getPos( u, this.q, this.p, this.radius, this.heightScale ); + var p2 = getPos( u + 0.01, this.q, this.p, this.radius, this.heightScale ); + tang.subVectors( p2, p1 ); + n.addVectors( p2, p1 ); + + bitan.crossVectors( tang, n ); + n.crossVectors( bitan, tang ); + bitan.normalize(); + n.normalize(); for ( var j = 0; j < this.tubularSegments; ++ j ) { - var u = i / this.radialSegments * 2 * this.p * Math.PI; var v = j / this.tubularSegments * 2 * Math.PI; - var p1 = getPos( u, v, this.q, this.p, this.radius, this.heightScale ); - var p2 = getPos( u + 0.01, v, this.q, this.p, this.radius, this.heightScale ); - var cx, cy; - - tang.subVectors( p2, p1 ); - n.addVectors( p2, p1 ); + var cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. + var cy = this.tube * Math.sin( v ); - bitan.crossVectors( tang, n ); - n.crossVectors( bitan, tang ); - bitan.normalize(); - n.normalize(); + var pos = new THREE.Vector3(); + pos.x = p1.x + cx * n.x + cy * bitan.x; + pos.y = p1.y + cx * n.y + cy * bitan.y; + pos.z = p1.z + cx * n.z + cy * bitan.z; - cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - cy = this.tube * Math.sin( v ); - - p1.x += cx * n.x + cy * bitan.x; - p1.y += cx * n.y + cy * bitan.y; - p1.z += cx * n.z + cy * bitan.z; - - this.grid[ i ][ j ] = vert( p1.x, p1.y, p1.z ); + this.grid[ i ][ j ] = scope.vertices.push( pos ) - 1; } @@ -32953,16 +34163,9 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen this.computeFaceNormals(); this.computeVertexNormals(); - function vert( x, y, z ) { - - return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1; - - } - - function getPos( u, v, in_q, in_p, radius, heightScale ) { + function getPos( u, in_q, in_p, radius, heightScale ) { var cu = Math.cos( u ); - var cv = Math.cos( v ); var su = Math.sin( u ); var quOverP = in_q / in_p * u; var cs = Math.cos( quOverP ); @@ -32978,6 +34181,7 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen }; THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author WestLangley / https://github.com/WestLangley * @author zz85 / https://github.com/zz85 @@ -32991,18 +34195,16 @@ THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype ); * http://www.cs.indiana.edu/pub/techreports/TR425.pdf */ -THREE.TubeGeometry = function( path, segments, radius, radiusSegments, closed, debug ) { +THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed ) { THREE.Geometry.call( this ); this.path = path; this.segments = segments || 64; this.radius = radius || 1; - this.radiusSegments = radiusSegments || 8; + this.radialSegments = radialSegments || 8; this.closed = closed || false; - if ( debug ) this.debug = new THREE.Object3D(); - this.grid = []; var scope = this, @@ -33055,17 +34257,9 @@ THREE.TubeGeometry = function( path, segments, radius, radiusSegments, closed, d normal = normals[ i ]; binormal = binormals[ i ]; - if ( this.debug ) { - - this.debug.add( new THREE.ArrowHelper(tangent, pos, radius, 0x0000ff ) ); - this.debug.add( new THREE.ArrowHelper(normal, pos, radius, 0xff0000 ) ); - this.debug.add( new THREE.ArrowHelper(binormal, pos, radius, 0x00ff00 ) ); + for ( j = 0; j < this.radialSegments; j++ ) { - } - - for ( j = 0; j < this.radiusSegments; j++ ) { - - v = j / this.radiusSegments * 2 * Math.PI; + v = j / this.radialSegments * 2 * Math.PI; cx = -this.radius * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. cy = this.radius * Math.sin( v ); @@ -33085,20 +34279,20 @@ THREE.TubeGeometry = function( path, segments, radius, radiusSegments, closed, d for ( i = 0; i < this.segments; i++ ) { - for ( j = 0; j < this.radiusSegments; j++ ) { + for ( j = 0; j < this.radialSegments; j++ ) { ip = ( this.closed ) ? (i + 1) % this.segments : i + 1; - jp = (j + 1) % this.radiusSegments; + jp = (j + 1) % this.radialSegments; a = this.grid[ i ][ j ]; // *** NOT NECESSARILY PLANAR ! *** b = this.grid[ ip ][ j ]; c = this.grid[ ip ][ jp ]; d = this.grid[ i ][ jp ]; - uva = new THREE.Vector2( i / this.segments, j / this.radiusSegments ); - uvb = new THREE.Vector2( ( i + 1 ) / this.segments, j / this.radiusSegments ); - uvc = new THREE.Vector2( ( i + 1 ) / this.segments, ( j + 1 ) / this.radiusSegments ); - uvd = new THREE.Vector2( i / this.segments, ( j + 1 ) / this.radiusSegments ); + uva = new THREE.Vector2( i / this.segments, j / this.radialSegments ); + uvb = new THREE.Vector2( ( i + 1 ) / this.segments, j / this.radialSegments ); + uvc = new THREE.Vector2( ( i + 1 ) / this.segments, ( j + 1 ) / this.radialSegments ); + uvd = new THREE.Vector2( i / this.segments, ( j + 1 ) / this.radialSegments ); this.faces.push( new THREE.Face4( a, b, c, d ) ); this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvc, uvd ] ); @@ -33224,7 +34418,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) { vec.normalize(); - theta = Math.acos( tangents[ i-1 ].dot( tangents[ i ] ) ); + theta = Math.acos( THREE.Math.clamp( tangents[ i-1 ].dot( tangents[ i ] ), -1, 1 ) ); // clamp for floating pt errors normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); @@ -33239,7 +34433,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) { if ( closed ) { - theta = Math.acos( normals[ 0 ].dot( normals[ numpoints-1 ] ) ); + theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints-1 ] ), -1, 1 ) ); theta /= ( numpoints - 1 ); if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints-1 ] ) ) > 0 ) { @@ -33258,6 +34452,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) { } }; + /** * @author clockworkgeek / https://github.com/clockworkgeek * @author timothypratley / https://github.com/timothypratley @@ -33323,11 +34518,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } - // Merge vertices - - this.mergeVertices(); - - // Apply radius for ( var i = 0, l = this.vertices.length; i < l; i ++ ) { @@ -33337,6 +34527,17 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } + // Merge vertices + + this.mergeVertices(); + + this.computeCentroids(); + + this.computeFaceNormals(); + + this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); + + // Project vector onto sphere's surface function prepare( vector ) { @@ -33361,7 +34562,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); - face.normal.copy( face.centroid ).normalize(); that.faces.push( face ); var azi = azimuth( face.centroid ); @@ -33473,13 +34673,11 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } - this.computeCentroids(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); }; THREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author timothypratley / https://github.com/timothypratley */ @@ -33509,6 +34707,7 @@ THREE.IcosahedronGeometry = function ( radius, detail ) { }; THREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author timothypratley / https://github.com/timothypratley */ @@ -33527,6 +34726,7 @@ THREE.OctahedronGeometry = function ( radius, detail ) { }; THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author timothypratley / https://github.com/timothypratley */ @@ -33546,6 +34746,7 @@ THREE.TetrahedronGeometry = function ( radius, detail ) { }; THREE.TetrahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); + /** * @author zz85 / https://github.com/zz85 * Parametric Surfaces Geometry @@ -33634,229 +34835,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) { }; THREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype ); -/** - * @author qiao / https://github.com/qiao - * @fileoverview This is a convex hull generator using the incremental method. - * The complexity is O(n^2) where n is the number of vertices. - * O(nlogn) algorithms do exist, but they are much more complicated. - * - * Benchmark: - * - * Platform: CPU: P7350 @2.00GHz Engine: V8 - * - * Num Vertices Time(ms) - * - * 10 1 - * 20 3 - * 30 19 - * 40 48 - * 50 107 - */ - -THREE.ConvexGeometry = function( vertices ) { - - THREE.Geometry.call( this ); - - var faces = [ [ 0, 1, 2 ], [ 0, 2, 1 ] ]; - - for ( var i = 3; i < vertices.length; i++ ) { - - addPoint( i ); - - } - - - function addPoint( vertexId ) { - - var vertex = vertices[ vertexId ].clone(); - var mag = vertex.length(); - vertex.x += mag * randomOffset(); - vertex.y += mag * randomOffset(); - vertex.z += mag * randomOffset(); - - var hole = []; - - for ( var f = 0; f < faces.length; ) { - - var face = faces[ f ]; - - // for each face, if the vertex can see it, - // then we try to add the face's edges into the hole. - if ( visible( face, vertex ) ) { - - for ( var e = 0; e < 3; e++ ) { - - var edge = [ face[ e ], face[ ( e + 1 ) % 3 ] ]; - var boundary = true; - - // remove duplicated edges. - for ( var h = 0; h < hole.length; h++ ) { - - if ( equalEdge( hole[ h ], edge ) ) { - - hole[ h ] = hole[ hole.length - 1 ]; - hole.pop(); - boundary = false; - break; - - } - - } - - if ( boundary ) { - - hole.push( edge ); - - } - - } - - // remove faces[ f ] - faces[ f ] = faces[ faces.length - 1 ]; - faces.pop(); - - } else { // not visible - - f++; - - } - } - - // construct the new faces formed by the edges of the hole and the vertex - for ( var h = 0; h < hole.length; h++ ) { - - faces.push( [ - hole[ h ][ 0 ], - hole[ h ][ 1 ], - vertexId - ] ); - - } - } - - /** - * Whether the face is visible from the vertex - */ - function visible( face, vertex ) { - - var va = vertices[ face[ 0 ] ]; - var vb = vertices[ face[ 1 ] ]; - var vc = vertices[ face[ 2 ] ]; - - var n = normal( va, vb, vc ); - - // distance from face to origin - var dist = n.dot( va ); - - return n.dot( vertex ) >= dist; - - } - - /** - * Face normal - */ - function normal( va, vb, vc ) { - - var cb = new THREE.Vector3(); - var ab = new THREE.Vector3(); - - cb.subVectors( vc, vb ); - ab.subVectors( va, vb ); - cb.cross( ab ); - - cb.normalize(); - - return cb; - - } - - /** - * Detect whether two edges are equal. - * Note that when constructing the convex hull, two same edges can only - * be of the negative direction. - */ - function equalEdge( ea, eb ) { - - return ea[ 0 ] === eb[ 1 ] && ea[ 1 ] === eb[ 0 ]; - - } - - /** - * Create a random offset between -1e-6 and 1e-6. - */ - function randomOffset() { - - return ( Math.random() - 0.5 ) * 2 * 1e-6; - - } - - - /** - * XXX: Not sure if this is the correct approach. Need someone to review. - */ - function vertexUv( vertex ) { - - var mag = vertex.length(); - return new THREE.Vector2( vertex.x / mag, vertex.y / mag ); - - } - - // Push vertices into `this.vertices`, skipping those inside the hull - var id = 0; - var newId = new Array( vertices.length ); // map from old vertex id to new id - - for ( var i = 0; i < faces.length; i++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j++ ) { - - if ( newId[ face[ j ] ] === undefined ) { - - newId[ face[ j ] ] = id++; - this.vertices.push( vertices[ face[ j ] ] ); - - } - - face[ j ] = newId[ face[ j ] ]; - - } - - } - - // Convert faces into instances of THREE.Face3 - for ( var i = 0; i < faces.length; i++ ) { - - this.faces.push( new THREE.Face3( - faces[ i ][ 0 ], - faces[ i ][ 1 ], - faces[ i ][ 2 ] - ) ); - - } - - // Compute UVs - for ( var i = 0; i < this.faces.length; i++ ) { - - var face = this.faces[ i ]; - - this.faceVertexUvs[ 0 ].push( [ - vertexUv( this.vertices[ face.a ] ), - vertexUv( this.vertices[ face.b ] ), - vertexUv( this.vertices[ face.c ]) - ] ); - - } - - - this.computeCentroids(); - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.ConvexGeometry.prototype = Object.create( THREE.Geometry.prototype ); /** * @author sroucheray / http://sroucheray.org/ * @author mrdoob / http://mrdoob.com/ @@ -33887,6 +34866,7 @@ THREE.AxisHelper = function ( size ) { }; THREE.AxisHelper.prototype = Object.create( THREE.Line.prototype ); + /** * @author WestLangley / http://github.com/WestLangley * @author zz85 / http://github.com/zz85 @@ -33912,8 +34892,6 @@ THREE.ArrowHelper = function ( dir, origin, length, hex ) { this.position = origin; - this.useQuaternion = true; - var lineGeometry = new THREE.Geometry(); lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) ); lineGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) ); @@ -33945,11 +34923,11 @@ THREE.ArrowHelper.prototype.setDirection = function () { // dir is assumed to be normalized - if ( dir.y > 0.999 ) { + if ( dir.y > 0.99999 ) { this.quaternion.set( 0, 0, 0, 1 ); - } else if ( dir.y < - 0.999 ) { + } else if ( dir.y < - 0.99999 ) { this.quaternion.set( 1, 0, 0, 0 ); @@ -33979,15 +34957,12 @@ THREE.ArrowHelper.prototype.setColor = function ( hex ) { this.cone.material.color.setHex( hex ); }; + /** * @author mrdoob / http://mrdoob.com/ */ -THREE.BoxHelper = function ( size ) { - - size = size || 1; - - var geometry = new THREE.Geometry(); +THREE.BoxHelper = function ( object ) { // 5____4 // 1/___0/| @@ -33995,19 +34970,22 @@ THREE.BoxHelper = function ( size ) { // 2/___3/ var vertices = [ - new THREE.Vector3( size, size, size ), - new THREE.Vector3( - size, size, size ), - new THREE.Vector3( - size, - size, size ), - new THREE.Vector3( size, - size, size ), - - new THREE.Vector3( size, size, - size ), - new THREE.Vector3( - size, size, - size ), - new THREE.Vector3( - size, - size, - size ), - new THREE.Vector3( size, - size, - size ) + new THREE.Vector3( 1, 1, 1 ), + new THREE.Vector3( - 1, 1, 1 ), + new THREE.Vector3( - 1, - 1, 1 ), + new THREE.Vector3( 1, - 1, 1 ), + + new THREE.Vector3( 1, 1, - 1 ), + new THREE.Vector3( - 1, 1, - 1 ), + new THREE.Vector3( - 1, - 1, - 1 ), + new THREE.Vector3( 1, - 1, - 1 ) ]; + this.vertices = vertices; + // TODO: Wouldn't be nice if Line had .segments? + var geometry = new THREE.Geometry(); geometry.vertices.push( vertices[ 0 ], vertices[ 1 ], vertices[ 1 ], vertices[ 2 ], @@ -34025,9 +35003,13 @@ THREE.BoxHelper = function ( size ) { vertices[ 3 ], vertices[ 7 ] ); - this.vertices = vertices; + THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces ); - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial(), THREE.LinePieces ); + if ( object !== undefined ) { + + this.update( object ); + + } }; @@ -34063,6 +35045,37 @@ THREE.BoxHelper.prototype.update = function ( object ) { this.matrixWorld = object.matrixWorld; }; + +/** + * @author WestLangley / http://github.com/WestLangley + */ + +// a helper to show the world-axis-aligned bounding box for an object + +THREE.BoundingBoxHelper = function ( object, hex ) { + + var color = hex || 0x888888; + + this.object = object; + + this.box = new THREE.Box3(); + + THREE.Mesh.call( this, new THREE.CubeGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) ); + +}; + +THREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype ); + +THREE.BoundingBoxHelper.prototype.update = function () { + + this.box.setFromObject( this.object ); + + this.box.size( this.scale ); + + this.box.center( this.position ); + +}; + /** * @author alteredq / http://alteredqualia.com/ * @@ -34074,8 +35087,6 @@ THREE.BoxHelper.prototype.update = function ( object ) { THREE.CameraHelper = function ( camera ) { - THREE.Line.call( this ); - var geometry = new THREE.Geometry(); var material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } ); @@ -34250,59 +35261,143 @@ THREE.CameraHelper.prototype.update = function () { }; }(); + /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ */ -THREE.DirectionalLightHelper = function ( light, sphereSize ) { +THREE.DirectionalLightHelper = function ( light, size ) { THREE.Object3D.call( this ); - this.matrixAutoUpdate = false; - this.light = light; + this.light.updateMatrixWorld(); - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + this.matrixWorld = light.matrixWorld; + this.matrixAutoUpdate = false; - this.lightSphere = new THREE.Mesh( geometry, material ); - this.lightSphere.matrixWorld = this.light.matrixWorld; - this.lightSphere.matrixAutoUpdate = false; - this.add( this.lightSphere ); + var geometry = new THREE.PlaneGeometry( size, size ); + var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); + material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - /* - this.targetSphere = new THREE.Mesh( geometry, material ); - this.targetSphere.position = this.light.target.position; - this.add( this.targetSphere ); - */ + this.lightPlane = new THREE.Mesh( geometry, material ); + this.add( this.lightPlane ); geometry = new THREE.Geometry(); - geometry.vertices.push( this.light.position ); - geometry.vertices.push( this.light.target.position ); + geometry.vertices.push( new THREE.Vector3() ); + geometry.vertices.push( new THREE.Vector3() ); geometry.computeLineDistances(); - material = new THREE.LineDashedMaterial( { dashSize: 4, gapSize: 4, opacity: 0.75, transparent: true, fog: false } ); + material = new THREE.LineBasicMaterial( { fog: false } ); material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); this.targetLine = new THREE.Line( geometry, material ); this.add( this.targetLine ); -} + this.update(); + +}; THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype ); THREE.DirectionalLightHelper.prototype.update = function () { - this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + var vector = new THREE.Vector3(); + + return function () { + + vector.getPositionFromMatrix( this.light.matrixWorld ).negate(); + + this.lightPlane.lookAt( vector ); + this.lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.targetLine.geometry.computeLineDistances(); - this.targetLine.geometry.verticesNeedUpdate = true; - this.targetLine.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + this.targetLine.geometry.vertices[ 1 ].copy( vector ); + this.targetLine.geometry.verticesNeedUpdate = true; + this.targetLine.material.color.copy( this.lightPlane.material.color ); + + } + +}(); + + +/** + * @author mrdoob / http://mrdoob.com/ + * @author WestLangley / http://github.com/WestLangley +*/ + +THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) { + + this.object = object; + + this.size = size || 1; + + var color = hex || 0xffff00; + + var width = linewidth || 1; + + var geometry = new THREE.Geometry(); + + var faces = this.object.geometry.faces; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + geometry.vertices.push( new THREE.Vector3() ); + geometry.vertices.push( new THREE.Vector3() ); + + } + + THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); + + this.matrixAutoUpdate = false; + + this.normalMatrix = new THREE.Matrix3(); + + this.update(); }; +THREE.FaceNormalsHelper.prototype = Object.create( THREE.Line.prototype ); + +THREE.FaceNormalsHelper.prototype.update = ( function ( object ) { + + var v1 = new THREE.Vector3(); + + return function ( object ) { + + this.object.updateMatrixWorld( true ); + + this.normalMatrix.getNormalMatrix( this.object.matrixWorld ); + + var vertices = this.geometry.vertices; + + var faces = this.object.geometry.faces; + + var worldMatrix = this.object.matrixWorld; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + + v1.copy( face.normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ); + + var idx = 2 * i; + + vertices[ idx ].copy( face.centroid ).applyMatrix4( worldMatrix ); + + vertices[ idx + 1 ].addVectors( vertices[ idx ], v1 ); + + } + + this.geometry.verticesNeedUpdate = true; + + return this; + + } + +}()); + + /** * @author mrdoob / http://mrdoob.com/ */ @@ -34311,17 +35406,18 @@ THREE.GridHelper = function ( size, step ) { var geometry = new THREE.Geometry(); var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); - var color1 = new THREE.Color( 0x444444 ), color2 = new THREE.Color( 0x888888 ); - for ( var i = - size; i <= size; i += step ) { + this.color1 = new THREE.Color( 0x444444 ); + this.color2 = new THREE.Color( 0x888888 ); - geometry.vertices.push( new THREE.Vector3( -size, 0, i ) ); - geometry.vertices.push( new THREE.Vector3( size, 0, i ) ); + for ( var i = - size; i <= size; i += step ) { - geometry.vertices.push( new THREE.Vector3( i, 0, -size ) ); - geometry.vertices.push( new THREE.Vector3( i, 0, size ) ); + geometry.vertices.push( + new THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ), + new THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size ) + ); - var color = i === 0 ? color1 : color2; + var color = i === 0 ? this.color1 : this.color2; geometry.colors.push( color, color, color, color ); @@ -34332,6 +35428,16 @@ THREE.GridHelper = function ( size, step ) { }; THREE.GridHelper.prototype = Object.create( THREE.Line.prototype ); + +THREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) { + + this.color1.set( colorCenterLine ); + this.color2.set( colorGrid ); + + this.geometry.colorsNeedUpdate = true; + +} + /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ @@ -34342,39 +35448,49 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz THREE.Object3D.call( this ); this.light = light; + this.light.updateMatrixWorld(); + + this.matrixWorld = light.matrixWorld; + this.matrixAutoUpdate = false; + + this.colors = [ new THREE.Color(), new THREE.Color() ]; var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); for ( var i = 0, il = 8; i < il; i ++ ) { - geometry.faces[ i ].materialIndex = i < 4 ? 0 : 1; + geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ]; } - var materialSky = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } ); - materialSky.color.copy( light.color ).multiplyScalar( light.intensity ); + var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, wireframe: true } ); - var materialGround = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } ); - materialGround.color.copy( light.groundColor ).multiplyScalar( light.intensity ); - - this.lightSphere = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( [ materialSky, materialGround ] ) ); - this.lightSphere.position = light.position; - this.lightSphere.lookAt( new THREE.Vector3() ); + this.lightSphere = new THREE.Mesh( geometry, material ); this.add( this.lightSphere ); + this.update(); + }; THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype ); THREE.HemisphereLightHelper.prototype.update = function () { - this.lightSphere.lookAt( new THREE.Vector3() ); + var vector = new THREE.Vector3(); + + return function () { - this.lightSphere.material.materials[ 0 ].color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.lightSphere.material.materials[ 1 ].color.copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); + this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity ); + this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); + + this.lightSphere.lookAt( vector.getPositionFromMatrix( this.light.matrixWorld ).negate() ); + this.lightSphere.geometry.colorsNeedUpdate = true; + + } + +}(); -}; /** * @author alteredq / http://alteredqualia.com/ @@ -34383,20 +35499,17 @@ THREE.HemisphereLightHelper.prototype.update = function () { THREE.PointLightHelper = function ( light, sphereSize ) { - THREE.Object3D.call( this ); - - this.matrixAutoUpdate = false; - this.light = light; + this.light.updateMatrixWorld(); var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } ); + var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.lightSphere = new THREE.Mesh( geometry, material ); - this.lightSphere.matrixWorld = this.light.matrixWorld; - this.lightSphere.matrixAutoUpdate = false; - this.add( this.lightSphere ); + THREE.Mesh.call( this, geometry, material ); + + this.matrixWorld = this.light.matrixWorld; + this.matrixAutoUpdate = false; /* var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); @@ -34422,15 +35535,13 @@ THREE.PointLightHelper = function ( light, sphereSize ) { }; -THREE.PointLightHelper.prototype = Object.create( THREE.Object3D.prototype ); +THREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype ); THREE.PointLightHelper.prototype.update = function () { - this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); /* - this.lightDistance.material.color.copy( this.color ); - var d = this.light.distance; if ( d === 0.0 ) { @@ -34447,63 +35558,306 @@ THREE.PointLightHelper.prototype.update = function () { }; + /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ * @author WestLangley / http://github.com/WestLangley */ -THREE.SpotLightHelper = function ( light, sphereSize ) { +THREE.SpotLightHelper = function ( light ) { THREE.Object3D.call( this ); - this.matrixAutoUpdate = false; - this.light = light; + this.light.updateMatrixWorld(); - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + this.matrixWorld = light.matrixWorld; + this.matrixAutoUpdate = false; - this.lightSphere = new THREE.Mesh( geometry, material ); - this.lightSphere.matrixWorld = this.light.matrixWorld; - this.lightSphere.matrixAutoUpdate = false; - this.add( this.lightSphere ); + var geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true ); - geometry = new THREE.CylinderGeometry( 0.0001, 1, 1, 8, 1, true ); geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, -0.5, 0 ) ); geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); - material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true, opacity: 0.3, transparent: true } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); + + this.cone = new THREE.Mesh( geometry, material ); + this.add( this.cone ); + + this.update(); + +}; + +THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype ); + +THREE.SpotLightHelper.prototype.update = function () { + + var vector = new THREE.Vector3(); - this.lightCone = new THREE.Mesh( geometry, material ); - this.lightCone.position = this.light.position; + return function () { + + var coneLength = this.light.distance ? this.light.distance : 10000; + var coneWidth = coneLength * Math.tan( this.light.angle ); + + this.cone.scale.set( coneWidth, coneWidth, coneLength ); + + this.cone.lookAt( vector.getPositionFromMatrix( this.light.matrixWorld ).negate() ); + + this.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - var coneLength = light.distance ? light.distance : 10000; - var coneWidth = coneLength * Math.tan( light.angle ); + } + +}(); - this.lightCone.scale.set( coneWidth, coneWidth, coneLength ); - this.lightCone.lookAt( this.light.target.position ); +/** + * @author mrdoob / http://mrdoob.com/ + * @author WestLangley / http://github.com/WestLangley +*/ + +THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) { + + this.object = object; + + this.size = size || 1; + + var color = hex || 0xff0000; + + var width = linewidth || 1; + + var geometry = new THREE.Geometry(); - this.add( this.lightCone ); + var vertices = object.geometry.vertices; + + var faces = object.geometry.faces; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + + for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { + + geometry.vertices.push( new THREE.Vector3() ); + geometry.vertices.push( new THREE.Vector3() ); + + } + + } + + THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); + + this.matrixAutoUpdate = false; + + this.normalMatrix = new THREE.Matrix3(); + + this.update(); }; -THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype ); +THREE.VertexNormalsHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.SpotLightHelper.prototype.update = function () { +THREE.VertexNormalsHelper.prototype.update = ( function ( object ) { + + var v1 = new THREE.Vector3(); + + return function( object ) { + + var keys = [ 'a', 'b', 'c', 'd' ]; + + this.object.updateMatrixWorld( true ); + + this.normalMatrix.getNormalMatrix( this.object.matrixWorld ); + + var vertices = this.geometry.vertices; + + var verts = this.object.geometry.vertices; + + var faces = this.object.geometry.faces; + + var worldMatrix = this.object.matrixWorld; + + var idx = 0; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + + for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { + + var vertexId = face[ keys[ j ] ]; + var vertex = verts[ vertexId ]; + + var normal = face.vertexNormals[ j ]; + + vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); + + v1.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ); + + v1.add( vertices[ idx ] ); + idx = idx + 1; + + vertices[ idx ].copy( v1 ); + idx = idx + 1; + + } + + } + + this.geometry.verticesNeedUpdate = true; + + return this; + + } + +}()); + +/** + * @author mrdoob / http://mrdoob.com/ + * @author WestLangley / http://github.com/WestLangley +*/ + +THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) { + + this.object = object; + + this.size = size || 1; + + var color = hex || 0x0000ff; + + var width = linewidth || 1; + + var geometry = new THREE.Geometry(); + + var vertices = object.geometry.vertices; + + var faces = object.geometry.faces; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + + for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { + + geometry.vertices.push( new THREE.Vector3() ); + geometry.vertices.push( new THREE.Vector3() ); + + } + + } + + THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); + + this.matrixAutoUpdate = false; + + this.update(); + +}; + +THREE.VertexTangentsHelper.prototype = Object.create( THREE.Line.prototype ); + +THREE.VertexTangentsHelper.prototype.update = ( function ( object ) { + + var v1 = new THREE.Vector3(); + + return function( object ) { + + var keys = [ 'a', 'b', 'c', 'd' ]; + + this.object.updateMatrixWorld( true ); + + var vertices = this.geometry.vertices; + + var verts = this.object.geometry.vertices; + + var faces = this.object.geometry.faces; + + var worldMatrix = this.object.matrixWorld; + + var idx = 0; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + + for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { + + var vertexId = face[ keys[ j ] ]; + var vertex = verts[ vertexId ]; + + var tangent = face.vertexTangents[ j ]; + + vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); + + v1.copy( tangent ).transformDirection( worldMatrix ).multiplyScalar( this.size ); + + v1.add( vertices[ idx ] ); + idx = idx + 1; + + vertices[ idx ].copy( v1 ); + idx = idx + 1; + + } + + } + + this.geometry.verticesNeedUpdate = true; + + return this; + + } + +}()); - var coneLength = this.light.distance ? this.light.distance : 10000; - var coneWidth = coneLength * Math.tan( this.light.angle ); +/** + * @author mrdoob / http://mrdoob.com/ + */ + +THREE.WireframeHelper = function ( object ) { + + var edge = [ 0, 0 ], hash = {}; + var sortFunction = function ( a, b ) { return a - b }; + + var keys = [ 'a', 'b', 'c', 'd' ]; + var geometry = new THREE.Geometry(); + + var vertices = object.geometry.vertices; + var faces = object.geometry.faces; + + for ( var i = 0, l = faces.length; i < l; i ++ ) { + + var face = faces[ i ]; + var length = face instanceof THREE.Face4 ? 4 : 3; + + for ( var j = 0; j < length; j ++ ) { + + edge[ 0 ] = face[ keys[ j ] ]; + edge[ 1 ] = face[ keys[ ( j + 1 ) % length ] ]; + edge.sort( sortFunction ); + + var key = edge.toString(); + + if ( hash[ key ] === undefined ) { + + geometry.vertices.push( vertices[ edge[ 0 ] ] ); + geometry.vertices.push( vertices[ edge[ 1 ] ] ); + + hash[ key ] = true; + + } - this.lightCone.scale.set( coneWidth, coneWidth, coneLength ); - this.lightCone.lookAt( this.light.target.position ); + } + + } - this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.lightCone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); + THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffffff } ), THREE.LinePieces ); + + this.matrixAutoUpdate = false; + this.matrixWorld = object.matrixWorld; }; + +THREE.WireframeHelper.prototype = Object.create( THREE.Line.prototype ); + /** * @author alteredq / http://alteredqualia.com/ */ @@ -34517,6 +35871,7 @@ THREE.ImmediateRenderObject = function () { }; THREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype ); + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -34606,6 +35961,7 @@ THREE.LensFlare.prototype.updateLensFlares = function () { + /** * @author alteredq / http://alteredqualia.com/ */ @@ -34913,6 +36269,7 @@ THREE.MorphBlendMesh.prototype.update = function ( delta ) { } }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -35216,6 +36573,7 @@ THREE.LensFlarePlugin = function () { }; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -35712,6 +37070,7 @@ THREE.ShadowMapPlugin = function () { }; THREE.ShadowMapPlugin.__projector = new THREE.Projector(); + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -36017,6 +37376,7 @@ THREE.SpritePlugin = function () { }; }; + /** * @author alteredq / http://alteredqualia.com/ */ @@ -36217,9 +37577,9 @@ THREE.DepthPassPlugin = function () { }; + /** * @author mikael emtinger / http://gomo.se/ - * */ THREE.ShaderFlares = { @@ -36250,20 +37610,20 @@ THREE.ShaderFlares = { "if( renderType == 2 ) {", - "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +", - "texture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +", - "texture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +", - "texture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +", - "texture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +", - "texture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +", - "texture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +", - "texture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +", - "texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", - - "vVisibility = ( visibility.r / 9.0 ) *", - "( 1.0 - visibility.g / 9.0 ) *", - "( visibility.b / 9.0 ) *", - "( 1.0 - visibility.a / 9.0 );", + "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );", + "visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", + + "vVisibility = visibility.r / 9.0;", + "vVisibility *= 1.0 - visibility.g / 9.0;", + "vVisibility *= visibility.b / 9.0;", + "vVisibility *= 1.0 - visibility.a / 9.0;", "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", @@ -36383,11 +37743,10 @@ THREE.ShaderFlares = { "} else {", - "float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +", - "texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +", - "texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +", - "texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;", - + "float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;", + "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;", + "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;", + "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;", "visibility = ( 1.0 - visibility / 4.0 );", "vec4 texture = texture2D( map, vUV );", @@ -36404,6 +37763,7 @@ THREE.ShaderFlares = { } }; + /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ @@ -36512,3 +37872,4 @@ THREE.ShaderSprite = { } }; + diff --git a/build/three.min.js b/build/three.min.js index 9f9b82b686..2ab97e4d63 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,17 +1,16 @@ // three.js - http://github.com/mrdoob/three.js -'use strict';var THREE=THREE||{REVISION:"58"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")}; -THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d>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(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1c?b:c<2/3?a+6*(b-a)*(2/3-c):a},b=0.5>=c?c*(1+b):c+b-c*b,c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),this.r=Math.min(100, parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g=a.g;this.b= a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255* -this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(){var a={h:0,s:0,l:0};return function(){var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var i=e-f,f=0.5>=h?i/(e+f):i/(2-e-f);switch(e){case b:g=(c-d)/i+(c=g?i/(e+f):i/(2-e-f);switch(e){case b:h=(c-d)/i+(cf&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.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=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize(); -return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},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);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), -this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+f*g+d*i-e*h;this.y=d*j+f*h+e*g-c*i;this.z=e*j+f*i+c*h-d*g;this.w=f*j-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){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.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;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;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){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; +tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}; +THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,_euler:void 0,_updateEuler:function(){void 0!==this._euler&&this._euler.setFromQuaternion(this,void 0,!1)},get x(){return this._x},set x(a){this._x=a;this._updateEuler()},get y(){return this._y},set y(a){this._y=a;this._updateEuler()},get z(){return this._z},set z(a){this._z=a;this._updateEuler()},get w(){return this._w},set w(a){this._w=a;this._updateEuler()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d; +this._updateEuler();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._w=a._w;this._updateEuler();return this},setFromEuler:function(a,b){void 0===typeof a.order&&console.error("ERROR: Quaternion's .setFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");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),h=Math.sin(a._y/2),g=Math.sin(a._z/2);void 0===a.order||"XYZ"===a.order?(this._x=f*d*e+c*h*g, +this._y=c*h*e-f*d*g,this._z=c*d*g+f*h*e,this._w=c*d*e-f*h*g):"YXZ"===a.order?(this._x=f*d*e+c*h*g,this._y=c*h*e-f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e+f*h*g):"ZXY"===a.order?(this._x=f*d*e-c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g+f*h*e,this._w=c*d*e-f*h*g):"ZYX"===a.order?(this._x=f*d*e-c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e+f*h*g):"YZX"===a.order?(this._x=f*d*e+c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e-f*h*g):"XZY"===a.order&&(this._x=f*d*e-c*h*g,this._y=c* +h*e-f*d*g,this._z=c*d*g+f*h*e,this._w=c*d*e+f*h*g);!1!==b&&this._updateEuler();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._updateEuler();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],g=b[2],i=b[6],b=b[10],j=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(i-h)/ +c,this._x=0.25*c,this._y=(a+e)/c,this._z=(d+g)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-g)/c,this._x=(a+e)/c,this._y=0.25*c,this._z=(h+i)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+g)/c,this._y=(h+i)/c,this._z=0.25*c);this._updateEuler();return this},inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._updateEuler();return this},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);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a, +b){var c=a._x,d=a._y,e=a._z,f=a._w,h=b._x,g=b._y,i=b._z,j=b._w;this._x=c*j+f*h+d*i-e*g;this._y=d*j+f*g+e*h-c*i;this._z=e*j+f*i+c*g-d*h;this._w=f*j-c*h-d*g-e*i;this._updateEuler();return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this._x,d=this._y,e=this._z,f=this._w,h=f*a._w+c*a._x+d*a._y+e*a._z;0>h?(this._w=-a._w,this._x= +-a._x,this._y=-a._y,this._z=-a._z,h=-h):this.copy(a);if(1<=h)return this._w=f,this._x=c,this._y=d,this._z=e,this;var g=Math.acos(h),i=Math.sqrt(1-h*h);if(0.001>Math.abs(i))return this._w=0.5*(f+this._w),this._x=0.5*(c+this._x),this._y=0.5*(d+this._y),this._z=0.5*(e+this._z),this;h=Math.sin((1-b)*g)/i;g=Math.sin(b*g)/i;this._w=f*h+this._w*g;this._x=c*h+this._x*g;this._y=d*h+this._y*g;this._z=e*h+this._z*g;this._updateEuler();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){this._x=a[0];this._y=a[1];this._z=a[2];this._w=a[3];this._updateEuler();return this},toArray:function(){return[this._x,this._y,this._z,this._w]},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;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);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .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},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .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},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a):this.set(0,0);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);return this}, -negate:function(){return this.multiplyScalar(-1)},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)},normalize:function(){return this.divideScalar(this.length())},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},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/ +a.y;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y); +return this},negate:function(){return this.multiplyScalar(-1)},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)},normalize:function(){return this.divideScalar(this.length())},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},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/ b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a){this.x=a[0];this.y=a[1];return this},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;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);}},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);}},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("DEPRECATED: Vector3's .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},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .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},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("DEPRECATED: Vector3's .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){this.x*=a;this.y*=a;this.z*=a;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},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},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]); -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;return this},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,h=a*b+f*d-g*c,i=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-j*-f;this.y=i*a+b*-f+j*-e-h*-g;this.z=j*a+b*-g+h*-f-i*-e;return this},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;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},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){var b= -this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},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},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .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){this.x=a.y*b.z-a.z*b.y;this.y= -a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.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},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],m=d[2],p=d[6],d=d[10];void 0===b||"XYZ"=== -b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(p,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-m,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(p)),0.99999>Math.abs(p)?(this.y=Math.atan2(-m,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this.x=Math.atan2(p,d),this.z=Math.atan2(h, -e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(p,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2* -(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x* -a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b= -this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];return this},toArray:function(){return[this.x, -this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}}; -THREE.extend(THREE.Vector3.prototype,{applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),projectOnVector:function(){var a=new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3; -return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}()});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; +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;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,h=a.z,a=a.w,g=a*b+f*d-h*c,i=a*c+h*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-h*d;this.x=g*a+b*-e+i*-h-j*-f;this.y=i*a+b*-f+j*-e-g*-h;this.z=j*a+b*-h+g*-f-i*-e;return this},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;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.xb.x&&(this.x=b.x);this.y< +a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},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){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},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},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .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){this.x= +a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.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},setEulerFromRotationMatrix:function(){console.error("REMOVED: Vector3's setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code.")}, +setEulerFromQuaternion:function(){console.error("REMOVED: Vector3's setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code.")},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length(); +this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];return this},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}}; +THREE.extend(THREE.Vector3.prototype,{applyEuler:function(){var a=new THREE.Quaternion;return function(b){void 0===typeof b.order&&console.error("ERROR: Vector3's .applyEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");b=a.setFromEuler(b);this.applyQuaternion(b);return this}}(),applyAxisAngle:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),projectOnVector:function(){var a= +new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}()});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;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);}},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);}},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("DEPRECATED: Vector4's .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},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .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},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){this.x*=a;this.y*=a;this.z*=a;this.w*=a;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){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},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,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781, -c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},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* +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){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},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,e=a[0];d=a[4];var f=a[8],h=a[1],g=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-h)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+h)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+g+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;g=(g+1)/2;j=(j+1)/2;d=(d+h)/4;f=(f+c)/4;i=(i+b)/4;e>g&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):g>j?0.01>g? +(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(g),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(h-d)*(h-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+g+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},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){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},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},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&& -a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; +a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ"; +THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,_quaternion:void 0,_updateQuaternion:function(){void 0!==this._quaternion&&this._quaternion.setFromEuler(this,!1)},get x(){return this._x},set x(a){this._x=a;this._updateQuaternion()},get y(){return this._y},set y(a){this._y=a;this._updateQuaternion()},get z(){return this._z},set z(a){this._z=a;this._updateQuaternion()},get order(){return this._order},set order(a){this._order=a;this._updateQuaternion()}, +set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._updateQuaternion();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._updateQuaternion();return this},setFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],g=d[1],i=d[5],j=d[9],l=d[2],m=d[6],d=d[10],b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(h)),0.99999>Math.abs(h)?(this._x=Math.atan2(-j,d),this._z= +Math.atan2(-f,e)):(this._x=Math.atan2(m,i),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this._y=Math.atan2(h,d),this._z=Math.atan2(g,i)):(this._y=Math.atan2(-l,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(m)),0.99999>Math.abs(m)?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-f,i)):(this._y=0,this._z=Math.atan2(g,e))):"ZYX"===b?(this._y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this._x=Math.atan2(m,d),this._z=Math.atan2(g,e)):(this._x=0,this._z=Math.atan2(-f,i))):"YZX"===b?(this._z= +Math.asin(c(g)),0.99999>Math.abs(g)?(this._x=Math.atan2(-j,i),this._y=Math.atan2(-l,e)):(this._x=0,this._y=Math.atan2(h,d))):"XZY"===b?(this._z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this._x=Math.atan2(m,i),this._y=Math.atan2(h,e)):(this._x=Math.atan2(-j,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this._updateQuaternion();return this},setFromQuaternion:function(a,b,c){function d(a){return Math.min(Math.max(a,-1),1)}var e=a.x*a.x,f= +a.y*a.y,h=a.z*a.z,g=a.w*a.w,b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-e-f+h),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w))),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+e-f-h)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z))),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-e-f+h),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-e+f-h)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z))),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-e-f+h),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-e+f-h)):"ZYX"=== +b?(this._x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-e-f+h),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z))),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+e-f-h)):"YZX"===b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-e+f-h),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+e-f-h),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w)))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-e+f-h),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+e-f-h),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y)))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+ +b);this._order=b;!1!==c&&this._updateQuaternion();return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._updateQuaternion();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},clone:function(){return new THREE.Euler(this._x, +this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a, b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)}; @@ -67,124 +72,133 @@ this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max (a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;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)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)}; THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0this.max.x&&(this.max.x=b.x),b.ythis.max.y&&(this.max.y=b.y),b.zthis.max.z&&(this.max.z=b.z)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector3; -return function(b,c){var d=a.copy(c).multiplyScalar(0.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.xthis.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?!0:!1},getParameter:function(a){return new THREE.Vector3((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))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min, -this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),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},applyMatrix4:function(){var a=[new THREE.Vector3, -new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){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.makeEmpty();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)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,g,h,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,g||0,h||0,void 0!==i?i:1)}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=g;j[5]=h;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},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},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, -multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;cthis.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?!0:!1},getParameter:function(a){return new THREE.Vector3((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))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a= +new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),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},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){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.makeEmpty();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)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,h,g,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,h||0,g||0,void 0!==i?i:1)}; +THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=h;j[5]=g;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},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},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, +multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)- +var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),h=0.5*a.distanceTo(b), +g=this.origin.clone().sub(e),a=-this.direction.dot(f),b=g.dot(this.direction),i=-g.dot(f),j=g.lengthSq(),l=Math.abs(1-a*a),m,n;0<=l?(g=a*i-b,m=a*b-i,n=h*l,0<=g?m>=-n?m<=n?(h=1/l,g*=h,m*=h,a=g*(g+a*m+2*b)+m*(a*g+m+2*i)+j):(m=h,g=Math.max(0,-(a*m+b)),a=-g*g+m*(m+2*i)+j):(m=-h,g=Math.max(0,-(a*m+b)),a=-g*g+m*(m+2*i)+j):m<=-n?(g=Math.max(0,-(-a*h+b)),m=0a.normal.dot(this.direction)*b?!0:!1},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)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0}; +THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a){for(var b,c=0,d=0,e=a.length;d=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},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;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 THREE.Box3;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},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]}; -THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],m=c[8],p=c[9],l=c[10],r=c[11],s=c[12],n=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,j-g,r-m,c-s).normalize();b[1].setComponents(f+ -a,j+g,r+m,c+s).normalize();b[2].setComponents(f+d,j+h,r+p,c+n).normalize();b[3].setComponents(f-d,j-h,r-p,c-n).normalize();b[4].setComponents(f-e,j-i,r-l,c-q).normalize();b[5].setComponents(f+e,j+i,r+l,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)d;d++)if(b[d].distanceToPoint(c)c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; +THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],j=c[7],l=c[8],m=c[9],n=c[10],p=c[11],t=c[12],q=c[13],r=c[14],c=c[15];b[0].setComponents(f-a,j-h,p-l,c-t).normalize();b[1].setComponents(f+ +a,j+h,p+l,c+t).normalize();b[2].setComponents(f+d,j+g,p+m,c+q).normalize();b[3].setComponents(f-d,j-g,p-m,c-q).normalize();b[4].setComponents(f-e,j-i,p-n,c-r).normalize();b[5].setComponents(f+e,j+i,p+n,c+r).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.geometry,b=b.matrixWorld;null===c.boundingSphere&&c.computeBoundingSphere();c=-c.boundingSphere.radius*b.getMaxScaleOnAxis();a.getPositionFromMatrix(b);for(var b=this.planes,d=0;6>d;d++)if(b[d].distanceToPoint(a)< +c)return!1;return!0}}(),intersectsSphere:function(a){for(var b=this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0h&&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},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,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 THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, c);return 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 THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0a&&0f||1c?c:a},clampBottom:function(a,b){return 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)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},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*(0.5-Math.random())},sign:function(a){return 0>a?-1:0this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: -f+2;j=this.points[c[0]];m=this.points[c[1]];p=this.points[c[2]];l=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,p.x,l.x,g,h,i);d.y=b(j.y,m.y,p.y,l.y,g,h,i);d.z=b(j.z,m.z,p.z,l.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;ae;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 ac?c:a},clampBottom:function(a,b){return 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)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},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*(0.5-Math.random())},sign:function(a){return 0>a?-1:0this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: +f+2;j=this.points[c[0]];l=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];g=h*h;i=h*g;d.x=b(j.x,l.x,m.x,n.x,h,g,i);d.y=b(j.y,l.y,m.y,n.y,h,g,i);d.z=b(j.z,l.z,m.z,n.z,h,g,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a=b.x+b.y}}(); THREE.Triangle.prototype={constructor:THREE.Triangle,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},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 THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),midpoint:function(a){return(a|| new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}, clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}; -THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now(): -Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){}; -THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!== -this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;ch.scale.x)return l;l.push({distance:r,point:h.position,face:null,object:h})}else if(h instanceof -a.LOD)f.getPositionFromMatrix(h.matrixWorld),r=j.ray.origin.distanceTo(f),i(h.getObjectForDistance(r),j,l);else if(h instanceof a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!j.ray.isIntersectionSphere(b))return l;var r=h.geometry,s=r.vertices,n=h.material instanceof a.MeshFaceMaterial,q=!0===n?h.material.materials:null,y=h.material.side,u,x,t,E=j.precision;g.getInverse(h.matrixWorld);c.copy(j.ray).applyMatrix4(g);for(var J= -0,F=r.faces.length;JH)){y=y.side;if(y!==a.DoubleSide&&(u=c.direction.dot(d.normal),!(y===a.FrontSide?0>u:0j.far)){e=c.at(H,e);if(z instanceof a.Face3){if(y=s[z.a],u=s[z.b],x=s[z.c],!a.Triangle.containsPoint(e,y,u,x))continue}else if(z instanceof a.Face4){if(y=s[z.a],u=s[z.b],x=s[z.c],t=s[z.d], -!a.Triangle.containsPoint(e,y,u,t)&&!a.Triangle.containsPoint(e,u,x,t))continue}else throw Error("face type not supported");l.push({distance:H,point:j.ray.at(H),face:z,faceIndex:J,object:h})}}}}}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;de&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d< -c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,j,m=[],p=0,l,r,s=[],n=0,q,y=[],u=0,x,t,E=[],J=0,F,z,H=[],K=0,G={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,B=new THREE.Vector4,V=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,I=Array(3),M=Array(4),R=new THREE.Matrix4,ea=new THREE.Matrix4,wa,Ma=new THREE.Matrix4,A=new THREE.Matrix3,ca=new THREE.Matrix3,ja=new THREE.Vector3,na=new THREE.Frustum,N=new THREE.Vector4,fa=new THREE.Vector4; -this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);ea.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(ea)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ea.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(ea)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a, -c)};this.projectScene=function(g,h,p,Ka){var qa=!1,pa,Z,ga,W,da,la,ha,ia,Qa,kb,oa,Xa,Ra;z=t=q=r=0;G.elements.length=0;!0===g.autoUpdate&&g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();R.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));ea.multiplyMatrices(h.projectionMatrix,R);ca.getNormalMatrix(R);na.setFromMatrix(ea);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var Aa=function(b){for(var c=0,d=b.children.length;ci.positionScreen.x||1i.positionScreen.y||1i.positionScreen.z||1(ha.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ha.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x),la===THREE.DoubleSide||qa===(la===THREE.FrontSide))r===n?(oa=new THREE.RenderableFace3,s.push(oa),n++,r++,l=oa):l=s[r++],l.v1.copy(W),l.v2.copy(da),l.v3.copy(ha);else continue; -else continue;else if(Z instanceof THREE.Face4)if(W=m[Z.a],da=m[Z.b],ha=m[Z.c],oa=m[Z.d],M[0]=W.positionScreen,M[1]=da.positionScreen,M[2]=ha.positionScreen,M[3]=oa.positionScreen,!0===W.visible||!0===da.visible||!0===ha.visible||!0===oa.visible||V.isIntersectionBox(C.setFromPoints(M)))if(qa=0>(oa.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(oa.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)||0>(da.positionScreen.x-ha.positionScreen.x)* -(oa.positionScreen.y-ha.positionScreen.y)-(da.positionScreen.y-ha.positionScreen.y)*(oa.positionScreen.x-ha.positionScreen.x),la===THREE.DoubleSide||qa===(la===THREE.FrontSide)){if(q===u){var sb=new THREE.RenderableFace4;y.push(sb);u++;q++;l=sb}else l=y[q++];l.v1.copy(W);l.v2.copy(da);l.v3.copy(ha);l.v4.copy(oa)}else continue;else continue;l.normalModel.copy(Z.normal);!1===qa&&(la===THREE.BackSide||la===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(A).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(ca); -l.centroidModel.copy(Z.centroid).applyMatrix4(wa);ha=Z.vertexNormals;W=0;for(da=ha.length;WB.z&&(z===K?(qa=new THREE.RenderableParticle,H.push(qa),K++, -z++,F=qa):F=H[z++],F.object=ia,F.x=B.x/B.w,F.y=B.y/B.w,F.z=B.z,F.rotation=ia.rotation.z,F.scale.x=ia.scale.x*Math.abs(F.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),F.scale.y=ia.scale.y*Math.abs(F.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),F.material=ia.material,G.elements.push(F)));!0===Ka&&G.elements.sort(c);return G}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3}; +THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(), +a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){}; +THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&& +c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;cg.scale.x)return n;n.push({distance:p,point:g.position,face:null,object:g})}else if(g instanceof +a.LOD)f.getPositionFromMatrix(g.matrixWorld),p=j.ray.origin.distanceTo(f),i(g.getObjectForDistance(p),j,n);else if(g instanceof a.Mesh){p=g.geometry;f.getPositionFromMatrix(g.matrixWorld);null===p.boundingSphere&&p.computeBoundingSphere();b.set(f,p.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!1===j.ray.isIntersectionSphere(b))return n;var t=p.vertices;if(p instanceof a.BufferGeometry){var q=g.material;if(void 0===q||!1===p.dynamic)return n;var r=g.material instanceof a.MeshFaceMaterial, +s=!0===r?g.material.materials:null,v=g.material.side,z,C,F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);var H,t=!1;p.attributes.index&&(t=!0);s=new a.Vector3;H=new a.Vector3;var I=new a.Vector3;new a.Vector3;new a.Vector3;for(var G=0;Gz:0j.far||(e=c.at(A,e),!1!==a.Triangle.containsPoint(e, +s,H,I)&&n.push({distance:A,point:j.ray.at(A),face:null,faceIndex:null,object:g}))}}else if(p instanceof a.Geometry){r=g.material instanceof a.MeshFaceMaterial;s=!0===r?g.material.materials:null;F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);I=0;for(H=p.faces.length;Iz:0j.far)){e=c.at(A,e);if(G instanceof a.Face3){if(v=t[G.a],z=t[G.b],C=t[G.c],!1===a.Triangle.containsPoint(e,v,z,C))continue}else if(G instanceof a.Face4){if(v=t[G.a],z=t[G.b],C=t[G.c],q=t[G.d],!1===a.Triangle.containsPoint(e,v,z,q)&&!1===a.Triangle.containsPoint(e,z,C,q))continue}else throw Error("face type not supported");n.push({distance:A,point:j.ray.at(A),face:G,faceIndex:I,object:g})}}}}else if(g instanceof a.Line){F=j.linePrecision;F*=F;p= +g.geometry;null===p.boundingSphere&&p.computeBoundingSphere();f.getPositionFromMatrix(g.matrixWorld);b.set(f,p.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!1===j.ray.isIntersectionSphere(b))return n;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);c.direction.normalize();t=p.vertices;q=t.length;A=new a.Vector3;v=new a.Vector3;z=g.type===a.LineStrip?1:2;for(r=0;re&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(dg.positionScreen.x||1g.positionScreen.y||1< +g.positionScreen.y||-1>g.positionScreen.z||1(ha.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(ha.positionScreen.y- +T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x),na===THREE.DoubleSide||V===(na===THREE.FrontSide))n===t?(la=new THREE.RenderableFace3,p.push(la),t++,n++,m=la):m=p[n++],m.id=X.id,m.v1.copy(T),m.v2.copy(aa),m.v3.copy(ha);else continue;else continue;else if(fa instanceof THREE.Face4)if(T=j[fa.a],aa=j[fa.b],ha=j[fa.c],la=j[fa.d],w[0]=T.positionScreen,w[1]=aa.positionScreen,w[2]=ha.positionScreen,w[3]=la.positionScreen,!0===T.visible||!0===aa.visible||!0===ha.visible||!0===la.visible||N.isIntersectionBox(y.setFromPoints(w)))if(V= +0>(la.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(la.positionScreen.y-T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x)||0>(aa.positionScreen.x-ha.positionScreen.x)*(la.positionScreen.y-ha.positionScreen.y)-(aa.positionScreen.y-ha.positionScreen.y)*(la.positionScreen.x-ha.positionScreen.x),na===THREE.DoubleSide||V===(na===THREE.FrontSide)){if(q===s){var ua=new THREE.RenderableFace4;r.push(ua);s++;q++;m=ua}else m=r[q++];m.id=X.id;m.v1.copy(T);m.v2.copy(aa); +m.v3.copy(ha);m.v4.copy(la)}else continue;else continue;m.normalModel.copy(fa.normal);!1===V&&(na===THREE.BackSide||na===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(Ua).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(O);m.centroidModel.copy(fa.centroid).applyMatrix4(pa);ha=fa.vertexNormals;T=0;for(aa=ha.length;TJ.z&&(I===A?(V=new THREE.RenderableParticle,G.push(V),A++,I++,H=V):H=G[I++],H.id=X.id,H.x=J.x*ja,H.y=J.y*ja,H.z=J.z,H.object=X,H.rotation=X.rotation.z,H.scale.x=X.scale.x*Math.abs(H.x-(J.x+f.projectionMatrix.elements[0])/(J.w+f.projectionMatrix.elements[12])),H.scale.y= +X.scale.y*Math.abs(H.y-(J.y+f.projectionMatrix.elements[5])/(J.w+f.projectionMatrix.elements[13])),H.material=X.material,K.elements.push(H)));!0===l&&K.elements.sort(b);return K}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3}; THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;be?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;ci;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<= -d){h.splice(d,1);var m=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;hb.max.x&&(b.max.x=c),db.max.y&&(b.max.y=d),eb.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;fc&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a, -b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;aja?-1:1;h[4*a]=R.x;h[4*a+1]=R.y;h[4*a+2]=R.z;h[4*a+3]=A}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array, -d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;ge?-1:1,f.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;ci;i++)if(g[i]==g[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];g=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)g[i]==g[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){g.splice(d,1);var l=new THREE.Face3(g[0],g[1],g[2],a.normal,a.color,a.materialIndex);g=0;for(i=this.faceVertexUvs.length;gb.max.x&&(b.max.x=c),db.max.y&&(b.max.y=d),eb.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere= +new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;fc&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;aFa?-1:1;h[4*a]=L.x;h[4*a+1]=L.y;h[4*a+2]=L.z;h[4*a+3]=O}if(void 0===this.attributes.index||void 0===this.attributes.position|| +void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],j=0;ja.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;da.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide); +a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,j,r){var s=/\.dds$/i.test(f),v=b+"/"+f;if(s){var z=THREE.ImageUtils.loadCompressedTexture(v);a[e]=z}else z=document.createElement("canvas"),a[e]=new THREE.Texture(z);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!== +f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));r&&(a[e].anisotropy=r);if(!s){var C=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);C.image.width=a;C.image.height=b;C.image.getContext("2d").drawImage(this,0,0,a,b)}else C.image=this;C.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null, +lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?g="MeshPhongMaterial":"basic"===j&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide); void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&& b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat, -a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(h.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color), -j.uSpecularColor.value.setHex(i.specular),j.uAmbientColor.value.setHex(i.ambient),j.uShininess.value=i.shininess,void 0!==i.opacity&&(j.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:j,lights:!0,fog:!0}),i.transparent&&(h.transparent=!0)):h=new THREE[h](i);void 0!==a.DbgName&&(h.name=a.DbgName);return h}};THREE.ImageLoader=function(){this.crossOrigin=null}; -THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error", -message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)}; -THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),h=a.parse(h,d);c(h.geometry,h.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&& -(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)}; -THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,g,h,i,j,m,p,l,r,s,n,q,y,u,x=a.faces;r=a.vertices;var t=a.normals,E=a.colors,J=0;for(e=0;eC.parameters.opacity&&(C.parameters.transparent=!0);C.parameters.normalMap?(G=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(G.uniforms),q=C.parameters.color,V=C.parameters.specular,n=C.parameters.ambient,L=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0], -C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,B.enableReflection.value=!0,B.uReflectivity.value=C.parameters.reflectivity),C.parameters.lightMap&&(B.tAO.value=C.parameters.lightMap,B.enableAO.value=!0),C.parameters.specularMap&&(B.tSpecular.value=z.textures[C.parameters.specularMap],B.enableSpecular.value=!0),C.parameters.displacementMap&&(B.tDisplacement.value=z.textures[C.parameters.displacementMap], -B.enableDisplacement.value=!0,B.uDisplacementBias.value=C.parameters.displacementBias,B.uDisplacementScale.value=C.parameters.displacementScale),B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(V),B.uAmbientColor.value.setHex(n),B.uShininess.value=L,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:G.fragmentShader,vertexShader:G.vertexShader,uniforms:B,lights:!0,fog:!0})):r=new THREE[C.type](C.parameters);r.name=I;z.materials[I]= -r}for(I in K.materials)if(C=K.materials[I],C.parameters.materials){M=[];for(q=0;qw.parameters.opacity&&(w.parameters.transparent=!0);w.parameters.normalMap?(J=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(J.uniforms), +s=w.parameters.color,M=w.parameters.specular,r=w.parameters.ambient,N=w.parameters.shininess,y.tNormal.value=A.textures[w.parameters.normalMap],w.parameters.normalScale&&y.uNormalScale.value.set(w.parameters.normalScale[0],w.parameters.normalScale[1]),w.parameters.map&&(y.tDiffuse.value=w.parameters.map,y.enableDiffuse.value=!0),w.parameters.envMap&&(y.tCube.value=w.parameters.envMap,y.enableReflection.value=!0,y.uReflectivity.value=w.parameters.reflectivity),w.parameters.lightMap&&(y.tAO.value=w.parameters.lightMap, +y.enableAO.value=!0),w.parameters.specularMap&&(y.tSpecular.value=A.textures[w.parameters.specularMap],y.enableSpecular.value=!0),w.parameters.displacementMap&&(y.tDisplacement.value=A.textures[w.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=w.parameters.displacementBias,y.uDisplacementScale.value=w.parameters.displacementScale),y.uDiffuseColor.value.setHex(s),y.uSpecularColor.value.setHex(M),y.uAmbientColor.value.setHex(r),y.uShininess.value=N,w.parameters.opacity&& +(y.uOpacity.value=w.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:y,lights:!0,fog:!0})):t=new THREE[w.type](w.parameters);t.name=Z;A.materials[Z]=t}for(Z in B.materials)if(w=B.materials[Z],w.parameters.materials){L=[];for(s=0;sh.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b}; +THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;eg.end&&(g.end=e);b||(b=h)}}a.firstAnimation=b}; THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")}; THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&& (this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b}; THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);THREE.Ribbon.prototype.clone=function(a){void 0===a&&(a=new THREE.Ribbon(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;dJ&&t.clearRect(ua.min.x|0,ua.min.y|0,ua.max.x-ua.min.x|0,ua.max.y-ua.min.y|0),0=h||(h*=f.intensity,c.add(Qa.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=bb.getPositionFromMatrix(f.matrixWorld),h=b.dot(bb.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Qa.multiplyScalar(h)))))}}function z(a,d,e,f,g,h,k,i){m.info.render.vertices+= -3;m.info.render.faces++;b(i.opacity);c(i.blending);A=a.positionScreen.x;ca=a.positionScreen.y;ja=d.positionScreen.x;na=d.positionScreen.y;N=e.positionScreen.x;fa=e.positionScreen.y;y(A,ca,ja,na,N,fa);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ha.copy(i.color),ia.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ha.multiply(k.color),!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==k.vertexNormalsLength?(ga.copy(tb),W.copy(tb),da.copy(tb),q(k.v1.positionWorld, -k.vertexNormalsModel[0],ga),q(k.v2.positionWorld,k.vertexNormalsModel[1],W),q(k.v3.positionWorld,k.vertexNormalsModel[2],da),ga.multiply(ha).add(ia),W.multiply(ha).add(ia),da.multiply(ha).add(ia),la.addColors(W,da).multiplyScalar(0.5),Aa=H(ga,W,da,la),J(A,ca,ja,na,N,fa,0,0,1,0,0,1,Aa)):(Z.copy(tb),q(k.centroidModel,k.normalModel,Z),Z.multiply(ha).add(ia),!0===i.wireframe?E(Z,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(Z))):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial|| -i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Sa=k.uvs[0],C(A,ca,ja,na,N,fa,Sa[f].x,Sa[f].y,Sa[g].x,Sa[g].y,Sa[h].x,Sa[h].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(bb.copy(k.vertexNormalsModelView[f]),sb=0.5*bb.x+0.5,Nb=0.5*bb.y+0.5,bb.copy(k.vertexNormalsModelView[g]),Kb=0.5*bb.x+0.5,Ob=0.5*bb.y+0.5,bb.copy(k.vertexNormalsModelView[h]),Tb=0.5*bb.x+0.5,Ub=0.5*bb.y+0.5,C(A,ca,ja,na,N,fa,sb,Nb,Kb,Ob,Tb,Ub, -i.envMap)):(Z.copy(i.color),i.vertexColors===THREE.FaceColors&&Z.multiply(k.color),!0===i.wireframe?E(Z,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(Z)):i instanceof THREE.MeshDepthMaterial?(Xa=n.near,Ra=n.far,ga.r=ga.g=ga.b=1-j(a.positionScreen.z*a.positionScreen.w,Xa,Ra),W.r=W.g=W.b=1-j(d.positionScreen.z*d.positionScreen.w,Xa,Ra),da.r=da.g=da.b=1-j(e.positionScreen.z*e.positionScreen.w,Xa,Ra),la.addColors(W,da).multiplyScalar(0.5),Aa=H(ga,W,da,la),J(A,ca,ja,na,N,fa,0,0,1,0,0, -1,Aa)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=k.normalModelView,Z.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?E(Z,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):F(Z)):i.shading==THREE.SmoothShading&&(a=k.vertexNormalsModelView[f],ga.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[g],W.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[h],da.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5), -la.addColors(W,da).multiplyScalar(0.5),Aa=H(ga,W,da,la),J(A,ca,ja,na,N,fa,0,0,1,0,0,1,Aa)))}function y(a,b,c,d,e,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.closePath()}function B(a,b,c,d,e,f,g,h){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.lineTo(g,h);t.closePath()}function E(a,b,c,h){d(b);e(c);f(h);g(a.getStyle());t.stroke();Ja.expandByScalar(2*b)}function F(a){h(a.getStyle());t.fill()}function C(a,b,c,d,e,f,g,i,k,xa,j,l,p){if(!(p instanceof THREE.DataTexture||void 0=== -p.image||0==p.image.width)){if(!0===p.needsUpdate){var m=p.wrapS==THREE.RepeatWrapping,Ya=p.wrapT==THREE.RepeatWrapping;kb[p.id]=t.createPattern(p.image,!0===m&&!0===Ya?"repeat":!0===m&&!1===Ya?"repeat-x":!1===m&&!0===Ya?"repeat-y":"no-repeat");p.needsUpdate=!1}void 0===kb[p.id]?h("rgba(0,0,0,1)"):h(kb[p.id]);var m=p.offset.x/p.repeat.x,Ya=p.offset.y/p.repeat.y,n=p.image.width*p.repeat.x,q=p.image.height*p.repeat.y,g=(g+m)*n,i=(1-i+Ya)*q,c=c-a,d=d-b,e=e-a,f=f-b,k=(k+m)*n-g,xa=(1-xa+Ya)*q-i,j=(j+m)* -n-g,l=(1-l+Ya)*q-i,m=k*l-j*xa;0===m?(void 0===oa[p.id]&&(b=document.createElement("canvas"),b.width=p.image.width,b.height=p.image.height,b=b.getContext("2d"),b.drawImage(p.image,0,0),oa[p.id]=b.getImageData(0,0,p.image.width,p.image.height).data),b=oa[p.id],g=4*(Math.floor(g)+Math.floor(i)*p.image.width),Z.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),F(Z)):(m=1/m,p=(l*c-xa*e)*m,xa=(l*d-xa*f)*m,c=(k*e-j*c)*m,d=(k*f-j*d)*m,a=a-p*g-c*i,g=b-xa*g-d*i,t.save(),t.transform(p,xa,c,d,a,g),t.fill(),t.restore())}} -function J(a,b,c,d,e,f,g,h,i,k,xa,j,p){var m,l;m=p.width-1;l=p.height-1;g*=m;h*=l;c-=a;d-=b;e-=a;f-=b;i=i*m-g;k=k*l-h;xa=xa*m-g;j=j*l-h;l=1/(i*j-xa*k);m=(j*c-k*e)*l;k=(j*d-k*f)*l;c=(i*e-xa*c)*l;d=(i*f-xa*d)*l;a=a-m*g-c*h;b=b-k*g-d*h;t.save();t.transform(m,k,c,d,a,b);t.clip();t.drawImage(p,0,0);t.restore()}function H(a,b,c,d){Ua[0]=255*a.r|0;Ua[1]=255*a.g|0;Ua[2]=255*a.b|0;Ua[4]=255*b.r|0;Ua[5]=255*b.g|0;Ua[6]=255*b.b|0;Ua[8]=255*c.r|0;Ua[9]=255*c.g|0;Ua[10]=255*c.b|0;Ua[12]=255*d.r|0;Ua[13]=255*d.g| -0;Ua[14]=255*d.b|0;k.putImageData(Bb,0,0);Va.drawImage(Ab,0,0);return lb}function G(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===n instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();t.setTransform(1,0,0,-1,u,x);m.info.render.vertices=0;m.info.render.faces=0;p=s.projectScene(a,n,this.sortObjects,this.sortElements);l=p.elements;r=p.lights; -tb.setRGB(0,0,0);Na.setRGB(0,0,0);ra.setRGB(0,0,0);for(var K=0,V=r.length;K>1,Pc=Pb.height>>1,Ya=L.scale.x*u,vb=L.scale.y*x,xa=Ya*Oc,mb=vb*Pc,Ja.min.set(P.x-xa,P.y-mb),Ja.max.set(P.x+xa,P.y+mb),!1===Ta.isIntersectionBox(Ja)? -Ja.makeEmpty():(t.save(),t.translate(P.x,P.y),t.rotate(-L.rotation),t.scale(Ya,-vb),t.translate(-Oc,-Pc),t.drawImage(Pb,0,0),t.restore())):U instanceof THREE.ParticleCanvasMaterial&&(xa=L.scale.x*u,mb=L.scale.y*x,Ja.min.set(P.x-xa,P.y-mb),Ja.max.set(P.x+xa,P.y+mb),!1===Ta.isIntersectionBox(Ja)?Ja.makeEmpty():(g(U.color.getStyle()),h(U.color.getStyle()),t.save(),t.translate(P.x,P.y),t.rotate(-L.rotation),t.scale(xa,mb),U.program(t),t.restore()))}else if(L instanceof THREE.RenderableLine){if(I=L.v1, -M=L.v2,I.positionScreen.x*=u,I.positionScreen.y*=x,M.positionScreen.x*=u,M.positionScreen.y*=x,Ja.setFromPoints([I.positionScreen,M.positionScreen]),!0===Ta.isIntersectionBox(Ja))if(P=I,xa=M,b(U.opacity),c(U.blending),t.beginPath(),t.moveTo(P.positionScreen.x,P.positionScreen.y),t.lineTo(xa.positionScreen.x,xa.positionScreen.y),U instanceof THREE.LineBasicMaterial){d(U.linewidth);e(U.linecap);f(U.linejoin);if(U.vertexColors!==THREE.VertexColors)g(U.color.getStyle());else if(mb=L.vertexColors[0].getStyle(), -L=L.vertexColors[1].getStyle(),mb===L)g(mb);else{try{var qc=t.createLinearGradient(P.positionScreen.x,P.positionScreen.y,xa.positionScreen.x,xa.positionScreen.y);qc.addColorStop(0,mb);qc.addColorStop(1,L)}catch(ed){qc=mb}g(qc)}t.stroke();Ja.expandByScalar(2*U.linewidth)}else U instanceof THREE.LineDashedMaterial&&(d(U.linewidth),e(U.linecap),f(U.linejoin),g(U.color.getStyle()),i(U.dashSize,U.gapSize),t.stroke(),Ja.expandByScalar(2*U.linewidth),i(null,null))}else if(L instanceof THREE.RenderableFace3){I= -L.v1;M=L.v2;R=L.v3;if(-1>I.positionScreen.z||1M.positionScreen.z||1R.positionScreen.z||1I.positionScreen.z||1M.positionScreen.z||1R.positionScreen.z||1ea.positionScreen.z||1=g||(g*=f.intensity,c.add(Xb.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=Wa.getPositionFromMatrix(f.matrixWorld),g=b.dot(Wa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Xb.multiplyScalar(g)))))}} +function c(a,c,e,l,p,r,U,q){C.info.render.vertices+=3;C.info.render.faces++;m(q.opacity);n(q.blending);ya=a.positionScreen.x;Ha=a.positionScreen.y;fa=c.positionScreen.x;da=c.positionScreen.y;T=e.positionScreen.x;aa=e.positionScreen.y;d(ya,Ha,fa,da,T,aa);(q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial)&&null===q.map?(Qa.copy(q.color),Xa.copy(q.emissive),q.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===q.wireframe&&q.shading==THREE.SmoothShading&&3==U.vertexNormalsLength? +(ra.copy(ib),ja.copy(ib),ua.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),b(U.v2.positionWorld,U.vertexNormalsModel[1],ja),b(U.v3.positionWorld,U.vertexNormalsModel[2],ua),ra.multiply(Qa).add(Xa),ja.multiply(Qa).add(Xa),ua.multiply(Qa).add(Xa),Ra.addColors(ja,ua).multiplyScalar(0.5),lb=j(ra,ja,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):(ia.copy(ib),b(U.centroidModel,U.normalModel,ia),ia.multiply(Qa).add(Xa),!0===q.wireframe?f(ia,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin): +h(ia))):q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial?null!==q.map?q.map.mapping instanceof THREE.UVMapping&&(Ga=U.uvs[0],g(ya,Ha,fa,da,T,aa,Ga[l].x,Ga[l].y,Ga[p].x,Ga[p].y,Ga[r].x,Ga[r].y,q.map)):null!==q.envMap?q.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(Wa.copy(U.vertexNormalsModelView[l]),Ca=0.5*Wa.x+0.5,yb=0.5*Wa.y+0.5,Wa.copy(U.vertexNormalsModelView[p]),Ib=0.5*Wa.x+0.5,k=0.5*Wa.y+0.5,Wa.copy(U.vertexNormalsModelView[r]), +Rb=0.5*Wa.x+0.5,Yb=0.5*Wa.y+0.5,g(ya,Ha,fa,da,T,aa,Ca,yb,Ib,k,Rb,Yb,q.envMap)):(ia.copy(q.color),q.vertexColors===THREE.FaceColors&&ia.multiply(U.color),!0===q.wireframe?f(ia,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ia)):q instanceof THREE.MeshDepthMaterial?(Sa=D.near,xb=D.far,ra.r=ra.g=ra.b=1-z(a.positionScreen.z*a.positionScreen.w,Sa,xb),ja.r=ja.g=ja.b=1-z(c.positionScreen.z*c.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-z(e.positionScreen.z*e.positionScreen.w,Sa,xb),Ra.addColors(ja, +ua).multiplyScalar(0.5),lb=j(ra,ja,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):q instanceof THREE.MeshNormalMaterial&&(q.shading==THREE.FlatShading?(a=U.normalModelView,ia.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===q.wireframe?f(ia,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ia)):q.shading==THREE.SmoothShading&&(a=U.vertexNormalsModelView[l],ra.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=U.vertexNormalsModelView[p],ja.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5), +a=U.vertexNormalsModelView[r],ua.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),Ra.addColors(ja,ua).multiplyScalar(0.5),lb=j(ra,ja,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)))}function d(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function e(a,b,c,d,e,f,h,g){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(h,g);y.closePath()}function f(a,b,c,d){p(b);t(c);q(d);r(a.getStyle());y.stroke();va.expandByScalar(2*b)}function h(a){s(a.getStyle()); +y.fill()}function g(a,b,c,d,e,f,g,k,i,j,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Jb[n.id]=y.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Jb[n.id]?s("rgba(0,0,0,1)"):s(Jb[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y, +g=(g+p)*r,k=(1-k+q)*t,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+p)*r-g,j=(1-j+q)*t-k,m=(m+p)*r-g,l=(1-l+q)*t-k,p=i*l-m*j;0===p?(void 0===Ab[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),Ab[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=Ab[n.id],g=4*(Math.floor(g)+Math.floor(k)*n.image.width),ia.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),h(ia)):(p=1/p,n=(l*c-j*e)*p,j=(l*d-j*f)*p,c=(i*e-m*c)*p,d=(i*f-m*d)*p,a=a- +n*g-c*k,g=b-j*g-d*k,y.save(),y.transform(n,j,c,d,a,g),y.fill(),y.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;k=k*n-h;i=i*p-g;j=j*n-h;m=m*p-g;p=1/(k*m-j*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;y.save();y.transform(n,i,c,d,a,b);y.clip();y.drawImage(l,0,0);y.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255* +c.r|0;Ka[9]=255*c.g|0;Ka[10]=255*c.b|0;Ka[12]=255*d.r|0;Ka[13]=255*d.g|0;Ka[14]=255*d.b|0;Bb.putImageData(Kb,0,0);Lb.drawImage(Gb,0,0);return Sb}function l(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function m(a){Z!==a&&(Z=y.globalAlpha=a)}function n(a){L!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation= +"darker"),L=a)}function p(a){Ua!==a&&(Ua=y.lineWidth=a)}function t(a){O!==a&&(O=y.lineCap=a)}function q(a){ka!==a&&(ka=y.lineJoin=a)}function r(a){pa!==a&&(pa=y.strokeStyle=a)}function s(a){Pa!==a&&(Pa=y.fillStyle=a)}function v(a,b){if(Fa!==a||wa!==b)y.setLineDash([a,b]),Fa=a,wa=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var z=THREE.Math.smoothstep,a=a||{},C=this,F,H,I,G=new THREE.Projector,A=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K,B,J,N,y=A.getContext("2d"),M=new THREE.Color(0), +w=0,Z=1,L=0,pa=null,Pa=null,Ua=null,O=null,ka=null,Fa=null,wa=0,D,V,ea,qa,eb,pb=new THREE.RenderableVertex,ub=new THREE.RenderableVertex,ya,Ha,fa,da,T,aa,na,ha,X,xa,ab,la,ia=new THREE.Color,ra=new THREE.Color,ja=new THREE.Color,ua=new THREE.Color,Ra=new THREE.Color,Qa=new THREE.Color,Xa=new THREE.Color,Xb=new THREE.Color,Jb={},Ab={},Sa,xb,lb,Ga,Ca,yb,Ib,k,Rb,Yb,fb=new THREE.Box2,oa=new THREE.Box2,va=new THREE.Box2,ib=new THREE.Color,Tb=new THREE.Color,Ub=new THREE.Color,Wa=new THREE.Vector3,Gb,Bb, +Kb,Ka,Sb,Lb,Hb=16;Gb=document.createElement("canvas");Gb.width=Gb.height=2;Bb=Gb.getContext("2d");Bb.fillStyle="rgba(0,0,0,1)";Bb.fillRect(0,0,2,2);Kb=Bb.getImageData(0,0,2,2);Ka=Kb.data;Sb=document.createElement("canvas");Sb.width=Sb.height=Hb;Lb=Sb.getContext("2d");Lb.translate(-Hb/2,-Hb/2);Lb.scale(Hb,Hb);Hb--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=A;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio: +void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){K=a*this.devicePixelRatio;B=b*this.devicePixelRatio;J=Math.floor(K/2);N=Math.floor(B/2);A.width=K;A.height=B;1!==this.devicePixelRatio&&!1!==c&&(A.style.width=a+"px",A.style.height=b+"px");fb.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N));oa.set(new THREE.Vector2(-J, +-N),new THREE.Vector2(J,N));Z=1;L=0;ka=O=Ua=Pa=pa=null};this.setClearColor=function(a,b){M.set(a);w=void 0!==b?b:1;oa.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,J,N);!1===oa.empty()&&(oa.intersect(fb),oa.expandByScalar(2),1>w&&y.clearRect(oa.min.x| +0,oa.min.y|0,oa.max.x-oa.min.x|0,oa.max.y-oa.min.y|0),0>1,Kc=Zb.height>> +1,vb=U.scale.x*J,zb=U.scale.y*N,mb=vb*Jc,nb=zb*Kc,va.min.set(B.x-mb,B.y-nb),va.max.set(B.x+mb,B.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(y.save(),y.translate(B.x,B.y),y.rotate(-U.rotation),y.scale(vb,-zb),y.translate(-Jc,-Kc),y.drawImage(Zb,0,0),y.restore())):w instanceof THREE.ParticleCanvasMaterial&&(mb=U.scale.x*J,nb=U.scale.y*N,va.min.set(B.x-mb,B.y-nb),va.max.set(B.x+mb,B.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(r(w.color.getStyle()),s(w.color.getStyle()),y.save(),y.translate(B.x, +B.y),y.rotate(-U.rotation),y.scale(mb,nb),w.program(y),y.restore()))}else if(U instanceof THREE.RenderableLine){if(V=U.v1,ea=U.v2,V.positionScreen.x*=J,V.positionScreen.y*=N,ea.positionScreen.x*=J,ea.positionScreen.y*=N,va.setFromPoints([V.positionScreen,ea.positionScreen]),!0===fb.isIntersectionBox(va))if(B=V,mb=ea,m(w.opacity),n(w.blending),y.beginPath(),y.moveTo(B.positionScreen.x,B.positionScreen.y),y.lineTo(mb.positionScreen.x,mb.positionScreen.y),w instanceof THREE.LineBasicMaterial){p(w.linewidth); +t(w.linecap);q(w.linejoin);if(w.vertexColors!==THREE.VertexColors)r(w.color.getStyle());else if(nb=U.vertexColors[0].getStyle(),U=U.vertexColors[1].getStyle(),nb===U)r(nb);else{try{var wc=y.createLinearGradient(B.positionScreen.x,B.positionScreen.y,mb.positionScreen.x,mb.positionScreen.y);wc.addColorStop(0,nb);wc.addColorStop(1,U)}catch(fd){wc=nb}r(wc)}y.stroke();va.expandByScalar(2*w.linewidth)}else w instanceof THREE.LineDashedMaterial&&(p(w.linewidth),t(w.linecap),q(w.linejoin),r(w.color.getStyle()), +v(w.dashSize,w.gapSize),y.stroke(),va.expandByScalar(2*w.linewidth),v(null,null))}else if(U instanceof THREE.RenderableFace3){V=U.v1;ea=U.v2;qa=U.v3;if(-1>V.positionScreen.z||1ea.positionScreen.z||1qa.positionScreen.z||1V.positionScreen.z||1ea.positionScreen.z||1qa.positionScreen.z||1eb.positionScreen.z|| +1l;l++)N.autoScaleCubemaps&&!f?(m=j,s=l,t=c.image[l],x=Ic,t.width<=x&&t.height<=x||(y=Math.max(t.width,t.height),u=Math.floor(t.width*x/y),x=Math.floor(t.height*x/y),y=document.createElement("canvas"),y.width=u,y.height=x,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,x),t=y),m[s]=t):j[l]=c.image[l];l=j[0];m=0===(l.width&l.width- -1)&&0===(l.height&l.height-1);s=I(c.format);t=I(c.type);B(k.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){x=j[l].mipmaps;y=0;for(E=x.length;y=cc&&console.warn("WebGLRenderer: trying to use "+ -a+" texture units while this GPU supports only "+cc);ga+=1;return a}function F(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function z(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function H(a){a!==Sa&&(k.lineWidth(a),Sa=a)}function K(a,b,c){Xa!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),Xa=a);if(a&&(Ra!==b||Aa!==c))k.polygonOffset(b,c),Ra=b,Aa=c}function G(a){for(var a=a.split("\n"),b=0,c=a.length;bb;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);N.info.memory.textures--},P=function(a){a=a.target;a.removeEventListener("dispose",P);pc(a)},pc=function(a){var b=a.program;if(void 0!==b){a.program= -void 0;var c,d,e=!1,a=0;for(c=fa.length;ad.numSupportedMorphTargets?(j.sort(m),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(m):0===j.length&&j.push([0,0]);for(l=0;lva;va++)Ma=U[va],xb[ib]=Ma.x,xb[ib+1]=Ma.y,xb[ib+2]=Ma.z,ib+=3;else for(va=0;3>va;va++)xb[ib]=R.x,xb[ib+1]=R.y,xb[ib+2]=R.z,ib+=3;D=0;for(A=ta.length;Dva;va++)Ma=U[va],xb[ib]=Ma.x,xb[ib+1]=Ma.y,xb[ib+2]=Ma.z,ib+=3;else for(va=0;4>va;va++)xb[ib]=R.x,xb[ib+1]=R.y,xb[ib+2]=R.z,ib+=3;k.bindBuffer(k.ARRAY_BUFFER,C.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,xb,G)}if(Kb&& -Vb&&N){D=0;for(A=sa.length;Dva;va++)Ua=Z[va],lb[Ta]=Ua.x,lb[Ta+1]=Ua.y,Ta+=2;D=0;for(A=ta.length;Dva;va++)Ua=Z[va],lb[Ta]=Ua.x,lb[Ta+1]=Ua.y,Ta+=2;0va;va++)Xa=da[va],sb[Va]=Xa.x,sb[Va+1]=Xa.y,Va+=2;D=0;for(A=ta.length;Dva;va++)Xa=da[va],sb[Va]=Xa.x,sb[Va+1]=Xa.y,Va+=2;0l;l++)D.autoScaleCubemaps&&!f?(n=j,s=l,t=c.image[l],z=Ub,t.width<=z&&t.height<=z||(y=Math.max(t.width,t.height),v=Math.floor(t.width*z/y),z=Math.floor(t.height*z/y),y=document.createElement("canvas"),y.width=v,y.height=z,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,z),t=y),n[s]=t):j[l]=c.image[l]; +l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);s=w(c.format);t=w(c.type);N(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){z=j[l].mipmaps;y=0;for(A=z.length;y=ib&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ib);fa+=1;return a}function I(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==ja&&(k.lineWidth(a),ja=a)}function K(a,b,c){la!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),la=a); +if(a&&(ia!==b||ra!==c))k.polygonOffset(b,c),ia=b,ra=c}function B(a){for(var a=a.split("\n"),b=0,c=a.length;bb;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);D.info.memory.textures--},uc=function(a){a=a.target;a.removeEventListener("dispose",uc);vc(a)},vc=function(a){var b= +a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=V.length;ad.numSupportedMorphTargets?(j.sort(l),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(l):0===j.length&&j.push([0,0]);for(m=0;mza;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;3>za;za++)Sa[jb]=ea.x,Sa[jb+1]=ea.y,Sa[jb+2]=ea.z,jb+=3;E=0;for(D=ta.length;Eza;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;4>za;za++)Sa[jb]=ea.x,Sa[jb+ +1]=ea.y,Sa[jb+2]=ea.z,jb+=3;k.bindBuffer(k.ARRAY_BUFFER,C.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Sa,H)}if(Hb&&Jb&&L){E=0;for(D=sa.length;Eza;za++)Pa=fa[za],fb[Wa]=Pa.x,fb[Wa+1]=Pa.y,Wa+=2;E=0;for(D=ta.length;Eza;za++)Pa=fa[za],fb[Wa]=Pa.x,fb[Wa+1]=Pa.y,Wa+=2;0za;za++)Ra=aa[za],ib[Xa]=Ra.x,ib[Xa+1]=Ra.y,Xa+=2;E=0;for(D=ta.length;Eza;za++)Ra=aa[za],ib[Xa]=Ra.x,ib[Xa+1]=Ra.y,Xa+=2;0f;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER, -a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);V(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),B(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer), -k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):V(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER, -null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Kb,a=Ob,d=sb,e=Nb);b!==fb&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),fb=b);Tb=c;Ub=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: +"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=J("vertex",v+q);t=J("fragment",t+r);k.attachShader(w,v);k.attachShader(w,t);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,k.VALIDATE_STATUS)+", gl error ["+ +k.getError()+"]");k.deleteShader(t);k.deleteShader(v);w.uniforms={};w.attributes={};var z;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(z in p)t.push(z);z=t;t=0;for(v=z.length;tf;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,g=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER, +a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,g,h.__webglTexture,0);y(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),N(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer), +k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):y(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER, +null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Qa,a=Xa,d=ua,e=Ra);b!==eb&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),eb=b);Xb=c;Jb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null}; -THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter; -a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]; -this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,i=g.vertices,j=a.faces,m=g.faces,a=a.faceVertexUvs[0],g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,p=i.length;ba?b(c,e-1):j[e]>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap? -6:1,j=0;jp-1?0:p-1,r=p+1>e-1?e-1:p+1,s=0>m-1?0:m-1,n=m+1>d-1?d-1:m+1,q=[],y=[0,0,h[4*(p*d+m)]/255*b];q.push([-1,0,h[4*(p*d+s)]/255*b]);q.push([-1,-1,h[4*(l*d+s)]/255*b]);q.push([0,-1,h[4*(l*d+m)]/255*b]);q.push([1,-1,h[4*(l*d+n)]/255*b]);q.push([1,0,h[4*(p*d+n)]/255*b]);q.push([1,1,h[4*(r*d+n)]/255*b]);q.push([0,1,h[4*(r*d+m)]/255*b]);q.push([-1,1,h[4*(r*d+s)]/255*b]);l=[];s=q.length;for(r=0;ra?b(c,e-1):j[e]>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,j=0;jm-1?0:m-1,p=m+1>e-1?e-1:m+1,t=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,r=[],s=[0,0,g[4*(m*d+l)]/255*b];r.push([-1,0,g[4*(m*d+t)]/255*b]);r.push([-1,-1,g[4*(n*d+t)]/255*b]);r.push([0,-1,g[4*(n*d+l)]/255*b]);r.push([1,-1,g[4*(n*d+q)]/255*b]);r.push([1,0,g[4*(m*d+q)]/255*b]);r.push([1,1,g[4*(p*d+q)]/255*b]);r.push([0,1,g[4*(p*d+l)]/255*b]);r.push([-1,1,g[4*(p*d+t)]/255*b]);n=[];t=r.length;for(p=0;pe)return null;var f=[],g=[],h=[],i,j,m;if(0=p--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);m=j+1;e<=m&&(m=0);var l;a:{var r=l=void 0,s=void 0,n=void 0,q=void 0,y=void 0,u=void 0,x=void 0,t= -void 0,r=a[g[i]].x,s=a[g[i]].y,n=a[g[j]].x,q=a[g[j]].y,y=a[g[m]].x,u=a[g[m]].y;if(1E-10>(n-r)*(u-s)-(q-s)*(y-r))l=!1;else{var E=void 0,J=void 0,F=void 0,z=void 0,H=void 0,K=void 0,G=void 0,L=void 0,B=void 0,V=void 0,B=L=G=t=x=void 0,E=y-n,J=u-q,F=r-y,z=s-u,H=n-r,K=q-s;for(l=0;le)return null;var f=[],h=[],g=[],i,j,l;if(0=m--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{var p=n=void 0,t=void 0,q=void 0,r=void 0,s=void 0,v=void 0,z=void 0,C= +void 0,p=a[h[i]].x,t=a[h[i]].y,q=a[h[j]].x,r=a[h[j]].y,s=a[h[l]].x,v=a[h[l]].y;if(1E-10>(q-p)*(v-t)-(r-t)*(s-p))n=!1;else{var F=void 0,H=void 0,I=void 0,G=void 0,A=void 0,K=void 0,B=void 0,J=void 0,N=void 0,y=void 0,N=J=B=C=z=void 0,F=s-q,H=v-r,I=p-s,G=t-v,A=q-p,K=r-t;for(n=0;ni)g=d+1;else if(0b&&(b=0);1d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b}; -THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)}; -THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype); +THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0b&&(b=0);1d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,g.z,c.z,a);return b}); -THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e-=a;a+=0=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;cb?b=h.x:h.xc?c=h.y:h.yd?d=h.z:h.zb?b=g.x:g.xc?c=g.y:g.yd?d=g.z:g.zMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; -THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;aMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; +THREE.Path.prototype.toShapes=function(a){var b,c,d,e,f=[],h=new THREE.Path;b=0;for(c=this.actions.length;b -h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);p+l>n+q&&(h=r,g=m,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);p=c.slice(0,h);l=c.slice(h);r=j.slice(g);m=j.slice(0,g);f=[j[g],j[f],c[h]];s.push([j[g],c[h],c[e]]);s.push(f);c=p.concat(r).concat(m).concat(l)}return{shape:c, -isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,j={};f=0;for(g=d.length;fd;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;fd;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)}, +THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,j,l,m,n,p,t=[];for(i=0;i +g&&(g+=c.length);g%=c.length;0>h&&(h+=j.length);h%=j.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:j.length-1;q=[j[h],c[g],c[e]];q=THREE.FontUtils.Triangulate.area(q);r=[j[h],j[f],c[g]];r=THREE.FontUtils.Triangulate.area(r);m+n>q+r&&(g=p,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=j.length),h%=j.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:j.length-1);m=c.slice(0,g);n=c.slice(g);p=j.slice(h);l=j.slice(0,h);f=[j[h],j[f],c[g]];t.push([j[h],c[g],c[e]]);t.push(f);c=m.concat(p).concat(l).concat(n)}return{shape:c, +isolatedPts:t,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,j={};f=0;for(h=d.length;fd;d++)i=g[d].x+":"+g[d].y,i=j[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;fd;d++)i=g[d].x+":"+g[d].y,i=j[i],void 0!==i&&(g[d]=i)}return c.concat(e)}, isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+ -this.b3p3(a,e)}};THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;ca.hierarchy[c].keys[d].time&& -(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;dd.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};THREE.EllipseCurve=function(a,b,c,d,e,f,h){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)};THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a-=e;c[0]=0==e?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],h=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,h.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,h.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,h.z,c.z,a);return b});THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e-=a;a+=0a.hierarchy[c].keys[d].time&& +(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var g=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){g={};for(d=0;dr;r++){c=b[r];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(jd||1d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+ -(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d), +THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;cp;p++){c=b[p];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=l){if(jd||1d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+ +(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",m,h.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",m,g.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d), this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}}; -THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d}; -THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?ca.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];g=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;h=e*c;d[0]=this.interpolate(f[0],g[0],i[0],j[0],e,c,h);d[1]=this.interpolate(f[1],g[1],i[1],j[1],e,c,h);d[2]=this.interpolate(f[2],g[2],i[2],j[2],e,c,h);return d}; +THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a=h?b.interpolate(c,h):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;ag?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(A=c.length;0<=--A;){e=A;f=A-1;0>f&&(f=c.length-1);for(var g=0,h=r+2*m, -g=0;gMath.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(j,1-g),new THREE.Vector2(p,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(l,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2; +h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=p+2*l, +g=0;gMath.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(j,1-h),new THREE.Vector2(m,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-h),new THREE.Vector2(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2; THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;cc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,h=this,i=0,j=a.length;il&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>m&&(d[2].x+=1));this.mergeVertices();i=0;for(j=this.vertices.length;i=m){for(j=0;3>j;j++){m=[i[j],i[(j+1)%3]];p=!0;for(l=0;lh;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;dc.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))}}();THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)}; -THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var a=a||1,b=new THREE.Geometry,a=[new THREE.Vector3(a,a,a),new THREE.Vector3(-a,a,a),new THREE.Vector3(-a,-a,a),new THREE.Vector3(a,-a,a),new THREE.Vector3(a,a,-a),new THREE.Vector3(-a,a,-a),new THREE.Vector3(-a,-a,-a),new THREE.Vector3(a,-a,-a)];b.vertices.push(a[0],a[1],a[1],a[2],a[2],a[3],a[3],a[0],a[4],a[5],a[5],a[6],a[6],a[7],a[7],a[4],a[0],a[4],a[1],a[5],a[2],a[6],a[3],a[7]);this.vertices=a;THREE.Line.call(this,b,new THREE.LineBasicMaterial,THREE.LinePieces)}; -THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype); -THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.vertices;d[0].set(b.x,b.y,b.z);d[1].set(c.x,b.y,b.z);d[2].set(c.x,c.y,b.z);d[3].set(b.x,c.y,b.z);d[4].set(b.x,b.y,c.z);d[5].set(c.x,b.y,c.z);d[6].set(c.x,c.y,c.z);d[7].set(b.x,c.y,c.z);this.geometry.computeBoundingSphere();this.geometry.verticesNeedUpdate=!0;this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}THREE.Line.call(this);var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200); -b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}; +THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,h,g=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;ec&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,j=a.length;in&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(j=this.vertices.length;ic.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))}}();THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)}; +THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var b=[new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,1),new THREE.Vector3(1,-1,1),new THREE.Vector3(1,1,-1),new THREE.Vector3(-1,1,-1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1)];this.vertices=b;var c=new THREE.Geometry;c.vertices.push(b[0],b[1],b[1],b[2],b[2],b[3],b[3],b[0],b[4],b[5],b[5],b[6],b[6],b[7],b[7],b[4],b[0],b[4],b[1],b[5],b[2],b[6],b[3],b[7]);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces); +void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype); +THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.vertices;d[0].set(b.x,b.y,b.z);d[1].set(c.x,b.y,b.z);d[2].set(c.x,c.y,b.z);d[3].set(b.x,c.y,b.z);d[4].set(b.x,b.y,c.z);d[5].set(c.x,b.y,c.z);d[6].set(c.x,c.y,c.z);d[7].set(b.x,c.y,c.z);this.geometry.computeBoundingSphere();this.geometry.verticesNeedUpdate=!0;this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.BoundingBoxHelper=function(a,b){var c=b||8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.CubeGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)};THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200); +b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}; THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype); -THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,g,h,i){a.set(g,h,i);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d){g=0;for(h=d.length;gd;d++)c.faces[d].materialIndex=4>d?0:1;d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(a.color).multiplyScalar(a.intensity);var e=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});e.color.copy(a.groundColor).multiplyScalar(a.intensity);this.lightSphere=new THREE.Mesh(c,new THREE.MeshFaceMaterial([d, -e]));this.lightSphere.position=a.position;this.lightSphere.lookAt(new THREE.Vector3);this.add(this.lightSphere)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.update=function(){this.lightSphere.lookAt(new THREE.Vector3);this.lightSphere.material.materials[0].color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere.material.materials[1].color.copy(this.light.groundColor).multiplyScalar(this.light.intensity)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.light=a;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere=new THREE.Mesh(c,d);this.lightSphere.matrixWorld=this.light.matrixWorld;this.lightSphere.matrixAutoUpdate=!1;this.add(this.lightSphere)};THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype); -THREE.PointLightHelper.prototype.update=function(){this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a,b){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.light=a;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere=new THREE.Mesh(c,d);this.lightSphere.matrixWorld=this.light.matrixWorld;this.lightSphere.matrixAutoUpdate=!1;this.add(this.lightSphere);c=new THREE.CylinderGeometry(1E-4,1,1,8,1,!0);c.applyMatrix((new THREE.Matrix4).makeTranslation(0, --0.5,0));c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0,opacity:0.3,transparent:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightCone=new THREE.Mesh(c,d);this.lightCone.position=this.light.position;c=a.distance?a.distance:1E4;d=c*Math.tan(a.angle);this.lightCone.scale.set(d,d,c);this.lightCone.lookAt(this.light.target.position);this.add(this.lightCone)};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype); -THREE.SpotLightHelper.prototype.update=function(){var a=this.light.distance?this.light.distance:1E4,b=a*Math.tan(this.light.angle);this.lightCone.scale.set(b,b,a);this.lightCone.lookAt(this.light.target.position);this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightCone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype); +THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,h,g,i){a.set(h,g,i);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d){h=0;for(g=d.length;hd;d++)c.faces[d].color=this.colors[4>d?0:1];d=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(c,d);this.add(this.lightSphere); +this.update()};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.getPositionFromMatrix(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=!0}}();THREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld();var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrixWorld=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype); +THREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){var b=this.light.distance?this.light.distance:1E4,c=b*Math.tan(this.light.angle);this.cone.scale.set(c,c,b);this.cone.lookAt(a.getPositionFromMatrix(this.light.matrixWorld).negate());this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=b||1;for(var b=c||16711680,d=d||1,c=new THREE.Geometry,a=a.geometry.faces,e=0,f=a.length;eh.end&&(h.end=f);c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c}; +THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,h=e.morphTargets.length;fg.end&&(g.end=f);c||(c=i)}}for(i in d)g=d[i],this.createAnimation(i,g.start,g.end,a);this.firstAnimation=c}; THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)}; THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b}; THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1}; -THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;bd.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.startFrame+THREE.Math.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);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,j,m,p,l,r;this.init=function(s){b=s.context;c=s;d=s.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);s=0;e[s++]=-1;e[s++]=-1; -e[s++]=0;e[s++]=0;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16, +THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;bd.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.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),h=d.weight; +f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,j,l,m,n,p;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1; +e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16, 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE); -b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));l={};r={};l.vertex=b.getAttribLocation(p,"position");l.uv=b.getAttribLocation(p,"uv");r.renderType=b.getUniformLocation(p,"renderType");r.map=b.getUniformLocation(p,"map");r.occlusionMap=b.getUniformLocation(p,"occlusionMap");r.opacity= -b.getUniformLocation(p,"opacity");r.color=b.getUniformLocation(p,"color");r.scale=b.getUniformLocation(p,"scale");r.rotation=b.getUniformLocation(p,"rotation");r.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var x=new THREE.Vector3,t=f/e,E=0.5*e,J=0.5*f,F=16/f,z=new THREE.Vector2(F*t,F),H=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),G=r,F=l;b.useProgram(p);b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv); -b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(F.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(F.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var L,B,V,C,I;for(L=0;Lz;z++)t[z]=new THREE.Vector3,u[z]=new THREE.Vector3;t=E.shadowCascadeNearZ[x];E=E.shadowCascadeFarZ[x];u[0].set(-1,-1,t);u[1].set(1,-1,t);u[2].set(-1, -1,t);u[3].set(1,1,t);u[4].set(-1,-1,E);u[5].set(1,-1,E);u[6].set(-1,1,E);u[7].set(1,1,E);F.originalCamera=l;u=new THREE.Gyroscope;u.position=n.shadowCascadeOffset;u.add(F);u.add(F.target);l.add(u);n.shadowCascadeArray[y]=F;console.log("Created virtualLight",F)}x=n;t=y;E=x.shadowCascadeArray[t];E.position.copy(x.position);E.target.position.copy(x.target.position);E.lookAt(E.target);E.shadowCameraVisible=x.shadowCameraVisible;E.shadowDarkness=x.shadowDarkness;E.shadowBias=x.shadowCascadeBias[t];u=x.shadowCascadeNearZ[t]; -x=x.shadowCascadeFarZ[t];E=E.pointsFrustum;E[0].z=u;E[1].z=u;E[2].z=u;E[3].z=u;E[4].z=x;E[5].z=x;E[6].z=x;E[7].z=x;J[q]=F;q++}else J[q]=n,q++;r=0;for(s=J.length;rx;x++)t=E[x],t.copy(u[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(t,y),t.applyMatrix4(q.matrixWorldInverse),t.xj.x&&(j.x=t.x),t.yj.y&&(j.y=t.y),t.zj.z&& -(j.z=t.z);q.left=i.x;q.right=j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=n.shadowMap;u=n.shadowMatrix;y=n.shadowCamera;y.position.getPositionFromMatrix(n.matrixWorld);m.getPositionFromMatrix(n.target.matrixWorld);y.lookAt(m);y.updateMatrixWorld();y.matrixWorldInverse.getInverse(y.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(y.projectionMatrix);u.multiply(y.matrixWorldInverse); -h.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();E=p.__webglObjects;n=0;for(q=E.length;n=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};p={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");p.renderType=b.getUniformLocation(m,"renderType");p.map=b.getUniformLocation(m,"map");p.occlusionMap=b.getUniformLocation(m,"occlusionMap");p.opacity= +b.getUniformLocation(m,"opacity");p.color=b.getUniformLocation(m,"color");p.scale=b.getUniformLocation(m,"scale");p.rotation=b.getUniformLocation(m,"rotation");p.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var z=new THREE.Vector3,C=f/e,F=0.5*e,H=0.5*f,I=16/f,G=new THREE.Vector2(I*C,I),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),B=p,I=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv); +b.uniform1i(B.occlusionMap,0);b.uniform1i(B.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,N,y,M,w;for(J=0;JG;G++)C[G]=new THREE.Vector3,v[G]=new THREE.Vector3;C=F.shadowCascadeNearZ[z];F=F.shadowCascadeFarZ[z];v[0].set(-1,-1,C);v[1].set(1,-1,C);v[2].set(-1, +1,C);v[3].set(1,1,C);v[4].set(-1,-1,F);v[5].set(1,-1,F);v[6].set(-1,1,F);v[7].set(1,1,F);I.originalCamera=n;v=new THREE.Gyroscope;v.position=q.shadowCascadeOffset;v.add(I);v.add(I.target);n.add(v);q.shadowCascadeArray[s]=I;console.log("Created virtualLight",I)}z=q;C=s;F=z.shadowCascadeArray[C];F.position.copy(z.position);F.target.position.copy(z.target.position);F.lookAt(F.target);F.shadowCameraVisible=z.shadowCameraVisible;F.shadowDarkness=z.shadowDarkness;F.shadowBias=z.shadowCascadeBias[C];v=z.shadowCascadeNearZ[C]; +z=z.shadowCascadeFarZ[C];F=F.pointsFrustum;F[0].z=v;F[1].z=v;F[2].z=v;F[3].z=v;F[4].z=z;F[5].z=z;F[6].z=z;F[7].z=z;H[r]=I;r++}else H[r]=q,r++;p=0;for(t=H.length;pz;z++)C=F[z],C.copy(v[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(C,s),C.applyMatrix4(r.matrixWorldInverse),C.xj.x&&(j.x=C.x),C.yj.y&&(j.y=C.y),C.zj.z&& +(j.z=C.z);r.left=i.x;r.right=j.x;r.top=j.y;r.bottom=i.y;r.updateProjectionMatrix()}r=q.shadowMap;v=q.shadowMatrix;s=q.shadowCamera;s.position.getPositionFromMatrix(q.matrixWorld);l.getPositionFromMatrix(q.target.matrixWorld);s.lookAt(l);s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiply(s.projectionMatrix);v.multiply(s.matrixWorldInverse); +g.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(r);b.clear();F=m.__webglObjects;q=0;for(r=F.length;q 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;\nfloat fogFactor = 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}"}}; diff --git a/docs/59/api/cameras/Camera.html b/docs/59/api/cameras/Camera.html new file mode 100644 index 0000000000..66ff4d5328 --- /dev/null +++ b/docs/59/api/cameras/Camera.html @@ -0,0 +1,53 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
Abstract base class for cameras. This class should always be inherited when you build a new camera.
+ + +

Constructor

+ + +

[name]()

+
+ This constructor sets following properties to the correct type: matrixWorldInverse, projectionMatrix and projectionMatrixInverse. + +
+ + +

Properties

+ +

.[page:Matrix4 matrixWorldInverse]

+
This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.
+ +

.[page:Matrix4 projectionMatrix]

+
This is the matrix which contains the projection.
+ +

.[page:Matrix4 projectionMatrixInverse]

+
This is the inverse of projectionMatrix.
+ + +

Methods

+ +

.lookAt( [page:Vector3 vector] )

+
+ vector — point to look at
+
+ This makes the camera look at the vector position in the global space as long as the parent of this camera is the scene or at position (0,0,0). +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/cameras/OrthographicCamera.html b/docs/59/api/cameras/OrthographicCamera.html new file mode 100644 index 0000000000..d05ca1c168 --- /dev/null +++ b/docs/59/api/cameras/OrthographicCamera.html @@ -0,0 +1,70 @@ + + + + + + + + + + [page:Object3D] → [page:Camera] → + +

[name]

+ +
Camera with orthographic projection.
+ + +

Example

+ + var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); +scene.add( camera ); + + +

Constructor

+ + +

[name]( [page:Float left], [page:Float right], [page:Float top], [page:Float bottom], [page:Float near], [page:Float far] )

+
+ left — Camera frustum left plane.
+ right — Camera frustum right plane.
+ top — Camera frustum top plane.
+ bottom — Camera frustum bottom plane.
+ near — Camera frustum near plane.
+ far — Camera frustum far plane. +
+ + +

Properties

+ +

.[page:Float left]

+
Camera frustum left plane.
+ +

.[page:Float right]

+
Camera frustum right plane.
+ +

.[page:Float top]

+
Camera frustum top plane.
+ +

.[page:Float bottom]

+
Camera frustum bottom plane.
+ +

.[page:Float near]

+
Camera frustum near plane.
+ +

.[page:Float far]

+
Camera frustum far plane.
+ + +

Methods

+ +

.updateProjectionMatrix()

+
+ Updates the camera projection matrix. Must be called after change of parameters. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/cameras/PerspectiveCamera.html b/docs/59/api/cameras/PerspectiveCamera.html new file mode 100644 index 0000000000..21a37a5e13 --- /dev/null +++ b/docs/59/api/cameras/PerspectiveCamera.html @@ -0,0 +1,120 @@ + + + + + + + + + + [page:Object3D] → [page:Camera] → + +

[name]

+ +
Camera with perspective projection.
+ + +

Example

+ + var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); +scene.add( camera ); + + +

Constructor

+ + +

[name]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )

+
+ fov — Camera frustum vertical field of view.
+ aspect — Camera frustum aspect ratio.
+ near — Camera frustum near plane.
+ far — Camera frustum far plane. +
+ + +

Properties

+ +

.[page:Float fov]

+
Camera frustum vertical field of view, from bottom to top of view, in degrees.
+ +

.[page:Float aspect]

+
Camera frustum aspect ratio, window width divided by window height.
+ +

.[page:Float near]

+
Camera frustum near plane.
+ +

.[page:Float far]

+
Camera frustum far plane.
+ + +

Methods

+ +

.setLens( [page:Float focalLength], [page:Float frameSize] )

+
+ focalLength — focal length
+ frameSize — frame size +
+ +
+ Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.
+ Formula based on [link:http://www.bobatkins.com/photography/technical/field_of_view.html] +
+ +

.setViewOffset( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )

+
+ fullWidth — full width of multiview setup
+ fullHeight — full height of multiview setup
+ x — horizontal offset of subcamera
+ y — vertical offset of subcamera
+ width — width of subcamera
+ height — height of subcamera +
+ +
+ Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. +
+ +
+ For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:
+ +
+---+---+---+
+| A | B | C |
++---+---+---+
+| D | E | F |
++---+---+---+
+ + then for each monitor you would call it like this:
+ + var w = 1920; +var h = 1080; +var fullWidth = w * 3; +var fullHeight = h * 2; + +// A +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); +// B +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); +// C +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); +// D +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); +// E +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); +// F +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); + + + Note there is no reason monitors have to be the same size or in a grid. +
+ +

.updateProjectionMatrix()

+
+ Updates the camera projection matrix. Must be called after change of parameters. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/BufferGeometry.html b/docs/59/api/core/BufferGeometry.html new file mode 100644 index 0000000000..2f5005da84 --- /dev/null +++ b/docs/59/api/core/BufferGeometry.html @@ -0,0 +1,156 @@ + + + + + + + + + +

[name]

+ +
+ This is a superefficent class for geometries because it saves all data in buffers.
+ It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the necessary buffer calculations.
+ It is mainly interesting when working with static objects. +
+ + +

Constructor

+ + +

[name]()

+
+ This creates a new [name]. It also sets several properties to an default value. +
+ + +

Properties

+ +

.[page:Integer id]

+
+ Unique number of this buffergeometry instance +
+ +

.[page:Hashmap attributes]

+
+ This hashmap has as id the name of the attribute to be set and as value the buffer to set it to. +
+ +

.[page:Boolean dynamic]

+
+ When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory. +
+ +

.[page:Array offsets]

+
+ This Array should contain every offset at which the buffers should be rendered. This is important for indexed buffers. +
+ +

.[page:Object boundingBox]

+
+ Bounding box. + { min: new THREE.Vector3(), max: new THREE.Vector3() } +
+ +

.[page:Object boundingSphere]

+
+ Bounding sphere. + { radius: float } +
+ +

.[page:Array morphTargets]

+
+ Array of morph targets. Each morph target is a Javascript object: + { name: "targetName", vertices: [ new THREE.Vertex(), ... ] } + Morph vertices match number and order of primary vertices. +
+ +

.[page:boolean hasTangents]

+
+ todo +
+ +

Methods

+ +

.applyMatrix( [page:Matrix4 matrix] )

+
+ Bakes matrix transform directly into vertex coordinates. +
+ +

.computeVertexNormals()

+
+ Computes vertex normals by averaging face normals.
+
+ +

.computeTangents()

+
+ Computes vertex tangents.
+ Based on [link:http://www.terathon.com/code/tangent.html]
+ Geometry must have vertex [page:UV UVs] (layer 0 will be used). +
+ +

.computeBoundingBox()

+
+ Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
+ Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*. +
+ +

.computeBoundingSphere()

+
+ Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
+ Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are *null*. +
+ +

.dispose()

+
+ Disposes the object from memory.
+ You need to call this when you want the bufferGeometry removed while the application is running. +
+ + +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.normalizeNormals() [page:todo]

+
+ todo +
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Clock.html b/docs/59/api/core/Clock.html new file mode 100644 index 0000000000..01d6733be3 --- /dev/null +++ b/docs/59/api/core/Clock.html @@ -0,0 +1,82 @@ + + + + + + + + + +

[name]

+ +
Object for keeping track of time.
+ + +

Constructor

+ + +

[name]( [page:Boolean autoStart] )

+
+ autoStart — Automatically start the clock. +
+ +

Properties

+ +

.[page:Boolean autoStart]

+
+ If set, starts the clock automatically when the first update is called. +
+ +

.[page:Float startTime]

+
+ When the clock is running, It holds the start time of the clock.
+ This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. +
+ + +

.[page:Float oldTime]

+
+ When the clock is running, It holds the previous time from a update.
+ This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. +
+ +

.[page:Float elapsedTime]

+
+ When the clock is running, It holds the time elapsed between the start of the clock to the previous update.
+ This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. +
+ +

.[page:Boolean running]

+
+ This property keeps track whether the clock is running or not. +
+ + +

Methods

+ +

.start()

+
+ Starts clock. +
+ +

.stop()

+
+ Stops clock. +
+ +

.getElapsedTime() [page:Float]

+
+ Get the seconds passed since the clock started. +
+ +

.getDelta() [page:Float]

+
+ Get the seconds passed since the last call to this method. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/EventDispatcher.html b/docs/59/api/core/EventDispatcher.html new file mode 100644 index 0000000000..400db6df2f --- /dev/null +++ b/docs/59/api/core/EventDispatcher.html @@ -0,0 +1,66 @@ + + + + + + + + + +

[name]

+ +
JavaScript events for custom objects.
+ https://github.com/mrdoob/eventdispatcher.js
+ +

Constructor

+ + +

[name]()

+
+ Creates EventDispatcher object. +
+ + +

Methods

+ +

.addEventListener( [page:String type], [page:Function listener] )

+
+ type - The type of event to listen to.
+ listener - The function that gets called when the event is fired. +
+
+ Adds a listener to an event type. +
+ +

.hasEventListener( [page:String type], [page:Function listener] )

+
+ type - The type of event to listen to.
+ listener - The function that gets called when the event is fired. +
+
+ Checks if listener is added to an event type. +
+ +

.removeEventListener( [page:String type], [page:Function listener] )

+
+ type - The type of the listener that gets removed.
+ listener - The listener function that gets removed. +
+
+ Removes a listener from an event type. +
+ +

.dispatchEvent( [page:String type] )

+
+ type - The type of event that gets fired. +
+
+ Fire an event type. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Face3.html b/docs/59/api/core/Face3.html new file mode 100644 index 0000000000..b85716e4d7 --- /dev/null +++ b/docs/59/api/core/Face3.html @@ -0,0 +1,101 @@ + + + + + + + + + +

[name]

+ +
+ Triangle face. +
+ + +

Example

+ + var normal = new THREE.Vector3( 0, 1, 0 ); + var color = new THREE.Color( 0xffaa00 ); + var face = new THREE.Face3( 0, 1, 2, normal, color, 0 ); + + +

Constructor

+ +

[name]( [page:Integer a], [page:Integer b], [page:Integer c], [page:Vector3 normal], [page:Color color], [page:Integer materialIndex] )

+
+ a — Vertex A index.
+ b — Vertex B index.
+ c — Vertex C index.
+ normal — Face normal or array of vertex normals.
+ color — Face color or array of vertex colors.
+ materialIndex — Material index. +
+ +

Properties

+ +

.[page:Integer a]

+
+ Vertex A index. +
+ +

.[page:Integer b]

+
+ Vertex B index. +
+ +

.[page:Integer c]

+
+ Vertex C index. +
+ +

.[page:Vector3 normal]

+
+ Face normal. +
+ +

.[page:Color color]

+
+ Face color. +
+ +

.[page:Array vertexNormals]

+
+ Array of 3 vertex normals. +
+ +

.[page:Array vertexColors]

+
+ Array of 3 vertex colors. +
+ +

.[page:Array vertexTangents]

+
+ Array of 3 vertex tangents. +
+ + +

.[page:Integer materialIndex]

+
+ Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials]). +
+ +

.[page:Vector3 centroid]

+
+ Face centroid. +
+ +

Methods

+ +

.clone()

+
+ Creates a new clone of the Face3 object. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Face4.html b/docs/59/api/core/Face4.html new file mode 100644 index 0000000000..51b75f4020 --- /dev/null +++ b/docs/59/api/core/Face4.html @@ -0,0 +1,108 @@ + + + + + + + + + +

[name]

+ +
+ Quad face. +
+ + +

Example

+ + var normal = new THREE.Vector3( 0, 1, 0 ); + var color = new THREE.Color( 0xffaa00 ); + var face = new THREE.Face4( 0, 1, 2, 3, normal, color, 0 ); + + +

Constructor

+ + +

[name]( [page:Integer a], [page:Integer b], [page:Integer c], [page:Integer d], [page:Vector3 normal], [page:Color color], [page:Integer materialIndex] )

+
+ a — Vertex A index.
+ b — Vertex B index.
+ c — Vertex C index.
+ d — Vertex D index.
+ normal — Face normal or array of vertex normals.
+ color — Face color or array of vertex colors.
+ materialIndex — Material index. +
+ +

Properties

+ +

.[page:Integer a]

+
+ Vertex A index. +
+ +

.[page:Integer b]

+
+ Vertex B index. +
+ +

.[page:Integer c]

+
+ Vertex C index. +
+ +

.[page:Integer d]

+
+ Vertex D index. +
+ +

.[page:Vector3 normal]

+
+ Face normal. +
+ +

.[page:Color color]

+
+ Face color. +
+ +

.[page:Array vertexNormals]

+
+ Array of 4 vertex normals. +
+ +

.[page:Array vertexColors]

+
+ Array of 4 vertex colors. +
+ +

.[page:Array vertexTangents]

+
+ Array of 4 vertex tangets. +
+ + +

.[page:Integer materialIndex]

+
+ Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials]). +
+ +

.[page:Vector3 centroid]

+
+ Face centroid. +
+ +

Methods

+ +

.clone()

+
+ Creates a new clone of the Face4 object. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Geometry.html b/docs/59/api/core/Geometry.html new file mode 100644 index 0000000000..4f8f09a135 --- /dev/null +++ b/docs/59/api/core/Geometry.html @@ -0,0 +1,308 @@ + + + + + + + + + +

[name]

+ +
+ Base class for geometries.
+ A geometry holds all data necessary to describe a 3D model. +
+ + +

Example

+ + var geometry = new THREE.Geometry() + + geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) ); + geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) ); + geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) ); + + geometry.faces.push( new THREE.Face3( 0, 1, 2 ) ); + + geometry.computeBoundingSphere(); + + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

.[page:Integer id]

+
+ Unique number of this geometry instance +
+ +

.[page:String name]

+
+ Name for this geometry. Default is an empty string. +
+ +

.[page:Array vertices]

+
+ Array of [page:Vector3 vertices].
+ The array of vertices hold every position of points of the model.
+ To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true. +
+ +

.[page:Array colors]

+
+ Array of vertex [page:Color colors], matching number and order of vertices.
+ Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].
+ [page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.
+ To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true. +
+ +

.[page:Array normals]

+
+ Array of vertex [page:Vector3 normals], matching number and order of vertices.
+ [link:http://en.wikipedia.org/wiki/Normal_(geometry) Normal vectors] are nessecary for lighting
+ To signal an update in this array, [page:Geometry Geometry.normalsNeedUpdate] needs to be set to true. +
+ +

.[page:Array faces]

+
+ Array of [page:Face3 triangles] or/and [page:Face4 quads].
+ The array of faces describe how each vertex in the model is connected with each other.
+ To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true. +
+ +

.[page:Array faceUvs]

+
+ Array of face [page:UV] layers.
+ Each UV layer is an array of [page:UV] matching order and number of faces.
+ To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true. +
+ +

.[page:Array faceVertexUvs]

+
+ Array of face [page:UV] layers.
+ Each UV layer is an array of [page:UV] matching order and number of vertices in faces.
+ To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true. +
+ +

.[page:Array morphTargets]

+
+ Array of morph targets. Each morph target is a Javascript object: + { name: "targetName", vertices: [ new THREE.Vector3(), ... ] } + Morph vertices match number and order of primary vertices. +
+ +

.[page:Array morphColors]

+
+ Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object: + morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] } + Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors). +
+ +

.[page:Array morphNormals]

+
+ Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object: + morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] } +
+ +

.[page:Array skinWeights]

+
+ Array of skinning weights, matching number and order of vertices. +
+ +

.[page:Array skinIndices]

+
+ Array of skinning indices, matching number and order of vertices. +
+ +

.[page:Object boundingBox]

+
+ Bounding box. + { min: new THREE.Vector3(), max: new THREE.Vector3() } +
+ +

.[page:Object boundingSphere]

+
+ Bounding sphere. + { radius: float } +
+ +

.[page:Boolean hasTangents]

+
+ True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents]. +
+ +

.[page:Boolean dynamic]

+
+ Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).
+ Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
+ Defaults to true. +
+ +

.[page:Boolean verticesNeedUpdate]

+
+ Set to *true* if the vertices array has been updated. +
+ +

.[page:Boolean elementsNeedUpdate]

+
+ Set to *true* if the faces array has been updated. +
+ +

.[page:Boolean uvsNeedUpdate]

+
+ Set to *true* if the uvs array has been updated. +
+ +

.[page:Boolean normalsNeedUpdate]

+
+ Set to *true* if the normals array has been updated. +
+ +

.[page:Boolean tangentsNeedUpdate]

+
+ Set to *true* if the tangents in the faces has been updated. +
+ +

.[page:Boolean colorsNeedUpdate]

+
+ Set to *true* if the colors array has been updated. +
+ +

.[page:Boolean lineDistancesNeedUpdate]

+
+ Set to *true* if the linedistances array has been updated. +
+ +

.[page:Boolean buffersNeedUpdate]

+
+ Set to *true* if an array has changed in length. +
+ +

.[page:array morphNormals]

+
+ todo +
+ +

.[page:array lineDistances]

+
+ todo +
+ +

Methods

+ +

.applyMatrix( [page:Matrix4 matrix] )

+
+ Bakes matrix transform directly into vertex coordinates. +
+ +

.computeCentroids()

+
+ Computes centroids for all faces. +
+ +

.computeFaceNormals()

+
+ Computes face normals. +
+ +

.computeVertexNormals()

+
+ Computes vertex normals by averaging face normals.
+ Face normals must be existing / computed beforehand. +
+ +

.computeMorphNormals()

+
+ Computes morph normals. +
+ +

.computeTangents()

+
+ Computes vertex tangents.
+ Based on [link:http://www.terathon.com/code/tangent.html]
+ Geometry must have vertex [page:UV UVs] (layer 0 will be used). +
+ +

.computeBoundingBox()

+
+ Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute. +
+ +

.computeBoundingSphere()

+
+ Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute. +
+ +
Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.
+ +

.mergeVertices()

+
+ Checks for duplicate vertices using hashmap.
+ Duplicated vertices are removed and faces' vertices are updated. +
+ +

.clone()

+
+ Creates a new clone of the Geometry. +
+ +

.dispose()

+
+ Removes The object from memory.
+ Don't forget to call this method when you remove an geometry because it can cuase meomory leaks. +
+ + +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.computeLineDistances() [page:todo]

+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Object3D.html b/docs/59/api/core/Object3D.html new file mode 100644 index 0000000000..553f9cb6e0 --- /dev/null +++ b/docs/59/api/core/Object3D.html @@ -0,0 +1,282 @@ + + + + + + + + + +

[name]

+ +
Base class for scene graph objects.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

.[page:Integer id]

+
+ Unique number of this object instance. +
+ +

.[page:String name]

+
+ Optional name of the object (doesn't need to be unique). +
+ +

.[page:Object3D parent]

+
+ Object's parent in the scene graph. +
+ +

.[page:Object3D children]

+
+ Array with object's children. +
+ +

.[page:Vector3 position]

+
+ Object's local position. +
+ +

.[page:Vector3 rotation]

+
+ Object's local rotation (Euler angles), in radians. +
+ +

.[page:String eulerOrder]

+
+ Order of axis for Euler angles. +
+ +

.[page:Vector3 scale]

+
+ Object's local scale. +
+ +

.[page:Vector3 up]

+
+ Up direction. +
+ +

.[page:Matrix4 matrix]

+
+ Local transform. +
+ +

.[page:Quaternion quaternion]

+
+ Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true. +
+ +

.[page:Boolean useQuaternion]

+
+ Use quaternion instead of Euler angles for specifying local rotation. +
+ +

.[page:Float renderDepth]

+
+ Override depth-sorting order if non *null*. +
+ +

.[page:Boolean visible]

+
+ Object gets rendered if *true*. +
+ +

.[page:Boolean castShadow]

+
+ Gets rendered into shadow map. +
+ +

.[page:Boolean receiveShadow]

+
+ Material gets baked in shadow receiving. +
+ +

.[page:Boolean frustumCulled]

+
+ When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible. +
+ +

.[page:Boolean matrixAutoUpdate]

+
+ When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property. +
+ +

.[page:Boolean matrixWorldNeedsUpdate]

+
+ When this is set, it calculates the matrixWorld in that frame and resets this property to false. +
+ +

.[page:Boolean rotationAutoUpdate]

+
+ When this is set, then the rotationMatrix gets calculated every frame. +
+ +

.[page:object userData]

+
+ todo +
+ +

.[page:Matrix4 matrixWorld]

+
+ todo +
+ +

Methods

+ +

.applyMatrix( [page:Matrix4 matrix])

+
+ matrix - matrix +
+
+ This updates the position, rotation and scale with the matrix. +
+ +

.translateX( [page:Float distance] )

+
+ distance - Distance.
+
+
+ Translates object along x axis by distance. +
+ +

.translateY( [page:Float distance] )

+
+ distance - Distance.
+
+
+ Translates object along y axis by distance. +
+ +

.translateZ( [page:Float distance] )

+
+ distance - Distance.
+
+
+ Translates object along z axis by distance. +
+ +

.localToWorld( [page:Vector3 vector] )

+
+ vector - A local vector.
+
+
+ Updates the vector from local space to world space. +
+ +

.worldToLocal( [page:Vector3 vector] )

+
+ vector - A world vector.
+
+
+ Updates the vector from world space to local space. +
+ +

.lookAt( [page:Vector3 vector] )

+
+ vector - A world vector to look at.
+
+
+ Rotates object to face point in space. +
+ +

.add( [page:Object3D object] )

+
+ object - An object.
+
+
+ Adds *object* as child of this object. +
+ +

.remove( [page:Object3D object] )

+
+ object - An object.
+
+
+ Removes *object* as child of this object. +
+ +

.traverse( [page:Function callback] )

+
+ callback - An Function with as first argument an object3D object.
+
+
+ Executes the callback on this object and all descendants. +
+ +

.getDescendants( [page:Array array] )

+
+ array - optional argument that returns the the array with descendants.
+
+
+ Searches whole subgraph recursively to add all objects in the array. +
+ +

.updateMatrix()

+
+ Updates local transform. +
+ +

.updateMatrixWorld( [page:Boolean force] )

+
+ Updates global transform of the object and its children. +
+ +

.clone()

+
+ Creates a new clone of this object and all descendants. +
+ + +

.getObjectByName([page:todo name], [page:todo recursive]) [page:todo]

+
+ name -- todo
+ recursive -- todo +
+
+ todo +
+ +

.translateOnAxis([page:todo axis], [page:todo distance]) [page:todo]

+
+ axis -- todo
+ distance -- todo +
+
+ todo +
+ +

.getObjectById([page:todo id], [page:todo recursive]) [page:todo]

+
+ id -- todo
+ recursive -- todo +
+
+ todo +
+ +

.rotateOnAxis([page:todo axis], [page:todo angle]) [page:todo]

+
+ axis -- todo
+ angle -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Projector.html b/docs/59/api/core/Projector.html new file mode 100644 index 0000000000..f08f538d46 --- /dev/null +++ b/docs/59/api/core/Projector.html @@ -0,0 +1,70 @@ + + + + + + + + + +

[name]

+ +
Projects points between spaces.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

Methods

+ +

.projectVector( [page:Vector3 vector], [page:Camera camera] ) [page:Vector3]

+
+ [page:Vector3 vector] — vector to project.
+ [page:Camera camera] — camera to use in the projection.
+
+
+ Projects a vector with the camera. Caution, this method changes 'vector'. +
+ +

.unprojectVector( [page:Vector3 vector], [page:Camera camera] ) [page:Vector3]

+
+ [page:Vector3 vector] — vector to unproject.
+ [page:Camera camera] — camera to use in the projection.
+
+
+ Unprojects a vector with the camera. Caution, this method changes 'vector'. +
+ +

.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Raycaster]

+
+ Translates a 2D point from NDC (Normalized Device Coordinates) to a [page:Raycaster] that can be used for picking. NDC range from [-1..1] in x (left to right) and [1.0 .. -1.0] in y (top to bottom). +
+ +

.projectScene( [page:Scene scene], [page:Camera camera], [page:Boolean sort] ) [page:Object]

+
+ [page:Scene scene] — scene to project.
+ [page:Camera camera] — camera to use in the projection.
+ [page:Boolean sort] — select whether to sort elements using the Painter's algorithm. +
+ +
+ Transforms a 3D [page:Scene scene] object into 2D render data that can be rendered in a screen with your renderer of choice, projecting and clipping things out according to the used camera. +
+
+ If the scene were a real scene, this method would be the equivalent of taking a picture with the camera (and developing the film would be the next step, using a Renderer). +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/core/Raycaster.html b/docs/59/api/core/Raycaster.html new file mode 100644 index 0000000000..cd1b1d05f9 --- /dev/null +++ b/docs/59/api/core/Raycaster.html @@ -0,0 +1,91 @@ + + + + + + + + + +

[name]

+ +
+ This class makes raycasting easier. Raycasting is used for picking and more. + +
+ + +

Constructor

+ + +

[name]( [page:Vector3 origin], [page:Vector3 direction], [page:Float near], [page:Float far] ) {

+
+ [page:Vector3 origin] — The origin vector where the ray casts from.
+ [page:Vector3 direction] — The direction vector that gives direction to the ray.
+ [page:Float near] — All results returned are further away then near. Near can't be negative. Default value is 0.
+ [page:Float far] — All results returned are closer then far. Far can't be lower then near . Default value is Infinity. +
+
+ This creates a new raycaster object.
+
+ + +

Properties

+ +

.[page:Ray ray]

+
+ The Ray used for the raycasting. +
+ +

.[page:float near]

+
+ The near factor of the raycaster. This value indicates which objects can be discarded based on the distance.
+ This value shouldn't be negative and should be smaller then the far property. +
+ +

.[page:float far]

+
+ The far factor of the raycaster. This value indicates which objects can be discarded based on the distance.
+ This value shouldn't be negative and should be smaller then the far property. +
+ +

.[page:float precision]

+
+ The precision factor of the raycaster. +
+ +

Methods

+ +

.set( [page:Vector3 origin], [page:Vector3 direction] )

+
+ [page:Vector3 origin] — The origin vector where the ray casts from.
+ [page:Vector3 direction] — The direction vector that gives direction to the ray. +
+
+ Updates the ray with a new origin and direction. +
+ +

.intersectObject( [page:Object3D object], [page:Boolean recursive] )

+
+ [page:Object3D object] — The object to check for intersection with the ray.
+ [page:Boolean recursive] — If set, it also checks all descendants. Otherwise it only checks intersecton with the object. +
+
+ checks all intersection between the ray and the object with or without the descendants. +
+ +

.intersectObjects( [page:Array objects], [page:Boolean recursive] )

+
+ [page:Array objects] — The objects to check for intersection with the ray.
+ [page:Boolean recursive] — If set, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. +
+
+ checks all intersection between the ray and the objects with or without the descendants. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/FontUtils.html b/docs/59/api/extras/FontUtils.html new file mode 100644 index 0000000000..6db8df1f7c --- /dev/null +++ b/docs/59/api/extras/FontUtils.html @@ -0,0 +1,108 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Properties

+ + + +

.[page:number divisions]

+
+ todo +
+ +

.[page:string style]

+
+ todo +
+ +

.[page:string weight]

+
+ todo +
+ +

.[page:string face]

+
+ todo +
+ +

.[page:object faces]

+
+ todo +
+ +

.[page:number size]

+
+ todo +
+ +

Methods

+ + + +

.drawText([page:todo text]) [page:todo]

+
+ text -- todo +
+
+ todo +
+ +

.Triangulate([page:todo contour], [page:todo indices]) [page:todo]

+
+ contour -- todo
+ indices -- todo +
+
+ todo +
+ +

.extractGlyphPoints([page:todo c], [page:todo face], [page:todo scale], [page:todo offset], [page:todo path]) [page:todo]

+
+ c -- todo
+ face -- todo
+ scale -- todo
+ offset -- todo
+ path -- todo +
+
+ todo +
+ +

.generateShapes([page:todo text], [page:todo parameters]) [page:todo]

+
+ text -- todo
+ parameters -- todo +
+
+ todo +
+ +

.loadFace([page:todo data]) [page:todo]

+
+ data -- todo +
+
+ todo +
+ +

.getFace() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/GeometryUtils.html b/docs/59/api/extras/GeometryUtils.html new file mode 100644 index 0000000000..12677b5b60 --- /dev/null +++ b/docs/59/api/extras/GeometryUtils.html @@ -0,0 +1,102 @@ + + + + + + + + + +

[name]

+ +
Contains handy functions geometry manipulations.
+ + +

Methods

+ +

.merge( [page:Geometry geometry1] , [page:Geometry geometry2], [page:Integer materialIndexOffset] )

+
+ geometry1 — Parent geomentry element
+ geometry2 — Geometry that need to be added in parent
+ materialIndexOffset — Offset applied to the materialIndex of all the new faces in the merged geometry. Default : 0
+
+ +

.removeMaterials( [page:Geometry geometry1] , [page:Material materialIndexArray] )

+
+ geometry — Geometry that need to remove material
+ materialIndex — Material index
+
+ +

.randomPointInTriangle( [page:Vector VectorA] , [page:Vector VectorB] , [page:Vector VectorC])

+
+ VectorA — Vector
+ VectorB — Vector
+ VectorC — Vector
+ + returns [page:Int Point] + +
+ +

.randomPointInFace( [page:face Face] , [page:geometry Geometry] , [page:Boolean useCachedAreas])

+
+ Face — Face id
+ Geometry — Geometry that contains the Face
+ useCachedAreas — Flag to use cached areas. Default : False
+ + returns [page:Int Point] + +
+ +

.randomPointsInGeometry( [page:geometry Geometry] , [page:Integer Points])

+
+ Geometry — Geometry
+ + returns [page:Int Point] + +
+ + +

.triangleArea ( [page:Vector VectorA] , [page:Vector VectorB] , [page:Vector VectorC])

+ +
+ VectorA — Vector
+ VectorB — Vector
+ VectorC — Vector
+ + returns [page:Int Area] + +
+ +

.center ( [page:geometry Geometry] )

+ +
+ + Geometry — Geometry to Center position + +
+ +

.triangulateQuads ( [page:geometry Geometry] )

+ +
+ + Geometry — Geometry to triangulate Quads
+ +
+ +

.setMaterialIndex ( [page:geometry Geometry] , [page:Integer index], [page:Face startFace], [page:Face endFace])

+ +
+ + Geometry — Geometry
+ Index — New index value for the material
+ startFace — Starting range of Face
+ endFace — Final range of Face
+ +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/ImageUtils.html b/docs/59/api/extras/ImageUtils.html new file mode 100644 index 0000000000..fe6685d737 --- /dev/null +++ b/docs/59/api/extras/ImageUtils.html @@ -0,0 +1,104 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Properties

+ + + +

.[page:string crossOrigin]

+
+ todo +
+ +

Methods

+ + + +

.generateDataTexture([page:todo width], [page:todo height], [page:todo color]) [page:todo]

+
+ width -- todo
+ height -- todo
+ color -- todo +
+
+ todo +
+ +

.parseDDS([page:todo buffer], [page:todo loadMipmaps]) [page:todo]

+
+ buffer -- todo
+ loadMipmaps -- todo +
+
+ todo +
+ +

.loadCompressedTexture([page:todo url], [page:todo mapping], [page:todo onLoad], [page:todo onError]) [page:todo]

+
+ url -- todo
+ mapping -- todo
+ onLoad -- todo
+ onError -- todo +
+
+ todo +
+ +

.loadTexture([page:todo url], [page:todo mapping], [page:todo onLoad], [page:todo onError]) [page:todo]

+
+ url -- todo
+ mapping -- todo
+ onLoad -- todo
+ onError -- todo +
+
+ todo +
+ +

.getNormalMap([page:todo image], [page:todo depth]) [page:todo]

+
+ image -- todo
+ depth -- todo +
+
+ todo +
+ +

.loadCompressedTextureCube([page:todo array], [page:todo mapping], [page:todo onLoad], [page:todo onError]) [page:todo]

+
+ array -- todo
+ mapping -- todo
+ onLoad -- todo
+ onError -- todo +
+
+ todo +
+ +

.loadTextureCube([page:todo array], [page:todo mapping], [page:todo onLoad], [page:todo onError]) [page:todo]

+
+ array -- todo
+ mapping -- todo
+ onLoad -- todo
+ onError -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/SceneUtils.html b/docs/59/api/extras/SceneUtils.html new file mode 100644 index 0000000000..c809e948f7 --- /dev/null +++ b/docs/59/api/extras/SceneUtils.html @@ -0,0 +1,51 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Methods

+ + +

.createMultiMaterialObject([page:todo geometry], [page:todo materials]) [page:todo]

+
+ geometry -- todo
+ materials -- todo +
+
+ todo +
+ +

.attach([page:todo child], [page:todo scene], [page:todo parent]) [page:todo]

+
+ child -- todo
+ scene -- todo
+ parent -- todo +
+
+ todo +
+ +

.detach([page:todo child], [page:todo parent], [page:todo scene]) [page:todo]

+
+ child -- todo
+ parent -- todo
+ scene -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/animation/Animation.html b/docs/59/api/extras/animation/Animation.html new file mode 100644 index 0000000000..90c2afcd07 --- /dev/null +++ b/docs/59/api/extras/animation/Animation.html @@ -0,0 +1,144 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo root], [page:todo name], [page:todo interpolationType])

+
+ root -- todo
+ name -- todo
+ interpolationType -- todo +
+
+ todo +
+ +

Properties

+ +

.[page:todo root]

+
+ todo +
+ +

.[page:todo data]

+
+ todo +
+ +

.[page:todo hierarchy]

+
+ todo +
+ +

.[page:number currentTime]

+
+ todo +
+ +

.[page:number timeScale]

+
+ todo +
+ +

.[page:boolean isPlaying]

+
+ todo +
+ +

.[page:boolean isPaused]

+
+ todo +
+ +

.[page:boolean loop]

+
+ todo +
+ +

.[page:number interpolationType]

+
+ todo +
+ +

.[page:array points]

+
+ todo +
+ +

.[page:Vector3 target]

+
+ todo +
+ +

Methods

+ +

.play() [page:todo]

+
+ todo +
+ +

.pause() [page:todo]

+
+ todo +
+ +

.stop() [page:todo]

+
+ todo +
+ +

.update([page:todo deltaTimeMS]) [page:todo]

+
+ deltaTimeMS -- todo +
+
+ todo +
+ +

.interpolateCatmullRom([page:todo points], [page:todo scale]) [page:todo]

+
+ points -- todo
+ scale -- todo +
+
+ todo +
+ +

.getNextKeyWith([page:todo type], [page:todo h], [page:todo key]) [page:todo]

+
+ type -- todo
+ h -- todo
+ key -- todo +
+
+ todo +
+ +

.getPrevKeyWith([page:todo type], [page:todo h], [page:todo key]) [page:todo]

+
+ type -- todo
+ h -- todo
+ key -- todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/animation/AnimationHandler.html b/docs/59/api/extras/animation/AnimationHandler.html new file mode 100644 index 0000000000..b730e142aa --- /dev/null +++ b/docs/59/api/extras/animation/AnimationHandler.html @@ -0,0 +1,97 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ +

Properties

+ + +

.[page:number CATMULLROM]

+
+ todo +
+ +

.[page:number CATMULLROM_FORWARD]

+
+ todo +
+ +

.[page:number LINEAR]

+
+ todo +
+ +

Methods

+ + + +

.removeFromUpdate([page:todo animation]) [page:todo]

+
+ animation -- todo +
+
+ todo +
+ +

.get([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.update([page:todo deltaTimeMS]) [page:todo]

+
+ deltaTimeMS -- todo +
+
+ todo +
+ +

.parse([page:todo root]) [page:todo]

+
+ root -- todo +
+
+ todo +
+ +

.add([page:todo data]) [page:todo]

+
+ data -- todo +
+
+ todo +
+ +

.addToUpdate([page:todo animation]) [page:todo]

+
+ animation -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/animation/AnimationMorphTarget.html b/docs/59/api/extras/animation/AnimationMorphTarget.html new file mode 100644 index 0000000000..4fd7e355a6 --- /dev/null +++ b/docs/59/api/extras/animation/AnimationMorphTarget.html @@ -0,0 +1,105 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo root], [page:todo data])

+
+ root -- todo
+ data -- todo +
+
+ todo +
+ +

Properties

+ +

.[page:todo root]

+
+ todo +
+ +

.[page:todo data]

+
+ todo +
+ +

.[page:todo hierarchy]

+
+ todo +
+ +

.[page:number currentTime]

+
+ todo +
+ +

.[page:number timeScale]

+
+ todo +
+ +

.[page:boolean isPlaying]

+
+ todo +
+ +

.[page:boolean isPaused]

+
+ todo +
+ +

.[page:boolean loop]

+
+ todo +
+ +

.[page:number influence]

+
+ todo +
+ + +

Methods

+ +

.play() [page:todo]

+
+ todo +
+ +

.pause() [page:todo]

+
+ todo +
+ +

.stop() [page:todo]

+
+ todo +
+ +

.update([page:todo deltaTimeMS]) [page:todo]

+
+ deltaTimeMS -- todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/animation/KeyFrameAnimation.html b/docs/59/api/extras/animation/KeyFrameAnimation.html new file mode 100644 index 0000000000..135b3f6a22 --- /dev/null +++ b/docs/59/api/extras/animation/KeyFrameAnimation.html @@ -0,0 +1,133 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo root], [page:todo data], [page:todo JITCompile])

+
+ root -- todo
+ data -- todo
+ JITCompile -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:todo root]

+
+ todo +
+ +

.[page:todo data]

+
+ todo +
+ +

.[page:todo hierarchy]

+
+ todo +
+ +

.[page:number currentTime]

+
+ todo +
+ +

.[page:number timeScale]

+
+ todo +
+ +

.[page:boolean isPlaying]

+
+ todo +
+ +

.[page:boolean isPaused]

+
+ todo +
+ +

.[page:boolean loop]

+
+ todo +
+ +

.[page:boolean JITCompile]

+
+ todo +
+ +

Methods

+ +

.play() [page:todo]

+
+ todo +
+ +

.pause() [page:todo]

+
+ todo +
+ +

.stop() [page:todo]

+
+ todo +
+ +

.update([page:todo deltaTimeMS]) [page:todo]

+
+ deltaTimeMS -- todo +
+
+ todo +
+ +

.interpolateCatmullRom([page:todo points], [page:todo scale]) [page:todo]

+
+ points -- todo
+ scale -- todo +
+
+ todo +
+ +

.getNextKeyWith([page:todo sid], [page:todo h], [page:todo key]) [page:todo]

+
+ sid -- todo
+ h -- todo
+ key -- todo +
+
+ todo +
+ +

.getPrevKeyWith([page:todo sid], [page:todo h], [page:todo key]) [page:todo]

+
+ sid -- todo
+ h -- todo
+ key -- todo +
+
+ todo +
+

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/cameras/CombinedCamera.html b/docs/59/api/extras/cameras/CombinedCamera.html new file mode 100644 index 0000000000..c46470778d --- /dev/null +++ b/docs/59/api/extras/cameras/CombinedCamera.html @@ -0,0 +1,184 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo width], [page:todo height], [page:todo fov], [page:todo near], [page:todo far], [page:todo orthoNear], [page:todo orthoFar])

+
+ width -- todo
+ height -- todo
+ fov -- todo
+ near -- todo
+ far -- todo
+ orthoNear -- todo
+ orthoFar -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:todo fov]

+
+ todo +
+ +

.[page:number right]

+
+ todo +
+ +

.[page:number bottom]

+
+ todo +
+ +

.[page:PerspectiveCamera cameraP]

+
+ todo +
+ +

.[page:number top]

+
+ todo +
+ +

.[page:number zoom]

+
+ todo +
+ +

.[page:number far]

+
+ todo +
+ +

.[page:number near]

+
+ todo +
+ +

.[page:boolean inPerspectiveMode]

+
+ todo +
+ +

.[page:OrthographicCamera cameraO]

+
+ todo +
+ +

.[page:boolean inOrthographicMode]

+
+ todo +
+ +

.[page:number left]

+
+ todo +
+ +

Methods

+ + + +

.toBottomView() [page:todo]

+
+ todo +
+ +

.setFov([page:todo fov]) [page:todo]

+
+ fov -- todo +
+
+ todo +
+ +

.toBackView() [page:todo]

+
+ todo +
+ +

.setZoom([page:todo zoom]) [page:todo]

+
+ zoom -- todo +
+
+ todo +
+ +

.setLens([page:todo focalLength], [page:todo frameHeight]) [page:todo]

+
+ focalLength -- todo
+ frameHeight -- todo +
+
+ todo +
+ +

.toFrontView() [page:todo]

+
+ todo +
+ +

.toLeftView() [page:todo]

+
+ todo +
+ +

.updateProjectionMatrix() [page:todo]

+
+ todo +
+ +

.toTopView() [page:todo]

+
+ todo +
+ +

.toOrthographic() [page:todo]

+
+ todo +
+ +

.setSize([page:todo width], [page:todo height]) [page:todo]

+
+ width -- todo
+ height -- todo +
+
+ todo +
+ +

.toPerspective() [page:todo]

+
+ todo +
+ +

.toRightView() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/cameras/CubeCamera.html b/docs/59/api/extras/cameras/CubeCamera.html new file mode 100644 index 0000000000..a4b38628c7 --- /dev/null +++ b/docs/59/api/extras/cameras/CubeCamera.html @@ -0,0 +1,55 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo near], [page:todo far], [page:todo cubeResolution])

+
+ near -- todo
+ far -- todo
+ cubeResolution -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:WebGLRenderTargetCube renderTarget]

+
+ todo +
+ +

Methods

+ + + +

.updateCubeMap([page:todo renderer], [page:todo scene]) [page:todo]

+
+ renderer -- todo
+ scene -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/core/Curve.html b/docs/59/api/extras/core/Curve.html new file mode 100644 index 0000000000..0a2d818ad0 --- /dev/null +++ b/docs/59/api/extras/core/Curve.html @@ -0,0 +1,61 @@ + + + + + + + + + +

[name]

+ +
An extensible curve object which contains methods for interpolation.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ +

.getPoint ( t )

+
Returns a vector for point t of the curve where t is between 0 and 1
+ +

.getPointAt ( u )

+
Returns a vector for point at relative position in curve according to arc length
+ +

.getPoints ( divisions )

+
Get sequence of points using getPoint( t )
+ +

.getSpacedPoints ( divisions )

+
Get sequence of equi-spaced points using getPointAt( u )
+ +

.getLength ()

+
Get total curve arc length
+ +

.getLengths ( divisions )

+
Get list of cumulative segment lengths
+ +

.updateArcLengths ()

+
Update the cumlative segment distance cache
+ +

.getUtoTmapping ( u, distance )

+
Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
+ +

.getTangent ( t )

+
Returns a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation
+ +

.getTangentAt ( u )

+
Returns tangent at equidistant point u on the curve
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/core/CurvePath.html b/docs/59/api/extras/core/CurvePath.html new file mode 100644 index 0000000000..06590e5cbf --- /dev/null +++ b/docs/59/api/extras/core/CurvePath.html @@ -0,0 +1,136 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ + +

.[page:array curves]

+
+ todo +
+ +

.[page:array bends]

+
+ todo +
+ +

.[page:boolean autoClose]

+
+ todo +
+ +

Methods

+ + +

.getWrapPoints([page:todo oldPts], [page:todo path]) [page:todo]

+
+ oldPts -- todo
+ path -- todo +
+
+ todo +
+ +

.createPointsGeometry([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.addWrapPath([page:todo bendpath]) [page:todo]

+
+ bendpath -- todo +
+
+ todo +
+ +

.createGeometry([page:todo points]) [page:todo]

+
+ points -- todo +
+
+ todo +
+ +

.add([page:todo curve]) [page:todo]

+
+ curve -- todo +
+
+ todo +
+ +

.getTransformedSpacedPoints([page:todo segments], [page:todo bends]) [page:todo]

+
+ segments -- todo
+ bends -- todo +
+
+ todo +
+ +

.createSpacedPointsGeometry([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.closePath() [page:todo]

+
+ todo +
+ +

.getBoundingBox() [page:todo]

+
+ todo +
+ +

.getCurveLengths() [page:todo]

+
+ todo +
+ +

.getTransformedPoints([page:todo segments], [page:todo bends]) [page:todo]

+
+ segments -- todo
+ bends -- todo +
+
+ todo +
+ +

.checkConnection() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/core/Gyroscope.html b/docs/59/api/extras/core/Gyroscope.html new file mode 100644 index 0000000000..069d8adbc4 --- /dev/null +++ b/docs/59/api/extras/core/Gyroscope.html @@ -0,0 +1,66 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ + + +

.[page:Vector3 scaleWorld]

+
+ todo +
+ +

.[page:Vector3 translationWorld]

+
+ todo +
+ +

.[page:Quaternion rotationWorld]

+
+ todo +
+ +

.[page:Vector3 translationObject]

+
+ todo +
+ +

.[page:Vector3 scaleObject]

+
+ todo +
+ +

.[page:Quaternion rotationObject]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/core/Path.html b/docs/59/api/extras/core/Path.html new file mode 100644 index 0000000000..cb315e9e98 --- /dev/null +++ b/docs/59/api/extras/core/Path.html @@ -0,0 +1,75 @@ + + + + + + + + + +

[name]

+ +
A 2d path representation, comprising of points, lines, and cubes, similar to the html5 2d canvas api. It extends CurvePath.
+ + +

Constructor

+ + +

[name]([page:todo points])

+
+ points -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:array actions]

+
+ todo +
+ +

Methods

+ +

.fromPoints ( vectors )

+
todo
+ +

.moveTo ( x, y )

+
todo
+ +

.lineTo ( x, y )

+
todo
+ +

.quadraticCurveTo ( aCPx, aCPy, aX, aY )

+
todo
+ +

.bezierCurveTo ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY )

+
todo
+ +

.splineThru ( pts /*Array of Vector*/ )

+
todo
+ +

.arc ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise )

+
todo
+ +

.absarc ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise )

+
todo
+ +

.ellipse ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise )

+
todo
+ +

.absellipse ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise )

+
todo
+ +

.toShapes ()

+
todo
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/core/Shape.html b/docs/59/api/extras/core/Shape.html new file mode 100644 index 0000000000..3d51b8a580 --- /dev/null +++ b/docs/59/api/extras/core/Shape.html @@ -0,0 +1,95 @@ + + + + + + + + + +

[name]

+ +
Defines a 2d shape plane using paths.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ + +

.[page:array holes]

+
+ todo +
+ +

Methods

+ + +

.makeGeometry([page:todo options]) [page:todo]

+
+ options -- todo +
+
+ todo +
+ +

.extractAllPoints([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.extrude([page:todo options]) [page:todo]

+
+ options -- todo +
+
+ todo +
+ +

.extractPoints([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.extractAllSpacedPoints([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.getPointsHoles([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

.getSpacedPointsHoles([page:todo divisions]) [page:todo]

+
+ divisions -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/CircleGeometry.html b/docs/59/api/extras/geometries/CircleGeometry.html new file mode 100644 index 0000000000..1dc31d7018 --- /dev/null +++ b/docs/59/api/extras/geometries/CircleGeometry.html @@ -0,0 +1,30 @@ + + + + + + + + + +

[name]

+ +
CircleGeometry is a simple shape of Euclidean geometry. It is contructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius. It is built counter-clockwise from a start angle and a given central angle. It can also be used to create regular polygons, where the number of segments determines the number of sides. +
+ +

Constructor

+ +

[name]([page:Float radius], [page:Integer segments], [page:Float thetaStart], [page:Float thetaLength])

+
+ radius — Radius of the circle, default = 50.
+ segments — Number of segments (triangles), minimum = 3, default = 8.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/ConvexGeometry.html b/docs/59/api/extras/geometries/ConvexGeometry.html new file mode 100644 index 0000000000..626af74aa8 --- /dev/null +++ b/docs/59/api/extras/geometries/ConvexGeometry.html @@ -0,0 +1,33 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Array vertices])

+
+ vertices — todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/CubeGeometry.html b/docs/59/api/extras/geometries/CubeGeometry.html new file mode 100644 index 0000000000..2699bb09b5 --- /dev/null +++ b/docs/59/api/extras/geometries/CubeGeometry.html @@ -0,0 +1,40 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
CubeGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.
+ + +

Constructor

+ + +

[name]([page:Float width], [page:Float height], [page:Float depth], [page:Integer widthSegments], [page:Integer heightSegments], [page:Integer depthSegments])

+
+ width — Width of the sides on the X axis.
+ height — Height of the sides on the Y axis.
+ depth — Depth of the sides on the Z axis.
+ widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.
+ heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.
+ depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1. +
+ +

Properties

+ +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/CylinderGeometry.html b/docs/59/api/extras/geometries/CylinderGeometry.html new file mode 100644 index 0000000000..bc77ae79f2 --- /dev/null +++ b/docs/59/api/extras/geometries/CylinderGeometry.html @@ -0,0 +1,42 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded])

+
+ radiusTop — Radius of the cylinder at the top. Default is 20.
+ radiusBottom — Radius of the cylinder at the bottom. Default is 20.
+ height — Height of the cylinder. Default is 100.
+ radiusSegments — Number of segmented faces around the circumference of the cylinder. Default is 8
+ heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.
+ openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped. +
+ + +

Properties

+ +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/ExtrudeGeometry.html b/docs/59/api/extras/geometries/ExtrudeGeometry.html new file mode 100644 index 0000000000..a1a5501685 --- /dev/null +++ b/docs/59/api/extras/geometries/ExtrudeGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
Creates extruded geometry from a path shape
+ + +

Constructor

+ + +

[name]([page:todo shapes], [page:Object options])

+
+ shapes — todo
+ options — todo +
+
+ todo +
+ + +

Properties

+ + +

Methods

+ +

.addShapeList ([page:todo shapes], [page:Object options])

+
+ shapes — todo
+ options — todo +
+
todo
+ +

.addShape ([page:todo shape], [page:Object options])

+
+ shape — todo
+ options — todo +
+
todo
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/IcosahedronGeometry.html b/docs/59/api/extras/geometries/IcosahedronGeometry.html new file mode 100644 index 0000000000..cfa5efe0ef --- /dev/null +++ b/docs/59/api/extras/geometries/IcosahedronGeometry.html @@ -0,0 +1,38 @@ + + + + + + + + + + [page:PolyhedronGeometry] → +

[name]

+ +
A class for generating an icosahedron geometry.
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Integer detail])

+
+ radius — Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds more vertices making it no longer an icosahedron. When detail is greater than 1, it's effectively a sphere. +
+ + +

Properties

+ + +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/LatheGeometry.html b/docs/59/api/extras/geometries/LatheGeometry.html new file mode 100644 index 0000000000..b2e8541b95 --- /dev/null +++ b/docs/59/api/extras/geometries/LatheGeometry.html @@ -0,0 +1,36 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Array points], [page:Integer segments], [page:Float phiStart], [page:Float phiLength])

+
+ points — todo
+ segments — todo
+ phiStart — todo
+ phiLength — todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/OctahedronGeometry.html b/docs/59/api/extras/geometries/OctahedronGeometry.html new file mode 100644 index 0000000000..29e132365c --- /dev/null +++ b/docs/59/api/extras/geometries/OctahedronGeometry.html @@ -0,0 +1,33 @@ + + + + + + + + + + [page:PolyhedronGeometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Integer detail])

+
+ radius — Radius of the octahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than zero add vertices making it no longer an octahedron. +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/ParametricGeometry.html b/docs/59/api/extras/geometries/ParametricGeometry.html new file mode 100644 index 0000000000..f1c38bf4c5 --- /dev/null +++ b/docs/59/api/extras/geometries/ParametricGeometry.html @@ -0,0 +1,36 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo func], [page:todo slices], [page:todo stacks], [page:Boolean useTris])

+
+ func — todo
+ slices — todo
+ stacks — todo
+ useTris — todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/PlaneGeometry.html b/docs/59/api/extras/geometries/PlaneGeometry.html new file mode 100644 index 0000000000..ccb6ff86a8 --- /dev/null +++ b/docs/59/api/extras/geometries/PlaneGeometry.html @@ -0,0 +1,39 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Float width], [page:Float height], [page:Integer widthSegments], [page:Integer heightSegments])

+
+ width — Width along the X axis.
+ height — Height along the Y axis.
+ widthSegments — Optional. Default is 1.
+ heightSegments — Optional. Default is 1. +
+ + +

Properties

+ +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/PolyhedronGeometry.html b/docs/59/api/extras/geometries/PolyhedronGeometry.html new file mode 100644 index 0000000000..e7152a40c7 --- /dev/null +++ b/docs/59/api/extras/geometries/PolyhedronGeometry.html @@ -0,0 +1,36 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Array vertices], [page:Array faces], [page:Float radius], [page:Integer detail])

+
+ vertices — todo
+ faces — todo
+ radius — todo
+ detail — todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/RingGeometry.html b/docs/59/api/extras/geometries/RingGeometry.html new file mode 100644 index 0000000000..9d32957bd8 --- /dev/null +++ b/docs/59/api/extras/geometries/RingGeometry.html @@ -0,0 +1,35 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
A class for generating a two-dimensional ring geometry.
+ + +

Constructor

+ + +

[name]([page:Float innerRadius], [page:Float outerRadius], [page:Integer thetaSegments], [page:Integer phiSegments], [page:Float thetaStart], [page:Float thetaLength])

+
+ innerRadius — Default is 0, but it doesn't work right when innerRadius is set to 0.
+ outerRadius — Default is 50.
+ thetaSegments — Number of segments. A higher number means the ring will be more round. Minimum is 3. Default is 8.
+ phiSegments — Minimum is 3. Default is 8.
+ thetaStart — Starting angle. Default is 0.
+ thetaLength — Central angle. Default is Math.PI * 2. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/ShapeGeometry.html b/docs/59/api/extras/geometries/ShapeGeometry.html new file mode 100644 index 0000000000..51a612e3ae --- /dev/null +++ b/docs/59/api/extras/geometries/ShapeGeometry.html @@ -0,0 +1,65 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Array shapes], [page:Object options])

+
+ shapes — todo
+ options — todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Object shapebb]

+
+ todo +
+ +

Methods

+ + + +

.addShapeList([page:todo shapes], [page:Object options]) [page:this]

+
+ shapes — todo
+ options — todo +
+
+ todo +
+ +

.addShape([page:todo shape], [page:Object options])

+
+ shape — todo
+ options — todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/SphereGeometry.html b/docs/59/api/extras/geometries/SphereGeometry.html new file mode 100644 index 0000000000..63f9f01f7d --- /dev/null +++ b/docs/59/api/extras/geometries/SphereGeometry.html @@ -0,0 +1,47 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
A class for generating sphere geometries
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Integer widthSegments], [page:Integer heightSegments], [page:Float phiStart], [page:Float phiLength], [page:Float thetaStart], [page:Float thetaLength])

+ +
+ radius — sphere radius. Default is 50.
+ widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.
+ heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.
+ phiStart — specify horizontal starting angle. Default is 0.
+ phiLength — specify horizontal sweep angle size. Default is Math.PI * 2.
+ thetaStart — specify vertical starting angle. Default is 0.
+ thetaLength — specify vertical sweep angle size. Default is Math.PI.
+
+ +
+ The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices. +
+ + +

Properties

+ +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/TetrahedronGeometry.html b/docs/59/api/extras/geometries/TetrahedronGeometry.html new file mode 100644 index 0000000000..f1982dac18 --- /dev/null +++ b/docs/59/api/extras/geometries/TetrahedronGeometry.html @@ -0,0 +1,31 @@ + + + + + + + + + + [page:PolyhedronGeometry] → + +

[name]

+ +
A class for generating a tetrahedron geometries.
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Integer detail])

+
+ radius — Radius of the tetrahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a tetrahedron. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/TextGeometry.html b/docs/59/api/extras/geometries/TextGeometry.html new file mode 100644 index 0000000000..6046ae7bb5 --- /dev/null +++ b/docs/59/api/extras/geometries/TextGeometry.html @@ -0,0 +1,42 @@ + + + + + + + + + + [page:ExtrudeGeometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:String text], [page:Object parameters])

+
+ text — todo
+ parameters — Object that can contain the following parameters. +
    +
  • size — Float. Size of the text.
  • +
  • height — Float. Thickness to extrude text. Default is 50.
  • +
  • curveSegments — Integer. Number of points on the curves.
  • +
  • font — String. Font name.
  • +
  • weight — String. Font weight (normal, bold).
  • +
  • style — String. Font style (normal, italics).
  • +
  • bevelEnabled — Boolean. Turn on bevel. Default is False.
  • +
  • bevelThickness — Float. How deep into text bevel goes. Default is 10.
  • +
  • bevelSize — Float. How far from text outline is bevel. Default is 8.
  • +
+
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/TorusGeometry.html b/docs/59/api/extras/geometries/TorusGeometry.html new file mode 100644 index 0000000000..ba17db3a97 --- /dev/null +++ b/docs/59/api/extras/geometries/TorusGeometry.html @@ -0,0 +1,40 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
Creates a torus.
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Float tube], [page:Integer radialSegments], [page:Integer tubularSegments], [page:Float arc])

+
+ radius — Default is 100.
+ tube — Diameter of the tube. Default is 40.
+ radialSegments — Default is 8
+ tubularSegments — Default is 6.
+ arc — Central angle. Default is Math.PI * 2. +
+ + +

Properties

+ +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/TorusKnotGeometry.html b/docs/59/api/extras/geometries/TorusKnotGeometry.html new file mode 100644 index 0000000000..123bff938e --- /dev/null +++ b/docs/59/api/extras/geometries/TorusKnotGeometry.html @@ -0,0 +1,44 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and q are not coprime, the result will be a torus link.
+ + +

Constructor

+ + +

[name]([page:Float radius], [page:Float tube], [page:Integer radialSegments], [page:Integer tubularSegments], [page:Integer p], [page:Integer q], [page:Float heightScale])

+
+ radius — Default is 100.
+ tube — Default is 40.
+ radialSegments — Default is 64.
+ tubularSegments — Default is 8.
+ p — Default is 2.
+ q — Default is 3.
+ heightScale — Default is 1. +
+ + +

Properties

+ + +
+ Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/geometries/TubeGeometry.html b/docs/59/api/extras/geometries/TubeGeometry.html new file mode 100644 index 0000000000..43f0d5958b --- /dev/null +++ b/docs/59/api/extras/geometries/TubeGeometry.html @@ -0,0 +1,91 @@ + + + + + + + + + + [page:Geometry] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo path], [page:Integer segments], [page:Float radius], [page:Integer radiusSegments], [page:Boolean closed], [page:Boolean debug])

+
+ path — todo
+ segments — todo
+ radius — todo
+ radiusSegments — todo
+ closed — todo
+ debug — todo +
+ + +

Properties

+ +

.[page:todo path]

+
+ todo +
+ +

.[page:Integer segments]

+
+ todo +
+ +

.[page:Float radius]

+
+ todo +
+ +

.[page:Integer radiusSegments]

+
+ todo +
+ +

.[page:Boolean closed]

+
+ todo +
+ +

.[page:Array tangents]

+
+ todo +
+ +

.[page:Array normals]

+
+ todo +
+ +

.[page:Array binormals]

+
+ todo +
+ + +

Methods

+ + +

.FrenetFrames([page:todo path], [page:Integer segments], [page:Boolean closed])

+
+ path — todo
+ segments — todo
+ closed — todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/ArrowHelper.html b/docs/59/api/extras/helpers/ArrowHelper.html new file mode 100644 index 0000000000..34bba34c26 --- /dev/null +++ b/docs/59/api/extras/helpers/ArrowHelper.html @@ -0,0 +1,76 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo dir], [page:todo origin], [page:todo length], [page:todo hex])

+
+ dir -- todo
+ origin -- todo
+ length -- todo
+ hex -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Line line]

+
+ todo +
+ +

.[page:Mesh cone]

+
+ todo +
+ +

Methods

+ + + +

.setColor([page:todo hex]) [page:todo]

+
+ hex -- todo +
+
+ todo +
+ +

.setLength([page:todo length]) [page:todo]

+
+ length -- todo +
+
+ todo +
+ +

.setDirection([page:todo dir]) [page:todo]

+
+ dir -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/AxisHelper.html b/docs/59/api/extras/helpers/AxisHelper.html new file mode 100644 index 0000000000..ba49789775 --- /dev/null +++ b/docs/59/api/extras/helpers/AxisHelper.html @@ -0,0 +1,30 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo size])

+
+ size -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/BoxHelper.html b/docs/59/api/extras/helpers/BoxHelper.html new file mode 100644 index 0000000000..f3fce9da97 --- /dev/null +++ b/docs/59/api/extras/helpers/BoxHelper.html @@ -0,0 +1,49 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo size])

+
+ size -- todo +
+
+ todo +
+ +

Properties

+ + +

.[page:array vertices]

+
+ todo +
+ +

Methods

+ + +

.update([page:todo object]) [page:todo]

+
+ object -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/CameraHelper.html b/docs/59/api/extras/helpers/CameraHelper.html new file mode 100644 index 0000000000..5756f61de3 --- /dev/null +++ b/docs/59/api/extras/helpers/CameraHelper.html @@ -0,0 +1,52 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo camera])

+
+ camera -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:object pointMap]

+
+ todo +
+ +

.[page:PerspectiveCamera camera]

+
+ todo +
+ +

Methods

+ + +

.update() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/DirectionalLightHelper.html b/docs/59/api/extras/helpers/DirectionalLightHelper.html new file mode 100644 index 0000000000..48df381d77 --- /dev/null +++ b/docs/59/api/extras/helpers/DirectionalLightHelper.html @@ -0,0 +1,58 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo light], [page:todo sphereSize])

+
+ light -- todo
+ sphereSize -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:Mesh lightSphere]

+
+ todo +
+ +

.[page:DirectionalLight light]

+
+ todo +
+ +

.[page:Line targetLine]

+
+ todo +
+ +

Methods

+ + +

.update() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/GridHelper.html b/docs/59/api/extras/helpers/GridHelper.html new file mode 100644 index 0000000000..9049e0f2cf --- /dev/null +++ b/docs/59/api/extras/helpers/GridHelper.html @@ -0,0 +1,32 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo size], [page:todo step])

+
+ size -- todo
+ step -- todo +
+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/HemisphereLightHelper.html b/docs/59/api/extras/helpers/HemisphereLightHelper.html new file mode 100644 index 0000000000..ea37ac7d57 --- /dev/null +++ b/docs/59/api/extras/helpers/HemisphereLightHelper.html @@ -0,0 +1,56 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo light], [page:todo sphereSize], [page:todo arrowLength], [page:todo domeSize])

+
+ light -- todo
+ sphereSize -- todo
+ arrowLength -- todo
+ domeSize -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:Mesh lightSphere]

+
+ todo +
+ +

.[page:HemisphereLight light]

+
+ todo +
+ + +

Methods

+ + +

.update() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/PointLightHelper.html b/docs/59/api/extras/helpers/PointLightHelper.html new file mode 100644 index 0000000000..39b8ef6230 --- /dev/null +++ b/docs/59/api/extras/helpers/PointLightHelper.html @@ -0,0 +1,53 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo light], [page:todo sphereSize])

+
+ light -- todo
+ sphereSize -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:Mesh lightSphere]

+
+ todo +
+ +

.[page:PointLight light]

+
+ todo +
+ +

Methods

+ + +

.update() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/helpers/SpotLightHelper.html b/docs/59/api/extras/helpers/SpotLightHelper.html new file mode 100644 index 0000000000..4156d1316d --- /dev/null +++ b/docs/59/api/extras/helpers/SpotLightHelper.html @@ -0,0 +1,58 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo light], [page:todo sphereSize])

+
+ light -- todo
+ sphereSize -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:Mesh lightSphere]

+
+ todo +
+ +

.[page:SpotLight light]

+
+ todo +
+ +

.[page:Mesh lightCone]

+
+ todo +
+ +

Methods

+ + +

.update() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/objects/ImmediateRenderObject.html b/docs/59/api/extras/objects/ImmediateRenderObject.html new file mode 100644 index 0000000000..34572ae356 --- /dev/null +++ b/docs/59/api/extras/objects/ImmediateRenderObject.html @@ -0,0 +1,39 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ + +

.render([page:todo renderCallback]) [page:todo]

+
+ renderCallback -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/objects/LensFlare.html b/docs/59/api/extras/objects/LensFlare.html new file mode 100644 index 0000000000..136c77b2af --- /dev/null +++ b/docs/59/api/extras/objects/LensFlare.html @@ -0,0 +1,63 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo texture], [page:todo size], [page:todo distance], [page:todo blending], [page:todo color])

+
+ texture -- todo
+ size -- todo
+ distance -- todo
+ blending -- todo
+ color -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:array lensFlares]

+
+ todo +
+ +

.[page:Vector3 positionScreen]

+
+ todo +
+ +

.[page:todo customUpdateCallback]

+
+ todo +
+ +

Methods

+ + + +

.updateLensFlares() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/objects/MorphBlendMesh.html b/docs/59/api/extras/objects/MorphBlendMesh.html new file mode 100644 index 0000000000..779f4e48aa --- /dev/null +++ b/docs/59/api/extras/objects/MorphBlendMesh.html @@ -0,0 +1,160 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo geometry], [page:todo material])

+
+ geometry -- todo
+ material -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:object animationsMap]

+
+ todo +
+ +

.[page:array animationsList]

+
+ todo +
+ +

Methods

+ + + +

.setAnimationWeight([page:todo name], [page:todo weight]) [page:todo]

+
+ name -- todo
+ weight -- todo +
+
+ todo +
+ +

.setAnimationFPS([page:todo name], [page:todo fps]) [page:todo]

+
+ name -- todo
+ fps -- todo +
+
+ todo +
+ +

.createAnimation([page:todo name], [page:todo start], [page:todo end], [page:todo fps]) [page:todo]

+
+ name -- todo
+ start -- todo
+ end -- todo
+ fps -- todo +
+
+ todo +
+ +

.playAnimation([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.update([page:todo delta]) [page:todo]

+
+ delta -- todo +
+
+ todo +
+ +

.autoCreateAnimations([page:todo fps]) [page:todo]

+
+ fps -- todo +
+
+ todo +
+ +

.setAnimationDuration([page:todo name], [page:todo duration]) [page:todo]

+
+ name -- todo
+ duration -- todo +
+
+ todo +
+ +

.setAnimationDirectionForward([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.getAnimationDuration([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.getAnimationTime([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.setAnimationDirectionBackward([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

.setAnimationTime([page:todo name], [page:todo time]) [page:todo]

+
+ name -- todo
+ time -- todo +
+
+ todo +
+ +

.stopAnimation([page:todo name]) [page:todo]

+
+ name -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/renderers/plugins/DepthPassPlugin.html b/docs/59/api/extras/renderers/plugins/DepthPassPlugin.html new file mode 100644 index 0000000000..28ee7d9898 --- /dev/null +++ b/docs/59/api/extras/renderers/plugins/DepthPassPlugin.html @@ -0,0 +1,72 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ + + +

.[page:boolean enabled]

+
+ todo +
+ +

.[page:object renderTarget]

+
+ todo +
+ +

Methods

+ + + +

.init([page:todo renderer]) [page:todo]

+
+ renderer -- todo +
+
+ todo +
+ +

.update([page:todo scene], [page:todo camera]) [page:todo]

+
+ scene -- todo
+ camera -- todo +
+
+ todo +
+ +

.render([page:todo scene], [page:todo camera]) [page:todo]

+
+ scene -- todo
+ camera -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/renderers/plugins/LensFlarePlugin.html b/docs/59/api/extras/renderers/plugins/LensFlarePlugin.html new file mode 100644 index 0000000000..de4c7610f4 --- /dev/null +++ b/docs/59/api/extras/renderers/plugins/LensFlarePlugin.html @@ -0,0 +1,52 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + + +

Methods

+ + + +

.init([page:todo renderer]) [page:todo]

+
+ renderer -- todo +
+
+ todo +
+ +

.render([page:todo scene], [page:todo camera], [page:todo viewportWidth], [page:todo viewportHeight]) [page:todo]

+
+ scene -- todo
+ camera -- todo
+ viewportWidth -- todo
+ viewportHeight -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/renderers/plugins/ShadowMapPlugin.html b/docs/59/api/extras/renderers/plugins/ShadowMapPlugin.html new file mode 100644 index 0000000000..276dca90a2 --- /dev/null +++ b/docs/59/api/extras/renderers/plugins/ShadowMapPlugin.html @@ -0,0 +1,58 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ + + +

.init([page:todo renderer]) [page:todo]

+
+ renderer -- todo +
+
+ todo +
+ +

.update([page:todo scene], [page:todo camera]) [page:todo]

+
+ scene -- todo
+ camera -- todo +
+
+ todo +
+ +

.render([page:todo scene], [page:todo camera]) [page:todo]

+
+ scene -- todo
+ camera -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/renderers/plugins/SpritePlugin.html b/docs/59/api/extras/renderers/plugins/SpritePlugin.html new file mode 100644 index 0000000000..b3eb987865 --- /dev/null +++ b/docs/59/api/extras/renderers/plugins/SpritePlugin.html @@ -0,0 +1,51 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ + + +

.init([page:todo renderer]) [page:todo]

+
+ renderer -- todo +
+
+ todo +
+ +

.render([page:todo scene], [page:todo camera], [page:todo viewportWidth], [page:todo viewportHeight]) [page:todo]

+
+ scene -- todo
+ camera -- todo
+ viewportWidth -- todo
+ viewportHeight -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/shaders/ShaderFlares.html b/docs/59/api/extras/shaders/ShaderFlares.html new file mode 100644 index 0000000000..c9d78ef4ca --- /dev/null +++ b/docs/59/api/extras/shaders/ShaderFlares.html @@ -0,0 +1,33 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Properties

+ + +

.[page:object lensFlare]

+
+ todo +
+ +

.[page:object lensFlareVertexTexture]

+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/extras/shaders/ShaderSprite.html b/docs/59/api/extras/shaders/ShaderSprite.html new file mode 100644 index 0000000000..79dc5a8de3 --- /dev/null +++ b/docs/59/api/extras/shaders/ShaderSprite.html @@ -0,0 +1,29 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Properties

+ + +

.[page:object sprite]

+
+ todo +
+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/AmbientLight.html b/docs/59/api/lights/AmbientLight.html new file mode 100644 index 0000000000..3fd785560d --- /dev/null +++ b/docs/59/api/lights/AmbientLight.html @@ -0,0 +1,40 @@ + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +
+ This light's color gets applied to all the objects in the scene globally. +
+ + +

Example

+ +var light = new THREE.AmbientLight( 0x404040 ); // soft white light +scene.add( light ); + +

Constructor

+ + +

[name]( [page:Float hex] )

+
+ [page:Integer hex] — Numeric value of the RGB component of the color. +
+
+ This creates a Ambientlight with a color. +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/AreaLight.html b/docs/59/api/lights/AreaLight.html new file mode 100644 index 0000000000..f4771448ba --- /dev/null +++ b/docs/59/api/lights/AreaLight.html @@ -0,0 +1,86 @@ + + + + + + + + + +

[name]

+ +
This illuminates the scene from a complete surface. This light only works in the [page:WebGLDeferredRenderer deferredrenderer].
+ + +

Example

+ areaLight1 = new THREE.AreaLight( 0xffffff, 1 ); +areaLight1.position.set( 0.0001, 10.0001, -18.5001 ); +areaLight1.rotation.set( -0.74719, 0.0001, 0.0001 ); +areaLight1.width = 10; +areaLight1.height = 1; + +scene.add( areaLight1 ); + +

Constructor

+ + +

[name]( [page:Float hex], [page:Float intensity])

+
+ [page:Integer hex] — Numeric value of the RGB component of the color.
+ [page:Integer intensity] — The intensity of the light. +
+
+ This creates a arealight with color. +
+ + +

Properties

+ + + +

.[page:Vector3 right]

+
+ todo +
+ +

.[page:Vector3 normal]

+
+ todo +
+ +

.[page:number quadraticAttenuation]

+
+ todo +
+ +

.[page:number height]

+
+ todo +
+ +

.[page:number linearAttenuation]

+
+ todo +
+ +

.[page:number width]

+
+ todo +
+ +

.[page:number intensity]

+
+ todo +
+ +

.[page:number constantAttenuation]

+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/DirectionalLight.html b/docs/59/api/lights/DirectionalLight.html new file mode 100644 index 0000000000..00d0e74608 --- /dev/null +++ b/docs/59/api/lights/DirectionalLight.html @@ -0,0 +1,210 @@ + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +
+ Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial]. +
+ + +

Example

+ + // White directional light at half intensity shining from the top. + +var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); +directionalLight.position.set( 0, 1, 0 ); +scene.add( directionalLight ); + + +

Constructor

+ + +

[name]([page:todo hex], [page:todo intensity])

+
+ hex -- todo
+ intensity -- todo +
+
+ todo +
+ +

Properties

+ +

.[page:Object3D target]

+
+ Target used for shadow camera orientation. +
+ +

.[page:Float intensity]

+
+ Light's intensity.
+ Default — *1.0*. +
+ +

.[page:Boolean onlyShadow]

+
+ If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).
+ Default — *false*. +
+ +

.[page:Float shadowCameraNear]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *50*. +
+ +

.[page:Float shadowCameraFar]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *5000*. +
+ +

.[page:Float shadowCameraLeft]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *-500*. +
+ +

.[page:Float shadowCameraRight]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *500*. +
+ +

.[page:Float shadowCameraTop]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *500*. +
+ +

.[page:Float shadowCameraBottom]

+
+ Orthographic shadow camera frustum parameter.
+ Default — *-500*. +
+ +

.[page:Boolean shadowCameraVisible]

+
+ Show debug shadow camera frustum.
+ Default — *false*. +
+ +

.[page:Float shadowBias]

+
+ Shadow map bias.
+ Default — *0*. +
+ +

.[page:Float shadowDarkness]

+
+ Darkness of shadow casted by this light (from *0* to *1*).
+ Default — *0.5*. +
+ +

.[page:Integer shadowMapWidth]

+
+ Shadow map texture width in pixels.
+ Default — *512*. +
+ +

.[page:Integer shadowMapHeight]

+
+ Shadow map texture height in pixels.
+ Default — *512*. +
+ +

.[page:Boolean shadowCascade]

+
+ ???
+ Default — *false*. +
+ +

.[page:Vector3 shadowCascadeOffset]

+
+ ???
+ Default — *Three.Vector3( 0, 0, -1000 )*. +
+ +

.[page:Integer shadowCascadeCount]

+
+ ???
+ Default — *2*. +
+ +

.[page:Array shadowCascadeBias]

+
+ ???
+ Default — [ 0, 0, 0 ]. +
+ +

.[page:Array shadowCascadeWidth]

+
+ ???
+ Default — [ 512, 512, 512 ]. +
+ +

.[page:Array shadowCascadeHeight]

+
+ ???
+ Default — [ 512, 512, 512 ]. +
+ +

.[page:Array shadowCascadeNearZ]

+
+ ???
+ Default — [ -1.000, 0.990, 0.998 ]. +
+ +

.[page:Array shadowCascadeFarZ]

+
+ ???
+ Default — [ 0.990, 0.998, 1.000 ]. +
+ +

.[page:Array shadowCascadeArray]

+
+ ???
+ Default — [ ]. +
+ +

.[page:RenderTarget shadowMap]

+
+ ???
+ Default — *null*. +
+ +

.[page:Integer shadowMapSize]

+
+ ???
+ Default — *null*. +
+ +

.[page:Camera shadowCamera]

+
+ ???
+ Default — *null*. +
+ +

.[page:Matrix shadowMatrix]

+
+ ???
+ Default — *null*. +
+ +

Methods

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/HemisphereLight.html b/docs/59/api/lights/HemisphereLight.html new file mode 100644 index 0000000000..f1d4103b4e --- /dev/null +++ b/docs/59/api/lights/HemisphereLight.html @@ -0,0 +1,48 @@ + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +
A light source positioned directly above the scene.
+ +

Constructor

+ + +

[name]([page:todo skyColorHex], [page:todo groundColorHex], [page:todo intensity])

+
+ [page:Integer skyColorHex] — Numeric value of the RGB sky color.
+ [page:Integer groundColorHex] — Numeric value of the RGB ground color.
+ [page:Integer intensity] — The intensity of the light. +
+ +

Properties

+ +

.[page:Float groundColor]

+ +
+ Light's ground color.
+
+ +

.[page:Float intensity]

+ +
+ Light's intensity.
+ Default — *1*. +
+ +

Methods

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/Light.html b/docs/59/api/lights/Light.html new file mode 100644 index 0000000000..e4427ff7b5 --- /dev/null +++ b/docs/59/api/lights/Light.html @@ -0,0 +1,40 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
Abstract base class for lights.
+ + +

Constructor

+ + +

[name]( [page:Integer hex] )

+
+ [page:Integer hex] — Numeric value of the RGB component of the color. +
+
+ This creates a light with color.
+
+ + +

Properties

+ +

.[page:Color color]

+
+ Color of the light.
+
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/PointLight.html b/docs/59/api/lights/PointLight.html new file mode 100644 index 0000000000..33326cd5ce --- /dev/null +++ b/docs/59/api/lights/PointLight.html @@ -0,0 +1,61 @@ + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +
+ Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial]. +
+ + +

Example

+ + var light = new THREE.PointLight( 0xff0000, 1, 100 ); +light.position.set( 50, 50, 50 ); +scene.add( light ); + + +

Constructor

+ + +

[name]([page:todo hex], [page:todo intensity], [page:todo distance])

+
+ hex -- todo
+ intensity -- todo
+ distance -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Float intensity]

+
+ Light's intensity.
+ Default - *1.0*. +
+ +

.[page:Float distance]

+
+ If non-zero, light will attenuate linearly from maximum intensity at light *position* down to zero at *distance*.
+ Default — *0.0*. +
+ +

Methods

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/lights/SpotLight.html b/docs/59/api/lights/SpotLight.html new file mode 100644 index 0000000000..7f0f0bcd26 --- /dev/null +++ b/docs/59/api/lights/SpotLight.html @@ -0,0 +1,197 @@ + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +
A point light that can cast shadow in one direction.
+ +
Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial].
+ + +

Example

+ + // white spotlight shining from the side, casting shadow + +var spotLight = new THREE.SpotLight( 0xffffff ); +spotLight.position.set( 100, 1000, 100 ); + +spotLight.castShadow = true; + +spotLight.shadowMapWidth = 1024; +spotLight.shadowMapHeight = 1024; + +spotLight.shadowCameraNear = 500; +spotLight.shadowCameraFar = 4000; +spotLight.shadowCameraFov = 30; + +scene.add( spotLight ); + + +

Constructor

+ + +

[name]([page:todo hex], [page:todo intensity], [page:todo distance], [page:todo angle], [page:todo exponent])

+
+ hex -- todo
+ intensity -- todo
+ distance -- todo
+ angle -- todo
+ exponent -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Object3D target]

+
+ Spotlight focus points at target.position.
+ Default position — *(0,0,0)*. +
+ +

.[page:Float intensity]

+
+ Light's intensity.
+ Default — *1.0*. +
+ +

.[page:Float distance]

+
+ If non-zero, light will attenuate linearly from maximum intensity at light *position* down to zero at *distance*.
+ Default — *0.0*. +
+ +

.[page:Float angle]

+
+ Maximum extent of the spotlight, in radians, from its direction. Should be no more than *Math.PI/2*.
+ Default — *Math.PI/3*. +
+ +

.[page:Float exponent]

+
+ Rapidity of the falloff of light from its target direction.
+ Default — *10.0*. +
+ +

.[page:Boolean castShadow]

+
+ If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and requires tweaking to get shadows looking right.
+ Default — *false*. +
+ +

.[page:Boolean onlyShadow]

+
+ If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).
+ Default — *false*. +
+ +

.[page:Float shadowCameraNear]

+
+ Perspective shadow camera frustum near parameter.
+ Default — *50*. +
+ +

.[page:Float shadowCameraFar]

+
+ Perspective shadow camera frustum far parameter.
+ Default — *5000*. +
+ +

.[page:Float shadowCameraFov]

+
+ Perspective shadow camera frustum field of view parameter.
+ Default — *50*. +
+ +

.[page:Boolean shadowCameraVisible]

+
+ Show debug shadow camera frustum.
+ Default — *false*. +
+ +

.[page:Float shadowBias]

+
+ Shadow map bias.
+ Default — *0*. +
+ +

.[page:Float shadowDarkness]

+
+ Darkness of shadow casted by this light (from *0* to *1*).
+ Default — *0.5*. +
+ +

.[page:Integer shadowMapWidth]

+
+ Shadow map texture width in pixels.
+ Default — *512*. +
+ +

.[page:Integer shadowMapHeight]

+
+ Shadow map texture height in pixels.
+ Default — *512*. +
+ +

.[page:Float shadowBias]

+
+ Shadow map bias.
+ Default — *0*. +
+ +

.[page:Float shadowDarkness]

+
+ Darkness of shadow casted by this light (from *0* to *1*).
+ Default — *0.5*. +
+ +

.[page:Integer shadowMapWidth]

+
+ Shadow map texture width in pixels.
+ Default — *512*. +
+ +

.[page:Integer shadowMapHeight]

+
+ Shadow map texture height in pixels.
+ Default — *512*. +
+ + +

.[page:object shadowMatrix]

+
+ todo +
+ +

.[page:object shadowMapSize]

+
+ todo +
+ +

.[page:object shadowCamera]

+
+ todo +
+ +

.[page:object shadowMap]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/GeometryLoader.html b/docs/59/api/loaders/GeometryLoader.html new file mode 100644 index 0000000000..628617bf06 --- /dev/null +++ b/docs/59/api/loaders/GeometryLoader.html @@ -0,0 +1,87 @@ + + + + + + + + + +

[name]

+ +
A loader for loading a geometry out of a JSON file.
+
Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.
+
Possible events:
+
    +
  • type: error, message: error message
  • +
  • type: load, content: loaded geometry
  • +
+
+ +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ +

.load( [page:String url] )

+
+ url — required +
+ +
Begin loading from url
+ + +

.parse( [page:Object data], [page:LoadingMonitor monitor] )

+
+ data — required
+ monitor — optional +
+ +
Parses the geometry in the data object, optionally monitoring its progress via the monitor object, if provided.
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/ImageLoader.html b/docs/59/api/loaders/ImageLoader.html new file mode 100644 index 0000000000..ba969afe82 --- /dev/null +++ b/docs/59/api/loaders/ImageLoader.html @@ -0,0 +1,97 @@ + + + + + + + + + +

[name]

+ +
A loader for loading an [page:Image image].
+
Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.
+ +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Events

+ +

load

+
+ Dispatched when the image has completed loading +
+
+ content — loaded image +
+ +

error

+
+ Dispatched when the image can't be loaded +
+
+ message — error message +
+ +

Properties

+ +

.[page:object crossOrigin]

+
+ todo +
+ +

Methods

+ +

.load( [page:String url] )

+
+ url — required +
+ +
Begin loading from url
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/JSONLoader.html b/docs/59/api/loaders/JSONLoader.html new file mode 100644 index 0000000000..1242d834ab --- /dev/null +++ b/docs/59/api/loaders/JSONLoader.html @@ -0,0 +1,70 @@ + + + + + + + + + + [page:Loader] → +

[name]

+ +
A loader for loading objects in JSON format.
+ + +

Constructor

+ + +

[name]([page:Boolean showStatus])

+
+ showStatus -- todo +
+
+ todo +
+ +

Properties

+ + +

.[page:boolean withCredentials]

+
+ todo +
+ +

Methods

+ +

.load( [page:String url], [page:Function callback], [page:String texturePath] )

+
+ url — required
+ callback — required. This function will be called with the loaded model as an instance of [page:Geometry geometry] when the load is completed.
+ texturePath — optional. If not specified, textures will be assumed to be in the same folder as the Javascript model file. +
+ + +

.parse([page:todo json], [page:todo texturePath]) [page:todo]

+
+ json -- todo
+ texturePath -- todo +
+
+ todo +
+ +

.loadAjaxJSON([page:todo context], [page:todo url], [page:todo callback], [page:todo texturePath], [page:todo callbackProgress]) [page:todo]

+
+ context -- todo
+ url -- todo
+ callback -- todo
+ texturePath -- todo
+ callbackProgress -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/Loader.html b/docs/59/api/loaders/Loader.html new file mode 100644 index 0000000000..100dcddb99 --- /dev/null +++ b/docs/59/api/loaders/Loader.html @@ -0,0 +1,106 @@ + + + + + + + + + +

[name]

+ +
Base class for implementing loaders.
+ + +

Constructor

+ + +

[name]([page:Boolean showStatus])

+
+ showStatus -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Boolean showStatus]

+
If true, show loading status in the statusDomElement.
+ +

.[page:DOMElement statusDomElement]

+
This is the recipient of status messages.
+ +

.[page:Function onLoadStart]

+
Will be called when load starts.
+
The default is a function with empty body.
+ +

.[page:Function onLoadProgress]

+
Will be called while load progresses.
+
The default is a function with empty body.
+ +

.[page:Function onLoadComplete]

+
Will be called when load completes.
+
The default is a function with empty body.
+ +

.[page:string crossOrigin]

+
+ todo +
+ +

Methods

+ +

.needsTangents([page:todo materials]) [page:todo]

+
+ materials -- todo +
+
+ todo +
+ +

.updateProgress([page:todo progress]) [page:todo]

+
+ progress -- todo +
+
+ todo +
+ +

.createMaterial([page:todo m], [page:todo texturePath]) [page:todo]

+
+ m -- todo
+ texturePath -- todo +
+
+ todo +
+ +

.initMaterials([page:todo materials], [page:todo texturePath]) [page:todo]

+
+ materials -- todo
+ texturePath -- todo +
+
+ todo +
+ +

.extractUrlBase([page:todo url]) [page:todo]

+
+ url -- todo +
+
+ todo +
+ +

.addStatusElement() [page:todo]

+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/LoadingMonitor.html b/docs/59/api/loaders/LoadingMonitor.html new file mode 100644 index 0000000000..4a8b564b9d --- /dev/null +++ b/docs/59/api/loaders/LoadingMonitor.html @@ -0,0 +1,89 @@ + + + + + + + + + +

[name]

+ +
A LoadingMonitor keeps track of loaded and pending data.
+
To keep track of a loader, just add it to the monitor:
+monitor.add( imageLoader ); + + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Events

+ +

progress

+
+ Dispatched each time a monitored loader completes loading +
+
+ loaded — number of completed loaders
+ total — total number of loaders monitored by this monitor +
+ +

load

+
+ Dispatched when all loaders have completed loading +
+ + +

Methods

+ +

.add( [page:Loader loader] )

+
+ loader — required. Loader to be monitored. +
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/MaterialLoader.html b/docs/59/api/loaders/MaterialLoader.html new file mode 100644 index 0000000000..2ece99952d --- /dev/null +++ b/docs/59/api/loaders/MaterialLoader.html @@ -0,0 +1,83 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Methods

+ + + +

.load([page:todo url]) [page:todo]

+
+ url -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.parse([page:todo json]) [page:todo]

+
+ json -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/SceneLoader.html b/docs/59/api/loaders/SceneLoader.html new file mode 100644 index 0000000000..f9d9f2600b --- /dev/null +++ b/docs/59/api/loaders/SceneLoader.html @@ -0,0 +1,98 @@ + + + + + + + + + +

[name]

+ +
A loader for loading a complete scene out of a JSON file.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

.[page:Function onLoadStart]

+
Will be called when load starts.
+
The default is a function with empty body.
+ +

.[page:Function onLoadProgress]

+
Will be called while load progresses.
+
The default is a function with empty body.
+ +

.[page:Function onLoadComplete]

+
Will be called when each element in the scene completes loading.
+
The default is a function with empty body.
+ +

.[page:Function callbackSync]

+
Will be called when load completes.
+
The default is a function with empty body.
+ +

.[page:Function callbackProgress]

+
Will be called as load progresses.
+
The default is a function with empty body.
+ + +

.[page:object hierarchyHandlerMap]

+
+ todo +
+ +

.[page:object geometryHandlerMap]

+
+ todo +
+ +

Methods

+ +

.load( [page:String url], [page:Function callbackFinished] )

+
+ url — required
+ callbackFinished — required. This function will be called with the loaded model as an instance of [page:Scene scene] when the load is completed. +
+ + +

.addHierarchyHandler([page:todo typeID], [page:todo loaderClass]) [page:todo]

+
+ typeID -- todo
+ loaderClass -- todo +
+
+ todo +
+ +

.parse([page:todo json], [page:todo callbackFinished], [page:todo url]) [page:todo]

+
+ json -- todo
+ callbackFinished -- todo
+ url -- todo +
+
+ todo +
+ +

.addGeometryHandler([page:todo typeID], [page:todo loaderClass]) [page:todo]

+
+ typeID -- todo
+ loaderClass -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/loaders/TextureLoader.html b/docs/59/api/loaders/TextureLoader.html new file mode 100644 index 0000000000..49bc85b34f --- /dev/null +++ b/docs/59/api/loaders/TextureLoader.html @@ -0,0 +1,98 @@ + + + + + + + + + +

[name]

+ +
Class for loading a [page:Texture texture].
+
Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.
+ +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Events

+ +

load

+
+ Dispatched when the texture has completed loading +
+
+ content — loaded texture object +
+ +

error

+
+ Dispatched when the texture can't be loaded +
+
+ message — error message +
+ +

Properties

+ +

.[page:todo crossOrigin]

+
+ default — *null*.
+ If set, assigns the *crossOrigin* attribute of the image to the value of *crossOrigin*, prior to starting the load. +
+ +

Methods

+ +

.load( [page:String url] )

+
+ url — required +
+ +
Begin loading from url
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/LineBasicMaterial.html b/docs/59/api/materials/LineBasicMaterial.html new file mode 100644 index 0000000000..4779db2e7b --- /dev/null +++ b/docs/59/api/materials/LineBasicMaterial.html @@ -0,0 +1,62 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
A material for drawing wireframe-style geometries.
+ + +

Constructor

+ + +

[name]( [page:Object parameters] )

+ +
parameters is an object with one or more properties defining the material's appearance.
+
+ color — Line color in hexadecimal. Default is 0xffffff.
+ linewidth — Line thickness. Default is 1.
+ linecap — Define appearance of line ends. Default is 'round'.
+ linejoin — Define appearance of line joints. Default is 'round'.
+ vertexColors — Define whether the material uses vertex colors, or not. Default is false.
+ fog — Define whether the material color is affected by global fog settings. Default is false. +
+ +

Properties

+ +

.[page:Integer color]

+
Sets the color of the line. Default is 0xffffff.
+ +

.[page:Float linewidth]

+
Controls line thickness. Default is 1.
+
Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+ +

.[page:String linecap]

+
Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:String linejoin]

+
Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:Boolean vertexColors]

+
Define whether the material uses vertex colors, or not. Default is false.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Boolean fog]

+
Define whether the material color is affected by global fog settings.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/LineDashedMaterial.html b/docs/59/api/materials/LineDashedMaterial.html new file mode 100644 index 0000000000..92ea6af44f --- /dev/null +++ b/docs/59/api/materials/LineDashedMaterial.html @@ -0,0 +1,76 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:number scale]

+
+ todo +
+ +

.[page:Color color]

+
+ todo +
+ +

.[page:boolean vertexColors]

+
+ todo +
+ +

.[page:number dashSize]

+
+ todo +
+ +

.[page:boolean fog]

+
+ todo +
+ +

.[page:number gapSize]

+
+ todo +
+ +

.[page:number linewidth]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/Material.html b/docs/59/api/materials/Material.html new file mode 100644 index 0000000000..b7379c81ff --- /dev/null +++ b/docs/59/api/materials/Material.html @@ -0,0 +1,188 @@ + + + + + + + + + +

[name]

+ +
Materials describe the appearance of [page:Object objects]. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

.[page:Integer id]

+
+ Unique number of this material instance. +
+ +

.[page:String name]

+
+ Material name. Default is an empty string. +
+ +

.[page:Number opacity]

+
+ Opacity. Default is *1*. +
+ +

.[page:Boolean transparent]

+
+ Defines whether this material is transparent. This has an effect on rendering, as transparent objects need an special treatment, and are rendered after the opaque (i.e. non transparent) objects. For a working example of this behaviour, check the [page:WebGLRenderer WebGLRenderer] code. +
+
Default is *false*.
+ +

.[page:Blending blending]

+
+ Which blending to use when displaying objects with this material. Default is [page:NormalBlending]. +
+ +

.[page:Integer blendSrc]

+
+ Blending source. It's one of the blending mode constants defined in [page:Three Three.js]. Default is *SrcAlphaFactor*. +
+ +

.[page:Integer blendDst]

+
+ Blending destination. It's one of the blending mode constants defined in [page:Three Three.js]. Default is *OneMinusSrcAlphaFactor*. +
+ +

.[page:Integer blendEquation]

+
+ Blending equation to use when applying blending. It's one of the constants defined in [page:Three Three.js]. Default is *AddEquation*. +
+ +

.[page:Boolean depthTest]

+
+ Whether to have depth test enabled when rendering this material. Default is *true*. +
+ +

.[page:Boolean depthWrite]

+
+ Whether rendering this material has any effect on the depth buffer. Default is *true*. +
+
+ When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts. +
+ +

.[page:Boolean polygonOffset]

+
+ Whether to use polygon offset. Default is *false*. This corresponds to the *POLYGON_OFFSET_FILL* WebGL feature. +
+ +

.[page:Integer polygonOffsetFactor]

+
+ Sets the polygon offset factor. Default is *0*. +
+ +

.[page:Integer polygonOffsetUnits]

+
+ Sets the polygon offset units. Default is *0*. +
+ +

.[page:Number alphaTest]

+
+ Sets the alpha value to be used when running an alpha test. Default is *0*. +
+ +

.[page:Boolean overdraw]

+
+ Enables/disables overdraw. If enabled, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the [page:CanvasRenderer]. Default is *false*. +
+ +

.[page:Boolean visible]

+
+ Defines whether this material is visible. Default is *true*. +
+ +

.[page:Enum side]

+
+ Defines which of the face sides will be rendered - front, back or both. +
+
+ Default is *THREE.FrontSide*. Other options are *THREE.BackSide* and *THREE.DoubleSide*. +
+ +

.[page:Boolean needsUpdate]

+
+ Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. +
+
+ This property is automatically set to *true* when instancing a new material. +
+ +

Methods

+ +

.clone([page:todo material]) [page:todo]

+
+ material -- todo +
+
+ todo +
+ +

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.dispose() [page:todo]

+
+ todo +
+ +

.dispatchEvent([page:todo event]) [page:todo]

+
+ event -- todo +
+
+ todo +
+ +

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

+
+ type -- todo
+ listener -- todo +
+
+ todo +
+ +

.setValues([page:todo values]) [page:todo]

+
+ values -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshBasicMaterial.html b/docs/59/api/materials/MeshBasicMaterial.html new file mode 100644 index 0000000000..378ce4fa25 --- /dev/null +++ b/docs/59/api/materials/MeshBasicMaterial.html @@ -0,0 +1,112 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
A material for drawing geometries in a simple shaded (flat or wireframe) way.
+
The default will render as flat polygons. To draw the mesh as wireframe, simply set the 'wireframe' property to true.
+ + +

Constructor

+ + +

[name]( [page:Object parameters] )

+ +
parameters is an object with one or more properties defining the material's appearance.
+
+ color — geometry color in hexadecimal. Default is 0xffffff.
+ wireframe — render geometry as wireframe. Default is false.
+ wireframeLinewidth — Line thickness. Default is 1.
+ wireframeLinecap — Define appearance of line ends. Default is 'round'.
+ wireframeLinejoin — Define appearance of line joints. Default is 'round'.
+ shading — Define shading type. Default is THREE.SmoothShading.
+ vertexColors — Define whether the material uses vertex colors, or not. Default is false.
+ fog — Define whether the material color is affected by global fog settings. Default is true.
+ lightMap — TODO. Default is null.
+ specularMap — TODO. Default is null.
+ envMap — TODO. Default is null.
+ skinning — TODO. Default is false.
+ morphTargets — TODO. Default is false. +
+ +

Properties

+ +

.[page:Integer color]

+
Sets the color of the geometry. Default is 0xffffff.
+ +

.[page:Boolean wireframe]

+
Render geometry as wireframe. Default is false (i.e. render as flat polygons).
+ +

.[page:Float wireframeLinewidth]

+
Controls wireframe thickness. Default is 1.
+
Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+ +

.[page:String wireframeLinecap]

+
Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:String wireframeLinejoin]

+
Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:String shading]

+
Define shading type. Default is THREE.SmoothShading.
+ +

.[page:Boolean vertexColors]

+
Define whether the material uses vertex colors, or not. Default is false.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Boolean fog]

+
Define whether the material color is affected by global fog settings.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Texture lightMap]

+
Set light map. Default is null.
+ +

.[page:Texture specularMap]

+
Set specular map. Default is null.
+ +

.[page:TextureCube envMap]

+
Set env map. Default is null.
+ +

.[page:Boolean skinning]

+
Define whether the material uses skinning. Default is false.
+ +

.[page:Boolean morphTargets]

+
Define whether the material uses morphTargets. Default is false.
+ +

.[page:object map]

+
+ todo +
+ +

.[page:number combine]

+
+ todo +
+ +

.[page:number reflectivity]

+
+ todo +
+ +

.[page:number refractionRatio]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshDepthMaterial.html b/docs/59/api/materials/MeshDepthMaterial.html new file mode 100644 index 0000000000..5c6108051c --- /dev/null +++ b/docs/59/api/materials/MeshDepthMaterial.html @@ -0,0 +1,51 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:number wireframeLinewidth]

+
+ todo +
+ +

.[page:boolean wireframe]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshFaceMaterial.html b/docs/59/api/materials/MeshFaceMaterial.html new file mode 100644 index 0000000000..a0a45c6cba --- /dev/null +++ b/docs/59/api/materials/MeshFaceMaterial.html @@ -0,0 +1,46 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo materials])

+
+ materials -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:array materials]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshLambertMaterial.html b/docs/59/api/materials/MeshLambertMaterial.html new file mode 100644 index 0000000000..87c4133ba4 --- /dev/null +++ b/docs/59/api/materials/MeshLambertMaterial.html @@ -0,0 +1,126 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
A material for non-shiny (Lambertian) surfaces, evaluated per vertex.
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+
See the base [page:Material] class for common parameters.
+ +

.[page:Color color]

+
+ Diffuse color of the material. Default is white.
+
+ +

.[page:Color ambient]

+
+ Ambient color of the material, multiplied by the color of the [page:AmbientLight]. Default is white.
+
+ +

.[page:Color emissive]

+
+ Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.
+
+ +

.[page:Integer shading]

+
How the triangles of a curved surface are rendered: as a smooth surface, as flat separate facets, or no shading at all.
+ +
Options are THREE.SmoothShading (default), THREE.FlatShading, THREE.NoShading.
+ +

.[page:Boolean wireframe]

+
Whether the triangles' edges are displayed instead of surfaces. Default is *false*.
+ +

.[page:Float wireframeLinewidth]

+
Line thickness for wireframe mode. Default is *1.0*.
+
Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+ +

.[page:String wireframeLinecap]

+
Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:String wireframeLinejoin]

+
Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:Boolean vertexColors]

+
Define whether the material uses vertex colors, or not. Default is *false*.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Boolean fog]

+
Define whether the material color is affected by global fog settings. Default is *true*.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Texture map]

+
Set color texture map. Default is null.
+ +

.[page:Texture lightMap]

+
Set light map. Default is null.
+ +

.[page:Texture specularMap]

+
Since this material does not have a specular component, the specular value affects only how much of the environment map affects the surface. Default is null.
+ +

.[page:TextureCube envMap]

+
Set env map. Default is null.
+ +

.[page:Float reflectivity]

+
How much the environment map affects the surface; also see "combine".
+ +

.[page:Float refractionRatio]

+
The index of refraction for an environment map using THREE.CubeRefractionMapping. Default is *0.98*.
+ +

.[page:Integer combine]

+
How to combine the result of the surface's color with the environment map, if any.
+ +
Options are THREE.Multiply (default), THREE.MixOperation, THREE.AddOperation. If mix is chosen, the reflectivity is used to blend between the two colors.
+ +

.[page:Boolean skinning]

+
Define whether the material uses skinning. Default is *false*.
+ +

.[page:Boolean morphTargets]

+
Define whether the material uses morphTargets. Default is *false*.
+ + +

.[page:Vector3 wrapRGB]

+
+ todo +
+ +

.[page:boolean morphNormals]

+
+ todo +
+ +

.[page:boolean wrapAround]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshNormalMaterial.html b/docs/59/api/materials/MeshNormalMaterial.html new file mode 100644 index 0000000000..9973fed881 --- /dev/null +++ b/docs/59/api/materials/MeshNormalMaterial.html @@ -0,0 +1,61 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:boolean morphTargets]

+
+ todo +
+ +

.[page:number shading]

+
+ todo +
+ +

.[page:number wireframeLinewidth]

+
+ todo +
+ +

.[page:boolean wireframe]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/MeshPhongMaterial.html b/docs/59/api/materials/MeshPhongMaterial.html new file mode 100644 index 0000000000..3404910364 --- /dev/null +++ b/docs/59/api/materials/MeshPhongMaterial.html @@ -0,0 +1,164 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
A material for shiny surfaces, evaluated per pixel.
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+
See the base [page:Material] class for common parameters.
+ +

.[page:Color color]

+
+ Diffuse color of the material. Default is white.
+
+ +

.[page:Color ambient]

+
+ Ambient color of the material, multiplied by the color of the [page:AmbientLight]. Default is white.
+
+ +

.[page:Color emissive]

+
+ Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.
+
+ +

.[page:Color specular]

+
+ Specular color of the material, i.e., how shiny the material is and the color of its shine. Setting this the same color as the diffuse value (times some intensity) makes the material more metallic-looking; setting this to some gray makes the material look more plastic. Default is dark gray.
+
+ +

.[page:Float shininess]

+
How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.
+ +

.[page:Integer shading]

+
How the triangles of a curved surface are rendered: as a smooth surface, as flat separate facets, or no shading at all.
+ +
Options are THREE.SmoothShading (default), THREE.FlatShading, THREE.NoShading.
+ +

.[page:Boolean wireframe]

+
Whether the triangles' edges are displayed instead of surfaces. Default is *false*.
+ +

.[page:Float wireframeLinewidth]

+
Line thickness for wireframe mode. Default is *1.0*.
+
Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+ +

.[page:String wireframeLinecap]

+
Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:String wireframeLinejoin]

+
Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
+ +

.[page:Boolean vertexColors]

+
Define whether the material uses vertex colors, or not. Default is *false*.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Boolean fog]

+
Define whether the material color is affected by global fog settings. Default is *true*.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Texture map]

+
Set color texture map. Default is null.
+ +

.[page:Texture lightMap]

+
Set light map. Default is null.
+ +

.[page:Texture specularMap]

+
The specular map value affects both how much the specular surface highlight contributes and how much of the environment map affects the surface. Default is null.
+ +

.[page:TextureCube envMap]

+
Set env map. Default is null.
+ +

.[page:Float reflectivity]

+
How much the environment map affects the surface; also see "combine".
+ +

.[page:Float refractionRatio]

+
The index of refraction for an environment map using THREE.CubeRefractionMapping. Default is *0.98*.
+ +

.[page:Integer combine]

+
How to combine the result of the surface's color with the environment map, if any.
+ +
Options are THREE.Multiply (default), THREE.MixOperation, THREE.AddOperation. If mix is chosen, the reflectivity is used to blend between the two colors.
+ +

.[page:Boolean skinning]

+
Define whether the material uses skinning. Default is *false*.
+ +

.[page:Boolean morphTargets]

+
Define whether the material uses morphTargets. Default is *false*.
+ + +

.[page:Vector2 normalScale]

+
+ todo +
+ +

.[page:boolean morphNormals]

+
+ todo +
+ +

.[page:boolean metal]

+
+ todo +
+ +

.[page:number bumpScale]

+
+ todo +
+ +

.[page:boolean wrapAround]

+
+ todo +
+ +

.[page:boolean perPixel]

+
+ todo +
+ +

.[page:object normalMap]

+
+ todo +
+ +

.[page:object bumpMap]

+
+ todo +
+ +

.[page:Vector3 wrapRGB]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/ParticleBasicMaterial.html b/docs/59/api/materials/ParticleBasicMaterial.html new file mode 100644 index 0000000000..7c46b50303 --- /dev/null +++ b/docs/59/api/materials/ParticleBasicMaterial.html @@ -0,0 +1,65 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
The default material used by [page:ParticleSystem particle] systems.
+ + +

Constructor

+ +

[name]( [page:Object parameters] )

+ +
parameters is an object with one or more properties defining the material's appearance.
+ +
+ color — Particle color in hexadecimal. Default is 0xffffff.
+ map — a [page:Texture texture]. Default is null. // TODO: specify what is its purpose
+ size — Define size of particles. Default is 1.0.
+ sizeAttenuation — Enable/disable size attenuation with distance.
+ vertexColors — Define whether the material uses vertex colors, or not. Default is false.
+ fog — Define whether the material color is affected by global fog settings. Default is true. +
+ +

Properties

+ +

.[page:Number color]

+ +
Sets the color of the particles. Default is 0xffffff.
+ +

.[page:Texture map]

+ +
Sets the color of the particles using data from a texture (?).
+ +

.[page:Number size]

+ +
Sets the size of the particles. Default is 1.0.
+ +

.[page:Boolean sizeAttenuation]

+ +
Specify whether particles' size will get smaller with the distance. Default is true.
+ +

.[page:Boolean vertexColors]

+
Define whether the material uses vertex colors, or not. Default is false.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ +

.[page:Boolean fog]

+
Define whether the material color is affected by global fog settings.
+
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
+ + +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/ParticleCanvasMaterial.html b/docs/59/api/materials/ParticleCanvasMaterial.html new file mode 100644 index 0000000000..e34363b3c1 --- /dev/null +++ b/docs/59/api/materials/ParticleCanvasMaterial.html @@ -0,0 +1,55 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Color color]

+
+ todo +
+ +

Methods

+ + + +

.program([page:todo context], [page:todo color]) [page:todo]

+
+ context -- todo
+ color -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/ShaderMaterial.html b/docs/59/api/materials/ShaderMaterial.html new file mode 100644 index 0000000000..519460576a --- /dev/null +++ b/docs/59/api/materials/ShaderMaterial.html @@ -0,0 +1,116 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
Material rendered with custom shaders
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:object uniforms]

+
+ todo +
+ +

.[page:string fragmentShader]

+
+ todo +
+ +

.[page:string vertexShader]

+
+ todo +
+ +

.[page:boolean morphTargets]

+
+ todo +
+ +

.[page:boolean lights]

+
+ todo +
+ +

.[page:boolean morphNormals]

+
+ todo +
+ +

.[page:boolean wireframe]

+
+ todo +
+ +

.[page:number vertexColors]

+
+ todo +
+ +

.[page:boolean skinning]

+
+ todo +
+ +

.[page:boolean fog]

+
+ todo +
+ +

.[page:object attributes]

+
+ todo +
+ +

.[page:number shading]

+
+ todo +
+ +

.[page:number linewidth]

+
+ todo +
+ +

.[page:number wireframeLinewidth]

+
+ todo +
+ +

.[page:object defines]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/materials/SpriteMaterial.html b/docs/59/api/materials/SpriteMaterial.html new file mode 100644 index 0000000000..8213440238 --- /dev/null +++ b/docs/59/api/materials/SpriteMaterial.html @@ -0,0 +1,83 @@ + + + + + + + + + + [page:Material] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Texture map]

+
+ todo +
+ +

.[page:Vector2 uvScale]

+
+ todo +
+ +

.[page:boolean sizeAttenuation]

+
+ todo +
+ +

.[page:Color color]

+
+ todo +
+ +

.[page:Vector2 uvOffset]

+
+ todo +
+ +

.[page:boolean fog]

+
+ todo +
+ +

.[page:boolean useScreenCoordinates]

+
+ todo +
+ +

.[page:boolean scaleByViewport]

+
+ todo +
+ +

.[page:Vector2 alignment]

+
+ todo +
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Box2.html b/docs/59/api/math/Box2.html new file mode 100644 index 0000000000..d88728b2e9 --- /dev/null +++ b/docs/59/api/math/Box2.html @@ -0,0 +1,233 @@ + + + + + + + + + +

[name]

+ +
Represents a boundary box in 2D space.
+ + +

Constructor

+ + +

[name]([page:Vector2 min], [page:Vector2 max])

+
+ min -- Lower (x, y) boundary of the box.
+ max -- Upper (x, y) boundary of the box. +
+
+ Creates a box bounded by min and max. +
+ + +

Properties

+ + + +

.[page:Vector2 max]

+
+ Upper (x, y) boundary of this box. +
+ +

.[page:Vector2 min]

+
+ Lower (x, y) boundary of this box. +
+ +

Methods

+ + + +

.set([page:Vector2 min], [page:Vector2 max]) [page:todo]

+
+ min -- Lower (x, y) boundary of the box.
+ max -- Upper (x, y) boundary of the box. +
+
+ Sets the lower and upper (x, y) boundaries of this box. +
+ +

.expandByPoint([page:Vector2 point]) [page:Box2]

+
+ point -- Point that should be included in the box. +
+
+ Expands the boundaries of this box to include *point*. +
+ +

.clampPoint([page:Vector2 point], [page:Vector2 optionalTarget]) [page:Vector2]

+
+ point -- Position to clamp.
+ optionalTarget -- If specified, the clamped result will be copied here. +
+
+ Clamps *point* within the bounds of this box. +
+ +

.isIntersectionBox([page:Box2 box]) [page:Boolean]

+
+ box -- Box to check for intersection against. +
+
+ Determines whether or not this box intersects *box*. +
+ +

.setFromPoints([page:Array points]) [page:Box2]

+
+ points -- Set of points that the resulting box will envelop. +
+
+ Sets the upper and lower bounds of this box to include all of the points in *points*. +
+ +

.size([page:Vector2 optionalTarget]) [page:Vector2]

+
+ optionalTarget -- If specified, the result will be copied here. +
+
+ Returns the width and height of this box. +
+ +

.union([page:Box2 box]) [page:Box2]

+
+ box -- Box that will be unioned with this box. +
+
+ Unions this box with *box* setting the upper bound of this box to the greater of the + two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' + lower bounds. +
+ +

.getParameter([page:Vector2 point]) [page:Vector2]

+
+ point -- Point to parametrize. +
+
+ Returns point as a proportion of this box's width and height. +
+ +

.expandByScalar([page:float scalar]) [page:Box2]

+
+ scalar -- Distance to expand. +
+
+ Expands each dimension of the box by *scalar*. If negative, the dimensions of the box
+ will be contracted. +
+ +

.intersect([page:Box2 box]) [page:Box2]

+
+ box -- Box to intersect with. +
+
+ Returns the intersection of this and *box*, setting the upper bound of this box to the lesser
+ of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes'
+ lower bounds. +
+ +

.containsBox([page:Box2 box]) [page:Boolean]

+
+ box -- Box to test for inclusion. +
+
+ Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly,
+ this function also returns true. +
+ +

.translate([page:Vector2 offset]) [page:Box2]

+
+ offset -- Direction and distance of offset. +
+
+ Adds *offset* to both the upper and lower bounds of this box, effectively moving this box
+ *offset* units in 2D space. +
+ +

.empty() [page:Boolean]

+
+ Returns true if this box includes zero points within its bounds.
+ Note that a box with equal lower and upper bounds still includes one point, the + one both bounds share. +
+ +

.clone() [page:Box2]

+
+ Returns a copy of this box. +
+ +

.equals([page:Box2 box]) [page:Boolean]

+
+ box -- Box to compare. +
+
+ Returns true if this box and *box* share the same lower and upper bounds. +
+ +

.expandByVector([page:Vector2 vector]) [page:Box2]

+
+ vector -- Amount to expand this box in each dimension. +
+
+ Expands this box equilaterally by *vector*. The width of this box will be + expanded by the x component of *vector* in both directions. The height of + this box will be expanded by the y component of *vector* in both directions. +
+ +

.copy([page:Box2 box]) [page:Box2]

+
+ box -- Box to copy. +
+
+ Copies the values of *box* to this box. +
+ +

.makeEmpty() [page:Box2]

+
+ Makes this box empty. +
+ +

.center([page:Vector2 optionalTarget]) [page:Vector2]

+
+ optionalTarget -- If specified, the result will be copied here. +
+
+ Returns the center point of this box. +
+ +

.distanceToPoint([page:Vector2 point]) [page:Float]

+
+ point -- Point to measure distance to. +
+
+ Returns the distance from any edge of this box to the specified point.
+ If the point lies inside of this box, the distance will be 0. +
+ +

.containsPoint([page:Vector2 point]) [page:Boolean]

+
+ point -- Point to check for inclusion. +
+
+ Returns true if the specified point lies within the boundaries of this box. +
+ +

.setFromCenterAndSize([page:Vector2 center], [page:Vector2 size]) [page:Box2]

+
+ center -- Desired center position of the box.
+ size -- Desired x and y dimensions of the box. +
+
+ Centers this box on *center* and sets this box's width and height to the values specified + in *size*. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Box3.html b/docs/59/api/math/Box3.html new file mode 100644 index 0000000000..00f204cb4c --- /dev/null +++ b/docs/59/api/math/Box3.html @@ -0,0 +1,235 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo min], [page:todo max])

+
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

Properties

+ + + +

.[page:Vector3 max]

+
+ todo +
+ +

.[page:Vector3 min]

+
+ todo +
+ +

Methods

+ + + +

.set([page:todo min], [page:todo max]) [page:todo]

+
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo matrix]) [page:todo]

+
+ matrix -- todo +
+
+ todo +
+ +

.expandByPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.clampPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.isIntersectionBox([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.setFromPoints([page:todo points]) [page:todo]

+
+ points -- todo +
+
+ todo +
+ +

.size([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.union([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.getParameter([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.expandByScalar([page:todo scalar]) [page:todo]

+
+ scalar -- todo +
+
+ todo +
+ +

.intersect([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.containsBox([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.translate([page:todo offset]) [page:todo]

+
+ offset -- todo +
+
+ todo +
+ +

.empty() [page:todo]

+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.equals([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.expandByVector([page:todo vector]) [page:todo]

+
+ vector -- todo +
+
+ todo +
+ +

.copy([page:todo box]) [page:todo]

+
+ box -- todo +
+
+ todo +
+ +

.makeEmpty() [page:todo]

+
+ todo +
+ +

.center([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.getBoundingSphere([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.distanceToPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.containsPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.setFromCenterAndSize([page:todo center], [page:todo size]) [page:todo]

+
+ center -- todo
+ size -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Color.html b/docs/59/api/math/Color.html new file mode 100644 index 0000000000..b3b68f4e12 --- /dev/null +++ b/docs/59/api/math/Color.html @@ -0,0 +1,197 @@ + + + + + + + + + +

[name]

+ +
+ Represents a color. +
+ + +

Example

+ var color = new THREE.Color(); + var color = new THREE.Color( 0xff0000 ); + var color = new THREE.Color("rgb(255,0,0)"); + + +

Constructor

+ + +

[name]( value )

+
+ value — optional argument that sets initial color. Can be a hexadecimal or a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red" +
+ +

Properties

+ +

.[page:Float r]

+
+ Red channel value between 0 and 1. Default is 1. +
+ +

.[page:Float g]

+
+ Green channel value between 0 and 1. Default is 1. +
+ +

.[page:Float b]

+
+ Blue channel value between 0 and 1. Default is 1. +
+ +

Methods

+ +

.copy( [page:Color color] ) [page:this]

+
+ color — Color to copy. +
+
+ Copies given color. +
+ +

.copyGammaToLinear( [page:Color color] ) [page:this]

+
+ color — Color to copy. +
+
+ Copies given color making conversion from gamma to linear space. +
+ +

.copyLinearToGamma( [page:Color color] ) [page:this]

+
+ color — Color to copy. +
+
+ Copies given color making conversion from linear to gamma space. +
+ +

.convertGammaToLinear() [page:this]

+
+ Converts this color from gamma to linear space. +
+ +

.convertLinearToGamma() [page:this]

+
+ Converts this color from linear to gamma space. +
+ +

.setRGB( [page:Float r], [page:Float g], [page:Float b] ) [page:this]

+
+ r — Red channel value between 0 and 1.
+ g — Green channel value between 0 and 1.
+ b — Blue channel value between 0 and 1. +
+
+ Sets this color from RGB values. +
+ +

.getHex() [page:Integer]

+
+ Returns the hexadecimal value of this color. +
+ +

.getHexString() [page:String]

+
+ Returns the string formated hexadecimal value of this color. +
+ +

.setHex( [page:Integer hex] ) [page:this]

+
+ hex — Color in hexadecimal.
+
+
+ Sets this color from a hexadecimal value. +
+ +

.setStyle( [page:String style] ) [page:this]

+
+ style — color as a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red" +
+
+ Sets this color from a CSS-style string. +
+ +

.getStyle() [page:String]

+
+ Returns the value of this color as a CSS-style string. Example: rgb(255,0,0) +
+ +

.setHSL( [page:Float h], [page:Float s], [page:Float l] ) [page:this]

+
+ h — hue value between 0.0 and 1.0
+ s — saturation value between 0.0 and 1.0
+ l — lightness value between 0.0 and 1.0 +
+
+ Sets color from hsl +
+ +

.getHSL() [page:Object hsl]

+
+ Returns an object with properties h, s, and l. +
+ +

.offsetHSL( [page:Float h], [page:Float s], [page:Float l] ) [page:this]

+
+ Adds given h, s, and l to this color's existing h, s, and l values. +
+ +

.add ( [page:Color color] ) [page:this]

+
+ Adds rgb values of given color to rgb values of this color +
+ +

.addColors( [page:Color color1], [page:Color color2] ) [page:this]

+
+ Sets this color to the sum of color1 and color2 +
+ +

.addScalar( [page:Number s] ) [page:this]

+
+ Adds s to the rgb values of this color +
+ +

.multiply( [page:Color color] ) [page:this]

+
+ Multiplies this color's rgb values by given color's rgb values +
+ +

.multiplyScalar( [page:Number s] ) [page:this]

+
+ Multiplies this color's rgb values by s +
+ +

.lerp( [page:Color color], alpha ) [page:this]

+
+ todo +
+ +

.equals( [page:Color c] ) [page:this]

+
+ Compares this color and c and returns true if they are the same, false otherwise. +
+ +

.clone() [page:Color]

+
+ Clones this color. +
+ +

.set([page:todo value]) [page:todo]

+
+ value -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Frustum.html b/docs/59/api/math/Frustum.html new file mode 100644 index 0000000000..8f883714a3 --- /dev/null +++ b/docs/59/api/math/Frustum.html @@ -0,0 +1,95 @@ + + + + + + + + + +

[name]

+ +
Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process.
+ + +

Constructor

+ + +

[name]([page:todo p0], [page:todo p1], [page:todo p2], [page:todo p3], [page:todo p4], [page:todo p5])

+
+ p0 -- todo
+ p1 -- todo
+ p2 -- todo
+ p3 -- todo
+ p4 -- todo
+ p5 -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Array planes]

+
+ Array of 6 [page:Vector4 vectors]. +
+ + +

Methods

+ +

.setFromMatrix( [page:Matrix4 matrix] )

+ +

.intersectsObject( [page:Object3D object] ) [page:Boolean]

+
+ Checks whether the object is inside the Frustum. +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.set([page:todo p0], [page:todo p1], [page:todo p2], [page:todo p3], [page:todo p4], [page:todo p5]) [page:todo]

+
+ p0 -- todo
+ p1 -- todo
+ p2 -- todo
+ p3 -- todo
+ p4 -- todo
+ p5 -- todo +
+
+ todo +
+ +

.copy([page:todo frustum]) [page:todo]

+
+ frustum -- todo +
+
+ todo +
+ +

.containsPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.intersectsSphere([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Line3.html b/docs/59/api/math/Line3.html new file mode 100644 index 0000000000..0100c023d3 --- /dev/null +++ b/docs/59/api/math/Line3.html @@ -0,0 +1,142 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo start], [page:todo end])

+
+ start -- todo
+ end -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Vector3 start]

+
+ todo +
+ +

.[page:Vector3 end]

+
+ todo +
+ +

Methods

+ + + +

.closestPointToPointParameter([page:todo point], [page:todo clampToLine]) [page:todo]

+
+ point -- todo
+ clampToLine -- todo +
+
+ todo +
+ +

.distanceSq() [page:todo]

+
+ todo +
+ +

.copy([page:todo line]) [page:todo]

+
+ line -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo matrix]) [page:todo]

+
+ matrix -- todo +
+
+ todo +
+ +

.distance() [page:todo]

+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.equals([page:todo line]) [page:todo]

+
+ line -- todo +
+
+ todo +
+ +

.set([page:todo start], [page:todo end]) [page:todo]

+
+ start -- todo
+ end -- todo +
+
+ todo +
+ +

.at([page:todo t], [page:todo optionalTarget]) [page:todo]

+
+ t -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.delta([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.closestPointToPoint([page:todo point], [page:todo clampToLine], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ clampToLine -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.center([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Math.html b/docs/59/api/math/Math.html new file mode 100644 index 0000000000..35bae92ba4 --- /dev/null +++ b/docs/59/api/math/Math.html @@ -0,0 +1,115 @@ + + + + + + + + + +

[name]

+ +
Math utility functions
+ +

Properties

+ +

Methods

+ +

.clamp( [page:Float x], [page:Float a], [page:Float b] ) [page:Float]

+
+ x — Value to be clamped.
+ a — Minimum value
+ b — Maximum value. +
+
+ Clamps the *x* to be between *a* and *b*. +
+ +

.clampBottom( [page:Float x], [page:Float a] ) [page:Float]

+
+ x — Value to be clamped.
+ a — Minimum value +
+
+ Clamps the *x* to be larger than *a*. +
+ +

.mapLinear( [page:Float x], [page:Float a1], [page:Float a2], [page:Float b1], [page:Float b2] ) [page:Float]

+
+ x — Value to be mapped.
+ a1 — Minimum value for range A.
+ a2 — Maximum value for range A.
+ b1 — Minimum value for range B.
+ b2 — Maximum value for range B. +
+
+ Linear mapping of *x* from range [*a1*, *a2*] to range [*b1*, *b2*]. +
+ +

.random16() [page:Float]

+
+ Random float from 0 to 1 with 16 bits of randomness.
+ Standard Math.random() creates repetitive patterns when applied over larger space. +
+ +

.randInt( [page:Integer low], [page:Integer high] ) [page:Integer]

+
+ Random integer from *low* to *high* interval. +
+ +

.randFloat( [page:Float low], [page:Float high] ) [page:Float]

+
+ Random float from *low* to *high* interval. +
+ +

.randFloatSpread( [page:Float range] ) [page:Float]

+
+ Random float from *- range / 2* to *range / 2* interval. +
+ +

.sign( [page:Float x] ) [page:Float]

+
+ Returns -1 if *x* is less than 0, 1 if *x* is greater than 0, and 0 if *x* is zero. +
+ +

.degToRad([page:todo degrees]) [page:todo]

+
+ degrees -- todo +
+
+ todo +
+ +

.smoothstep([page:todo x], [page:todo min], [page:todo max]) [page:todo]

+
+ x -- todo
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.smootherstep([page:todo x], [page:todo min], [page:todo max]) [page:todo]

+
+ x -- todo
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.radToDeg([page:todo radians]) [page:todo]

+
+ radians -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Matrix3.html b/docs/59/api/math/Matrix3.html new file mode 100644 index 0000000000..87a03e6830 --- /dev/null +++ b/docs/59/api/math/Matrix3.html @@ -0,0 +1,133 @@ + + + + + + + + + +

[name]

+ +
A 3x3 matrix.
+ + +

Constructor

+ + +

[name]([page:todo n11], [page:todo n12], [page:todo n13], [page:todo n21], [page:todo n22], [page:todo n23], [page:todo n31], [page:todo n32], [page:todo n33])

+
+ n11 -- todo
+ n12 -- todo
+ n13 -- todo
+ n21 -- todo
+ n22 -- todo
+ n23 -- todo
+ n31 -- todo
+ n32 -- todo
+ n33 -- todo +
+
+ todo +
+ + + +

Properties

+ +

.[page:Float32Array elements]

+
+ Float32Array with matrix values. +
+ + +

Methods

+ +

.transpose() [page:Matrix3]

+
+ Transposes this matrix in place. +
+ +

.transposeIntoArray( [page:Array r] ) [page:Matrix3]

+
+ Transposes this matrix into the supplied array *r*, and returns itself. +
+ + +

.determinant() [page:todo]

+
+ todo +
+ +

.set([page:todo n11], [page:todo n12], [page:todo n13], [page:todo n21], [page:todo n22], [page:todo n23], [page:todo n31], [page:todo n32], [page:todo n33]) [page:todo]

+
+ n11 -- todo
+ n12 -- todo
+ n13 -- todo
+ n21 -- todo
+ n22 -- todo
+ n23 -- todo
+ n31 -- todo
+ n32 -- todo
+ n33 -- todo +
+
+ todo +
+ +

.multiplyScalar([page:todo s]) [page:todo]

+
+ s -- todo +
+
+ todo +
+ +

.multiplyVector3Array([page:todo a]) [page:todo]

+
+ a -- todo +
+
+ todo +
+ +

.getNormalMatrix([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.getInverse([page:todo matrix], [page:todo throwOnInvertible]) [page:todo]

+
+ matrix -- todo
+ throwOnInvertible -- todo +
+
+ todo +
+ +

.copy([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.identity() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Matrix4.html b/docs/59/api/math/Matrix4.html new file mode 100644 index 0000000000..37f5f876fe --- /dev/null +++ b/docs/59/api/math/Matrix4.html @@ -0,0 +1,247 @@ + + + + + + + + + +

[name]

+ +
A 4x4 Matrix.
+ + +

Example

+ + // Simple rig for rotating around 3 axes + + var m = new THREE.Matrix4(); + + var m1 = new THREE.Matrix4(); + var m2 = new THREE.Matrix4(); + var m3 = new THREE.Matrix4(); + + var alpha = 0; + var beta = Math.PI; + var gamma = Math.PI/2; + + m1.makeRotationX( alpha ); + m2.makeRotationY( beta ); + m3.makeRotationZ( gamma ); + + m.multiplyMatrices( m1, m2 ); + m.multiply( m3 ); + + + +

Constructor

+ + +

[name]( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] )

+ +
Initialises the matrix with the supplied n11..n44 values, or just creates an identity matrix if no values are passed.
+ +

Properties

+ +

.[page:Float32Array elements]

+ + +

Methods

+ +

.set( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] ) [page:Matrix4]

+
+ Sets all fields of this matrix. +
+ +

.identity() [page:Matrix4]

+
+ Resets this matrix to identity. +
+ +

.copy( [page:Matrix4 m] ) [page:Matrix4]

+
+ Copies a matrix *m* into this matrix. +
+ +

.copyPosition( [page:Matrix4 m] ) [page:Matrix4]

+
+ Copies the translation component of the supplied matrix *m* into this matrix translation component. +
+ +

.extractRotation( [page:Matrix4 m] ) [page:Matrix4]

+
+ Extracts the rotation of the supplied matrix *m* into this matrix rotation component. +
+ +

.lookAt( [page:Vector3 eye], [page:Vector3 center], [page:Vector3 up], ) [page:Matrix4]

+
+ Constructs a rotation matrix, looking from *eye* towards *center* with defined *up* vector. +
+ +

.multiply( [page:Matrix4 m] ) [page:Matrix4]

+
+ Multiplies this matrix by *m*. +
+ +

.multiplyMatrices( [page:Matrix4 a], [page:Matrix4 b] ) [page:Matrix4]

+
+ Sets this matrix to *a x b*. +
+ +

.multiplyToArray( [page:Matrix4 a], [page:Matrix4 b], [page:Array r] ) [page:Matrix4]

+
+ Sets this matrix to *a x b* and stores the result into the flat array *r*.
+ *r* can be either a regular Array or a TypedArray. +
+ +

.multiplyScalar( [page:Float s] ) [page:Matrix4]

+
+ Multiplies this matrix by *s*. +
+ +

.determinant() [page:Float]

+
+ Computes determinant of this matrix.
+ Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm] +
+ +

.transpose() [page:Matrix4]

+
+ Transposes this matrix. +
+ +

.flattenToArray( [page:Array flat] ) [page:Array]

+
+ Flattens this matrix into supplied *flat* array. +
+ +

.flattenToArrayOffset( [page:Array flat], [page:Integer offset] ) [page:Array]

+
+ Flattens this matrix into supplied *flat* array starting from *offset* position in the array. +
+ +

.setPosition( [page:Vector3 v] ) [page:Matrix4]

+
+ Sets the position component for this matrix from vector *v*. +
+ +

.getInverse( [page:Matrix4 m] ) [page:Matrix4]

+
+ Sets this matrix to the inverse of matrix *m*.
+ Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm]. +
+ +

.makeRotationFromEuler( [page:Vector3 v], [page:String order] ) [page:Matrix4]

+
+ v — Rotation vector. + order — The order of rotations. Eg. "XYZ". +
+
+ Sets the rotation submatrix of this matrix to the rotation specified by Euler angles, the rest of the matrix is identity.
+ Default order is *"XYZ"*. +
+ +

.makeRotationFromQuaternion( [page:Quaternion q] ) [page:Matrix4]

+
+ Sets the rotation submatrix of this matrix to the rotation specified by *q*. The rest of the matrix is identity. +
+ +

.scale( [page:Vector3 v] ) [page:Matrix4]

+
+ Multiplies the columns of this matrix by vector *v*. +
+ +

.compose( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] ) [page:Matrix4]

+
+ Sets this matrix to the transformation composed of *translation*, *quaternion* and *scale*. +
+ +

.decompose( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] ) [page:Array]

+
+ Decomposes this matrix into the *translation*, *quaternion* and *scale* components.
+ If parameters are not passed, new instances will be created. +
+ +

.makeTranslation( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4]

+
+ Sets this matrix as translation transform. +
+ +

.makeRotationX( [page:Float theta] ) [page:Matrix4]

+
+ theta — Rotation angle in radians. +
+
+ Sets this matrix as rotation transform around x axis by *theta* radians. +
+ +

.makeRotationY( [page:Float theta] ) [page:Matrix4]

+
+ theta — Rotation angle in radians. +
+
+ Sets this matrix as rotation transform around y axis by *theta* radians. +
+ +

.makeRotationZ( [page:Float theta] ) [page:Matrix4]

+
+ theta — Rotation angle in radians. +
+
+ Sets this matrix as rotation transform around z axis by *theta* radians. +
+ +

.makeRotationAxis( [page:Vector3 axis], [page:Float theta] ) [page:Matrix4]

+
+ axis — Rotation axis, should be normalized. + theta — Rotation angle in radians. +
+
+ Sets this matrix as rotation transform around *axis* by *angle* radians.
+ Based on [link:http://www.gamedev.net/reference/articles/article1199.asp]. +
+ +

.makeScale( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4]

+
+ Sets this matrix as scale transform. +
+ +

.makeFrustum( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4]

+
+ Creates a [page:Frustum frustum] matrix. +
+ +

.makePerspective( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] ) [page:Matrix4]

+
+ Creates a perspective projection matrix. +
+ +

.makeOrthographic( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4]

+
+ Creates an orthographic projection matrix. +
+ +

.clone() [page:Matrix4]

+
+ Clones this matrix. +
+ +

.multiplyVector3Array([page:todo a]) [page:todo]

+
+ a -- todo +
+
+ todo +
+ +

.getMaxScaleOnAxis() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Plane.html b/docs/59/api/math/Plane.html new file mode 100644 index 0000000000..1f80ff053f --- /dev/null +++ b/docs/59/api/math/Plane.html @@ -0,0 +1,193 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:Vector3 normal], [page:number constant])

+
+ normal -- the normal vector defining the plane
+ constant -- the distance from the origin to the plane along the normal vector +
+ + +

Properties

+ + + +

.[page:number constant]

+
+ the distance from the origin to the plane along the normal vector +
+ +

.[page:Vector3 normal]

+
+ the normal vector defining the plane +
+ +

Methods

+ + + +

.normalize() [page:todo]

+
+ todo +
+ +

.set([page:todo normal], [page:todo constant]) [page:todo]

+
+ normal -- todo
+ constant -- todo +
+
+ todo +
+ +

.copy([page:todo plane]) [page:todo]

+
+ plane -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo matrix], [page:todo optionalNormalMatrix]) [page:todo]

+
+ matrix -- todo
+ optionalNormalMatrix -- todo +
+
+ todo +
+ +

.orthoPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.isIntersectionLine([page:todo line]) [page:todo]

+
+ line -- todo +
+
+ todo +
+ +

.intersectLine([page:todo line], [page:todo optionalTarget]) [page:todo]

+
+ line -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.setFromNormalAndCoplanarPoint([page:todo normal], [page:todo point]) [page:todo]

+
+ normal -- todo
+ point -- todo +
+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.distanceToPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.equals([page:todo plane]) [page:todo]

+
+ plane -- todo +
+
+ todo +
+ +

.setComponents([page:todo x], [page:todo y], [page:todo z], [page:todo w]) [page:todo]

+
+ x -- todo
+ y -- todo
+ z -- todo
+ w -- todo +
+
+ todo +
+ +

.distanceToSphere([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

.setFromCoplanarPoints([page:todo a], [page:todo b], [page:todo c]) [page:todo]

+
+ a -- todo
+ b -- todo
+ c -- todo +
+
+ todo +
+ +

.projectPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.negate() [page:todo]

+
+ todo +
+ +

.translate([page:todo offset]) [page:todo]

+
+ offset -- todo +
+
+ todo +
+ +

.coplanarPoint([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Quaternion.html b/docs/59/api/math/Quaternion.html new file mode 100644 index 0000000000..d4d20860e2 --- /dev/null +++ b/docs/59/api/math/Quaternion.html @@ -0,0 +1,172 @@ + + + + + + + + + +

[name]

+ +
Implementation of a quaternion. This is used for rotating things without encountering the dreaded gimbal lock issue, amongst other advantages.
+ + +

Example

+ + var quaternion = new THREE.Quaternion(); + quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); + + var vector = new THREE.Vector3( 1, 0, 0 ); + vector.applyQuaternion( quaternion ); + + + +

Constructor

+ + +

[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )

+
+ x - x coordinate
+ y - y coordinate
+ z - z coordinate
+ w - w coordinate +
+ + +

Properties

+ +

.[page:Float x]

+ +

.[page:Float y]

+ +

.[page:Float z]

+ +

.[page:Float w]

+ + +

Methods

+ +

.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Quaternion]

+
+ Sets values of this quaternion. +
+ +

.copy( [page:Quaternion q] ) [page:Quaternion]

+
+ Copies values of *q* to this quaternion. +
+ +

.setFromEuler( [page:Vector3 vector] ) [page:Quaternion]

+
+ Sets this quaternion from rotation specified by Euler angles. +
+ +

.setFromAxisAngle( [page:Vector3 axis], [page:Float angle] ) [page:Quaternion]

+
+ Sets this quaternion from rotation specified by axis and angle.
+ Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm].
+ *Axis* have to be normalized, *angle* is in radians. +
+ +

.setFromRotationMatrix( [page:Matrix4 m] ) [page:Quaternion]

+
+ Sets this quaternion from rotation component of *m*. + Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm]. +
+ +

.inverse() [page:Quaternion]

+
+ Inverts this quaternion. +
+ +

.length() [page:Float]

+
+ Computes length of this quaternion. +
+ +

.normalize() [page:Quaternion]

+
+ Normalizes this quaternion. +
+ +

.multiply( [page:Quaternion b] ) [page:Quaternion]

+
+ Multiplies this quaternion by *b*. +
+ +

.multiplyQuaternions( [page:Quaternion a], [page:Quaternion b] ) [page:Quaternion]

+
+ Sets this quaternion to *a x b*
+ Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm]. +
+ +

.multiplyVector3( [page:Vector3 vector], [page:Vector3 dest] ) [page:Quaternion]

+
+ Rotates *vector* by this quaternion into *dest*.
+ If *dest* is not specified, result goes to *vec*. +
+ +

.clone() [page:Quaternion]

+
+ Clones this quaternion. +
+ + +

Static methods

+ +

.slerp( [page:Quaternion qa], [page:Quaternion qb], [page:Quaternion qm], [page:Float t] ) [page:Quaternion]

+
+ Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/]. +
+ + +

.slerp([page:Quaternion qb], [page:float t]) [page:Quaternion]

+
+ qb -- Target quaternion rotation.
+ t -- Normalized [0..1] interpolation factor. +
+
+ Handles the spherical linear interpolation between this quaternion's configuration + and that of *qb*. *t* represents how close to the current (0) or target (1) rotation the + result should be. +
+ +

.toArray() [page: Array]

+
+ Returns the numerical elements of this quaternion in an array of format (x, y, z, w). +
+ +

.equals([page:Quaternion v]) [page:Boolean]

+
+ v -- Quaternion that this quaternion will be compared to. +
+
+ Compares each component of *v* to each component of this quaternion to determine if they + represent the same rotation. +
+ +

.lengthSq() [page:Float]

+
+ Calculates the squared length of the quaternion. +
+ +

.fromArray([page:Array array]) [page:Quaternion]

+
+ array -- Array of format (x, y, z, w) used to construct the quaternion. +
+
+ Sets this quaternion's component values from an array. +
+ +

.conjugate() [page:Quaternion]

+
+ Returns the rotational conjugate of this quaternion. The conjugate of a quaternion + represents the same rotation in the opposite direction about the rotational axis. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Ray.html b/docs/59/api/math/Ray.html new file mode 100644 index 0000000000..48996eef25 --- /dev/null +++ b/docs/59/api/math/Ray.html @@ -0,0 +1,154 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo origin], [page:todo direction])

+
+ origin -- todo
+ direction -- todo +
+
+ todo +
+ +

Properties

+ + + +

.[page:Vector3 origin]

+
+ todo +
+ +

.[page:Vector3 direction]

+
+ todo +
+ +

Methods

+ + + +

.intersectPlane([page:todo plane], [page:todo optionalTarget]) [page:todo]

+
+ plane -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.set([page:todo origin], [page:todo direction]) [page:todo]

+
+ origin -- todo
+ direction -- todo +
+
+ todo +
+ +

.isIntersectionSphere([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo matrix4]) [page:todo]

+
+ matrix4 -- todo +
+
+ todo +
+ +

.distanceToPlane([page:todo plane]) [page:todo]

+
+ plane -- todo +
+
+ todo +
+ +

.recast([page:todo t]) [page:todo]

+
+ t -- todo +
+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.isIntersectionPlane([page:todo plane]) [page:todo]

+
+ plane -- todo +
+
+ todo +
+ +

.equals([page:todo ray]) [page:todo]

+
+ ray -- todo +
+
+ todo +
+ +

.at([page:todo t], [page:todo optionalTarget]) [page:todo]

+
+ t -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.distanceToPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.closestPointToPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.copy([page:todo ray]) [page:todo]

+
+ ray -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Sphere.html b/docs/59/api/math/Sphere.html new file mode 100644 index 0000000000..e7065724af --- /dev/null +++ b/docs/59/api/math/Sphere.html @@ -0,0 +1,151 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo center], [page:todo radius])

+
+ center -- todo
+ radius -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:number radius]

+
+ todo +
+ +

.[page:Vector3 center]

+
+ todo +
+ +

Methods

+ + + +

.set([page:todo center], [page:todo radius]) [page:todo]

+
+ center -- todo
+ radius -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo matrix]) [page:todo]

+
+ matrix -- todo +
+
+ todo +
+ +

.clampPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.translate([page:todo offset]) [page:todo]

+
+ offset -- todo +
+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.equals([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

.setFromCenterAndPoints([page:todo center], [page:todo points]) [page:todo]

+
+ center -- todo
+ points -- todo +
+
+ todo +
+ +

.distanceToPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.getBoundingBox([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.containsPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.copy([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

.intersectsSphere([page:todo sphere]) [page:todo]

+
+ sphere -- todo +
+
+ todo +
+ +

.empty() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Spline.html b/docs/59/api/math/Spline.html new file mode 100644 index 0000000000..bec952677d --- /dev/null +++ b/docs/59/api/math/Spline.html @@ -0,0 +1,64 @@ + + + + + + + + + +

[name]

+ +
Represents a spline.
+ + +

Constructor

+ + +

[name]( [page:Array points] )

+ +
Initialises the spline with *points*, which are the places through which the spline will go.
+ + +

Properties

+ +

.[page:Array points]

+ + +

Methods

+ +

.initFromArray( [page:Array a] )

+
+ a — array of triplets containing x, y, z coordinates
+
+
Initialises using the data in the array as a series of points. Each value in *a* must be another array with three values, where a[n] is v, the value for the *nth* point, and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively. +
+ +

.getPoint( [page:Integer k] )

+
+ k — point index +
+
Return the interpolated point at *k*.
+ +

.getControlPointsArray( )

+
Returns an array with triplets of x, y, z coordinates that correspond to the current control points. +
+ +

.getLength( [page:Integer nSubDivisions] )

+
+ nSubDivisions — number of subdivisions between control points. Default is *100*. +
+
Returns the length of the spline when using nSubDivisions.
+ +

.reparametrizeByArcLength( [page:Float samplingCoef] )

+
+ samplingCoef — how many intermediate values to use between spline points +
+
Modifies the spline so that it looks similar to the original but has its points distributed in such way that moving along the spline it's done at a more or less constant speed. The points should also appear more uniformly spread along the curve.
+
This is done by resampling the original spline, with the density of sampling controlled by *samplingCoef*. Here it's interesting to note that denser sampling is not necessarily better: if sampling is too high, you may get weird kinks in curvature.
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Triangle.html b/docs/59/api/math/Triangle.html new file mode 100644 index 0000000000..c3c06ce546 --- /dev/null +++ b/docs/59/api/math/Triangle.html @@ -0,0 +1,144 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo a], [page:todo b], [page:todo c])

+
+ a -- todo
+ b -- todo
+ c -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Vector3 a]

+
+ todo +
+ +

.[page:Vector3 c]

+
+ todo +
+ +

.[page:Vector3 b]

+
+ todo +
+ +

Methods

+ + + +

.setFromPointsAndIndices([page:todo points], [page:todo i0], [page:todo i1], [page:todo i2]) [page:todo]

+
+ points -- todo
+ i0 -- todo
+ i1 -- todo
+ i2 -- todo +
+
+ todo +
+ +

.set([page:todo a], [page:todo b], [page:todo c]) [page:todo]

+
+ a -- todo
+ b -- todo
+ c -- todo +
+
+ todo +
+ +

.normal([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.barycoordFromPoint([page:todo point], [page:todo optionalTarget]) [page:todo]

+
+ point -- todo
+ optionalTarget -- todo +
+
+ todo +
+ +

.clone() [page:todo]

+
+ todo +
+ +

.area() [page:todo]

+
+ todo +
+ +

.midpoint([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.equals([page:todo triangle]) [page:todo]

+
+ triangle -- todo +
+
+ todo +
+ +

.plane([page:todo optionalTarget]) [page:todo]

+
+ optionalTarget -- todo +
+
+ todo +
+ +

.containsPoint([page:todo point]) [page:todo]

+
+ point -- todo +
+
+ todo +
+ +

.copy([page:todo triangle]) [page:todo]

+
+ triangle -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Vector2.html b/docs/59/api/math/Vector2.html new file mode 100644 index 0000000000..d7bd0aa49f --- /dev/null +++ b/docs/59/api/math/Vector2.html @@ -0,0 +1,229 @@ + + + + + + + + + +

[name]

+ +
2D vector.
+ +

Example

+ + var a = new THREE.Vector2( 0, 1 ); + var b = new THREE.Vector2( 1, 0 ); + + var d = a.distanceTo( b ); + + + +

Constructor

+ + +

[name]( [page:Float x], [page:Float y] )

+
+ x -- todo
+ y -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Float x]

+ +

.[page:Float y]

+ + +

Methods

+ +

.set( [page:Float x], [page:Float y] ) [page:Vector2]

+
+ Sets value of this vector. +
+ +

.copy( [page:Vector2 v] ) [page:Vector2]

+
+ Copies value of *v* to this vector. +
+ +

.add( [page:Vector2 v] ) [page:Vector2]

+
+ Adds *v* to this vector. +
+ +

.addVectors( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]

+
+ Sets this vector to *a + b*. +
+ +

.sub( [page:Vector2 v] ) [page:Vector2]

+
+ Subtracts *v* from this vector. +
+ +

.subVectors( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]

+
+ Sets this vector to *a - b*. +
+ +

.multiplyScalar( [page:Float s] ) [page:Vector2]

+
+ Multiplies this vector by scalar *s*. +
+ +

.divideScalar( [page:Float s] ) [page:Vector2]

+
+ Divides this vector by scalar *s*.
+ Set vector to *( 0, 0 )* if *s == 0*. +
+ +

.negate() [page:Vector2]

+
+ Inverts this vector. +
+ +

.dot( [page:Vector2 v] ) [page:Float]

+
+ Computes dot product of this vector and *v*. +
+ +

.lengthSq() [page:Float]

+
+ Computes squared length of this vector. +
+ +

.length() [page:Float]

+
+ Computes length of this vector. +
+ +

.normalize() [page:Vector2]

+
+ Normalizes this vector. +
+ +

.distanceTo( [page:Vector2 v] ) [page:Float]

+
+ Computes distance of this vector to *v*. +
+ +

.distanceToSquared( [page:Vector2 v] ) [page:Float]

+
+ Computes squared distance of this vector to *v*. +
+ +

.setLength( [page:Float l] ) [page:Vector2]

+
+ Normalizes this vector and multiplies it by *l*. +
+ +

.equals( [page:Vector2 v] ) [page:Vector2]

+
+ Checks for strict equality of this vector and *v*. +
+ +

.clone() [page:Vector2]

+
+ Clones this vector. +
+ + +

.clamp([page:todo min], [page:todo max]) [page:todo]

+
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.toArray() [page:todo]

+
+ todo +
+ +

.lerp([page:todo v], [page:todo alpha]) [page:todo]

+
+ v -- todo
+ alpha -- todo +
+
+ todo +
+ +

.setComponent([page:todo index], [page:todo value]) [page:todo]

+
+ index -- todo
+ value -- todo +
+
+ todo +
+ +

.min([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.addScalar([page:todo s]) [page:todo]

+
+ s -- todo +
+
+ todo +
+ +

.getComponent([page:todo index]) [page:todo]

+
+ index -- todo +
+
+ todo +
+ +

.fromArray([page:todo array]) [page:todo]

+
+ array -- todo +
+
+ todo +
+ +

.max([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.setX([page:todo x]) [page:todo]

+
+ x -- todo +
+
+ todo +
+ +

.setY([page:todo y]) [page:todo]

+
+ y -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Vector3.html b/docs/59/api/math/Vector3.html new file mode 100644 index 0000000000..e05d572d1e --- /dev/null +++ b/docs/59/api/math/Vector3.html @@ -0,0 +1,402 @@ + + + + + + + + + +

[name]

+ +
3D vector.
+ + +

Example

+ + var a = new THREE.Vector3( 1, 0, 0 ); + var b = new THREE.Vector3( 0, 1, 0 ); + + var c = new THREE.Vector3(); + c.crossVectors( a, b ); + + + +

Constructor

+ + +

[name]( [page:Float x], [page:Float y], [page:Float z] )

+
+ x -- todo
+ y -- todo
+ z -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Float x]

+ +

.[page:Float y]

+ +

.[page:Float z]

+ + +

Methods

+ +

.set( [page:Float x], [page:Float y], [page:Float z] ) [page:Vector3]

+
+ Sets value of this vector. +
+ +

.setX( [page:Float x] ) [page:Vector3]

+
+ Sets x value of this vector. +
+ +

.setY( [page:Float y] ) [page:Vector3]

+
+ Sets y value of this vector. +
+ +

.setZ( [page:Float z] ) [page:Vector3]

+
+ Sets z value of this vector. +
+ +

.copy( [page:Vector3 v] ) [page:Vector3]

+
+ Copies value of *v* to this vector. +
+ +

.add( [page:Vector3 v] ) [page:Vector3]

+
+ Adds *v* to this vector. +
+ +

.addVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]

+
+ Sets this vector to *a + b*. +
+ +

.sub( [page:Vector3 v] ) [page:Vector3]

+
+ Subtracts *v* from this vector. +
+ +

.subVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]

+
+ Sets this vector to *a - b*. +
+ +

.multiplyScalar( [page:Float s] ) [page:Vector3]

+
+ Multiplies this vector by scalar *s*. +
+ +

.divideScalar( [page:Float s] ) [page:Vector3]

+
+ Divides this vector by scalar *s*.
+ Set vector to *( 0, 0, 0 )* if *s == 0*. +
+ +

.negate() [page:Vector3]

+
+ Inverts this vector. +
+ +

.dot( [page:Vector3 v] ) [page:Float]

+
+ Computes dot product of this vector and *v*. +
+ +

.lengthSq() [page:Float]

+
+ Computes squared length of this vector. +
+ +

.length() [page:Float]

+
+ Computes length of this vector. +
+ +

.lengthManhattan() [page:Float]

+
+ Computes Manhattan length of this vector.
+ [link:http://en.wikipedia.org/wiki/Taxicab_geometry] +
+ +

.normalize() [page:Vector3]

+
+ Normalizes this vector. +
+ +

.distanceTo( [page:Vector3 v] ) [page:Float]

+
+ Computes distance of this vector to *v*. +
+ +

.distanceToSquared( [page:Vector3 v] ) [page:Float]

+
+ Computes squared distance of this vector to *v*. +
+ +

.setLength( [page:Float l] ) [page:Vector3]

+
+ Normalizes this vector and multiplies it by *l*. +
+ +

.cross( [page:Vector3 v] ) [page:Vector3]

+
+ Sets this vector to cross product of itself and *v*. +
+ +

.crossVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]

+
+ Sets this vector to cross product of *a* and *b*. +
+ +

.getPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]

+
+ Sets this vector extracting position from matrix transform. +
+ +

.getScaleFromMatrix( [page:Matrix4 m] ) [page:Vector3]

+
+ Sets this vector extracting scale from matrix transform. +
+ +

.equals( [page:Vector3 v] ) [page:Vector3]

+
+ Checks for strict equality of this vector and *v*. +
+ +

.clone() [page:Vector3]

+
+ Clones this vector. +
+ + +

.clamp([page:todo min], [page:todo max]) [page:todo]

+
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.applyMatrix3([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.applyMatrix4([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.projectOnPlane([page:todo planeNormal]) [page:todo]

+
+ planeNormal -- todo +
+
+ todo +
+ +

.projectOnVector([page:todo vector]) [page:todo]

+
+ vector -- todo +
+
+ todo +
+ +

.addScalar([page:todo s]) [page:todo]

+
+ s -- todo +
+
+ todo +
+ +

.divide([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.min([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.setComponent([page:todo index], [page:todo value]) [page:todo]

+
+ index -- todo
+ value -- todo +
+
+ todo +
+ +

.transformDirection([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.multiplyVectors([page:todo a], [page:todo b]) [page:todo]

+
+ a -- todo
+ b -- todo +
+
+ todo +
+ +

.getComponent([page:todo index]) [page:todo]

+
+ index -- todo +
+
+ todo +
+ +

.applyAxisAngle([page:todo axis], [page:todo angle]) [page:todo]

+
+ axis -- todo
+ angle -- todo +
+
+ todo +
+ +

.lerp([page:todo v], [page:todo alpha]) [page:todo]

+
+ v -- todo
+ alpha -- todo +
+
+ todo +
+ +

.max([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.angleTo([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.getColumnFromMatrix([page:todo index], [page:todo matrix]) [page:todo]

+
+ index -- todo
+ matrix -- todo +
+
+ todo +
+ +

.reflect([page:todo vector]) [page:todo]

+
+ vector -- todo +
+
+ todo +
+ +

.fromArray([page:todo array]) [page:todo]

+
+ array -- todo +
+
+ todo +
+ +

.multiply([page:todo v], [page:todo w]) [page:todo]

+
+ v -- todo
+ w -- todo +
+
+ todo +
+ +

.applyProjection([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.setEulerFromRotationMatrix([page:todo m], [page:todo order]) [page:todo]

+
+ m -- todo
+ order -- todo +
+
+ todo +
+ +

.toArray() [page:todo]

+
+ todo +
+ +

.applyEuler([page:todo v], [page:todo eulerOrder]) [page:todo]

+
+ v -- todo
+ eulerOrder -- todo +
+
+ todo +
+ +

.applyQuaternion([page:todo q]) [page:todo]

+
+ q -- todo +
+
+ todo +
+ +

.setEulerFromQuaternion([page:todo q], [page:todo order]) [page:todo]

+
+ q -- todo
+ order -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/math/Vector4.html b/docs/59/api/math/Vector4.html new file mode 100644 index 0000000000..62bf596022 --- /dev/null +++ b/docs/59/api/math/Vector4.html @@ -0,0 +1,261 @@ + + + + + + + + + +

[name]

+ +
4D vector.
+ + +

Constructor

+ + +

[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )

+
+ x -- todo
+ y -- todo
+ z -- todo
+ w -- todo +
+
+ todo +
+ + +

Properties

+ +

.[page:Float x]

+ +

.[page:Float y]

+ +

.[page:Float z]

+ +

.[page:Float w]

+ + +

Methods

+ +

.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Vector4]

+
+ Sets value of this vector. +
+ +

.copy( [page:Vector4 v] ) [page:Vector4]

+
+ Copies value of *v* to this vector. +
+ +

.add( [page:Vector4 v] ) [page:Vector4]

+
+ Adds *v* to this vector. +
+ +

.addVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4]

+
+ Sets this vector to *a + b*. +
+ +

.sub( [page:Vector4 v] ) [page:Vector4]

+
+ Subtracts *v* from this vector. +
+ +

.subVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4]

+
+ Sets this vector to *a - b*. +
+ +

.multiplyScalar( [page:Float s] ) [page:Vector4]

+
+ Multiplies this vector by scalar *s*. +
+ +

.divideScalar( [page:Float s] ) [page:Vector4]

+
+ Divides this vector by scalar *s*.
+ Set vector to *( 0, 0, 0 )* if *s == 0*. +
+ +

.negate() [page:Vector4]

+
+ Inverts this vector. +
+ +

.dot( [page:Vector4 v] ) [page:Float]

+
+ Computes dot product of this vector and *v*. +
+ +

.lengthSq() [page:Float]

+
+ Computes squared length of this vector. +
+ +

.length() [page:Float]

+
+ Computes length of this vector. +
+ +

.normalize() [page:Vector4]

+
+ Normalizes this vector. +
+ +

.setLength( [page:Float l] ) [page:Vector4]

+
+ Normalizes this vector and multiplies it by *l*. +
+ +

.lerp( [page:Vector4 v], [page:Float alpha] ) [page:Vector4]

+
+ Linearly interpolate between this vector and *v* with *alpha* factor. +
+ +

.clone() [page:Vector4]

+
+ Clones this vector. +
+ + +

.clamp([page:todo min], [page:todo max]) [page:todo]

+
+ min -- todo
+ max -- todo +
+
+ todo +
+ +

.toArray() [page:todo]

+
+ todo +
+ +

.applyMatrix4([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.min([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.max([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.setAxisAngleFromRotationMatrix([page:todo m]) [page:todo]

+
+ m -- todo +
+
+ todo +
+ +

.addScalar([page:todo s]) [page:todo]

+
+ s -- todo +
+
+ todo +
+ +

.equals([page:todo v]) [page:todo]

+
+ v -- todo +
+
+ todo +
+ +

.setAxisAngleFromQuaternion([page:todo q]) [page:todo]

+
+ q -- todo +
+
+ todo +
+ +

.setW([page:todo w]) [page:todo]

+
+ w -- todo +
+
+ todo +
+ +

.getComponent([page:todo index]) [page:todo]

+
+ index -- todo +
+
+ todo +
+ +

.fromArray([page:todo array]) [page:todo]

+
+ array -- todo +
+
+ todo +
+ +

.lengthManhattan() [page:todo]

+
+ todo +
+ +

.setComponent([page:todo index], [page:todo value]) [page:todo]

+
+ index -- todo
+ value -- todo +
+
+ todo +
+ +

.setX([page:todo x]) [page:todo]

+
+ x -- todo +
+
+ todo +
+ +

.setY([page:todo y]) [page:todo]

+
+ y -- todo +
+
+ todo +
+ +

.setZ([page:todo z]) [page:todo]

+
+ z -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Bone.html b/docs/59/api/objects/Bone.html new file mode 100644 index 0000000000..22b4677e1d --- /dev/null +++ b/docs/59/api/objects/Bone.html @@ -0,0 +1,60 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo belongsToSkin])

+
+ belongsToSkin -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Matrix4 skinMatrix]

+
+ todo +
+ +

.[page:todo skin]

+
+ todo +
+ +

Methods

+ + + +

.update([page:todo parentSkinMatrix], [page:todo forceUpdate]) [page:todo]

+
+ parentSkinMatrix -- todo
+ forceUpdate -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/LOD.html b/docs/59/api/objects/LOD.html new file mode 100644 index 0000000000..061b25243e --- /dev/null +++ b/docs/59/api/objects/LOD.html @@ -0,0 +1,68 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ + + +

.[page:array objects]

+
+ todo +
+ +

Methods

+ + + +

.addLevel([page:todo object], [page:todo distance]) [page:todo]

+
+ object -- todo
+ distance -- todo +
+
+ todo +
+ +

.getObjectForDistance([page:todo distance]) [page:todo]

+
+ distance -- todo +
+
+ todo +
+ +

.update([page:todo camera]) [page:todo]

+
+ camera -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Line.html b/docs/59/api/objects/Line.html new file mode 100644 index 0000000000..4f7fc40bfb --- /dev/null +++ b/docs/59/api/objects/Line.html @@ -0,0 +1,58 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
A line or a series of lines.
+ + +

Constructor

+ + +

[name]( [page:Geometry geometry], [page:Material material], [page:Integer type] )

+ +
+ geometry — Vertices representing the line segment(s).
+ material — Material for the line. Default is [page:LineBasicMaterial LineBasicMaterial].
+ type — Connection type between vertices. Default is THREE.LineStrip. +
+ +
If no material is supplied, a randomized line material will be created and assigned to the object.
+ +
Also, if no type is supplied, the default (THREE.LineStrip) will be used).
+ +

Properties

+ +

.[page:Geometry geometry]

+
+ Vertices representing the line segment(s). +
+ +

.[page:Material material]

+
+ Material for the line. +
+ +

.[page:Integer type]

+
+ Possible values: THREE.LineStrip or THREE.LinePieces. THREE.LineStrip will draw a series of segments connecting each point (first connected to the second, the second connected to the third, and so on and so forth); and THREE.LinePieces will draw a series of pairs of segments (first connected to the second, the third connected to the fourth, and so on and so forth).
+ +
+ In OpenGL terms, LineStrip is the classic GL_LINE_STRIP and LinePieces is the equivalent to GL_LINES. +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Mesh.html b/docs/59/api/objects/Mesh.html new file mode 100644 index 0000000000..e6cde2ba1c --- /dev/null +++ b/docs/59/api/objects/Mesh.html @@ -0,0 +1,82 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
Base class for Mesh objects, such as [page:MorphAnimMesh] and [page:SkinnedMesh].
+ + +

Constructor

+ + +

[name]([page:todo geometry], [page:todo material])

+
+ geometry -- todo
+ material -- todo +
+
+ todo +
+ + +

[name]( [page:Geometry geometry], [page:Material material] )

+ +
+ geometry — An instance of [page:Geometry].
+ material — An instance of [page:Material] (optional). +
+ +

Properties

+ +

.[page:Geometry geometry]

+ +
An instance of [page:Geometry], defining the object's structure.
+ +

.[page:Material material]

+ +
An instance of [page:Material], defining the object's appearance. Default is a [page:MeshBasicMaterial] with wireframe mode enabled and randomised colour.
+ +

Methods

+ +

.getMorphTargetIndexByName( [page:String name] )

+
+ name — a morph target name
+
+ + Returns the index of a morph target defined by name. + + +

.setMaterial([page:todo material]) [page:todo]

+
+ material -- todo +
+
+ todo +
+ +

.setGeometry([page:todo geometry]) [page:todo]

+
+ geometry -- todo +
+
+ todo +
+ +

.updateMorphTargets() [page:todo]

+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/MorphAnimMesh.html b/docs/59/api/objects/MorphAnimMesh.html new file mode 100644 index 0000000000..5b4178f60e --- /dev/null +++ b/docs/59/api/objects/MorphAnimMesh.html @@ -0,0 +1,144 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo geometry], [page:todo material])

+
+ geometry -- todo
+ material -- todo +
+
+ todo +
+ + + +

Properties

+ + + +

.[page:boolean directionBackwards]

+
+ todo +
+ +

.[page:number direction]

+
+ todo +
+ +

.[page:number endKeyframe]

+
+ todo +
+ +

.[page:boolean mirroredLoop]

+
+ todo +
+ +

.[page:number startKeyframe]

+
+ todo +
+ +

.[page:number lastKeyframe]

+
+ todo +
+ +

.[page:number length]

+
+ todo +
+ +

.[page:number time]

+
+ todo +
+ +

.[page:number duration]

+
+ todo +
+ +

.[page:number currentKeyframe]

+
+ todo +
+ +

Methods

+ + + +

.setDirectionForward() [page:todo]

+
+ todo +
+ +

.playAnimation([page:todo label], [page:todo fps]) [page:todo]

+
+ label -- todo
+ fps -- todo +
+
+ todo +
+ +

.setFrameRange([page:todo start], [page:todo end]) [page:todo]

+
+ start -- todo
+ end -- todo +
+
+ todo +
+ +

.setDirectionBackward() [page:todo]

+
+ todo +
+ +

.parseAnimations() [page:todo]

+
+ todo +
+ +

.updateAnimation([page:todo delta]) [page:todo]

+
+ delta -- todo +
+
+ todo +
+ +

.setAnimationLabel([page:todo label], [page:todo start], [page:todo end]) [page:todo]

+
+ label -- todo
+ start -- todo
+ end -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Particle.html b/docs/59/api/objects/Particle.html new file mode 100644 index 0000000000..52d7f45ab1 --- /dev/null +++ b/docs/59/api/objects/Particle.html @@ -0,0 +1,46 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo material])

+
+ material -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:todo material]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/ParticleSystem.html b/docs/59/api/objects/ParticleSystem.html new file mode 100644 index 0000000000..b0b1bc0481 --- /dev/null +++ b/docs/59/api/objects/ParticleSystem.html @@ -0,0 +1,52 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
A class for displaying particles in the form of variable size points. For example, if using the [page:WebGLRenderer], the particles are displayed using GL_POINTS.
+ + +

Constructor

+ + +

[name]( [page:Geometry geometry], [page:Material material] )

+ +
+ geometry — An instance of [page:Geometry].
+ material — An instance of [page:Material] (optional). +
+ +

Properties

+ +

.[page:Geometry geometry]

+ +
An instance of [page:Geometry], where each vertex designates the position of a particle in the system.
+ +

.[page:Material material]

+ +
An instance of [page:Material], defining the object's appearance. Default is a [page:ParticleBasicMaterial] with randomised colour.
+ +

.[page:Boolean frustrumCulled]

+ +
Specifies whether the particle system will be culled if it's outside the camera's frustum. By default this is set to false.
+ +

.[page:boolean sortParticles]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Ribbon.html b/docs/59/api/objects/Ribbon.html new file mode 100644 index 0000000000..ca6061a15c --- /dev/null +++ b/docs/59/api/objects/Ribbon.html @@ -0,0 +1,52 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo geometry], [page:todo material])

+
+ geometry -- todo
+ material -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:todo geometry]

+
+ todo +
+ +

.[page:todo material]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/SkinnedMesh.html b/docs/59/api/objects/SkinnedMesh.html new file mode 100644 index 0000000000..6a2f60a4bc --- /dev/null +++ b/docs/59/api/objects/SkinnedMesh.html @@ -0,0 +1,76 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo geometry], [page:todo material], [page:todo useVertexTexture])

+
+ geometry -- todo
+ material -- todo
+ useVertexTexture -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:array bones]

+
+ todo +
+ +

.[page:Matrix4 identityMatrix]

+
+ todo +
+ +

.[page:boolean useVertexTexture]

+
+ todo +
+ +

.[page:array boneMatrices]

+
+ todo +
+ +

Methods

+ + + +

.pose() [page:todo]

+
+ todo +
+ +

.addBone([page:todo bone]) [page:todo]

+
+ bone -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/objects/Sprite.html b/docs/59/api/objects/Sprite.html new file mode 100644 index 0000000000..4f004b105e --- /dev/null +++ b/docs/59/api/objects/Sprite.html @@ -0,0 +1,51 @@ + + + + + + + + + + [page:Object3D] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo material])

+
+ material -- todo +
+
+ todo +
+ + +

Properties

+ + + +

.[page:Vector3 rotation3d]

+
+ todo +
+ +

.[page:SpriteMaterial material]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/CanvasRenderer.html b/docs/59/api/renderers/CanvasRenderer.html new file mode 100644 index 0000000000..7735678df7 --- /dev/null +++ b/docs/59/api/renderers/CanvasRenderer.html @@ -0,0 +1,137 @@ + + + + + + + + + +

[name]

+ +
The Canvas renderer displays your beautifully crafted scenes not using WebGL, + but draws it using the (slower) Canvas 2D Context API.
+
This renderer can be a nice fallback from [page:WebGLRenderer] for simple scenes:
+ + if (window.WebGLRenderingContext) + renderer = new THREE.WebGLRenderer(); + else + renderer = new THREE.CanvasRenderer(); + +
+ Note: both WebGLRenderer and CanvasRenderer are embedded in the web page using an HTML5 <canvas> tag. + The "Canvas" in CanvasRenderer means it uses Canvas 2D instead of WebGL.
+ Don't confuse either CanvasRenderer with the SoftwareRenderer example, which simulates a screen buffer in a Javascript array. +
+ + +

Constructor

+ + +

[name]([page:todo parameters])

+
+ parameters -- todo +
+
+ todo +
+ + +

Properties

+ + +

.[page:object info]

+
+ todo +
+ +

.[page:object domElement]

+
+ todo +
+ +

.[page:number devicePixelRatio]

+
+ todo +
+ +

.[page:boolean autoClear]

+
+ todo +
+ +

.[page:boolean sortObjects]

+
+ todo +
+ +

.[page:boolean sortElements]

+
+ todo +
+ +

Methods

+ + +

.getMaxAnisotropy() [page:todo]

+
+ todo +
+ +

.render([page:todo scene], [page:todo camera]) [page:todo]

+
+ scene -- todo
+ camera -- todo +
+
+ todo +
+ +

.clear() [page:todo]

+
+ todo +
+ +

.setClearColor([page:todo color], [page:todo alpha]) [page:todo]

+
+ color -- todo
+ alpha -- todo +
+
+ todo +
+ +

.setFaceCulling() [page:todo]

+
+ todo +
+ +

.supportsVertexTextures() [page:todo]

+
+ todo +
+ +

.setSize([page:todo width], [page:todo height], [page:todo updateStyle]) [page:todo]

+
+ width -- todo
+ height -- todo
+ updateStyle -- todo +
+
+ todo +
+ +

.setClearColorHex([page:todo hex], [page:todo alpha]) [page:todo]

+
+ hex -- todo
+ alpha -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/WebGLRenderTarget.html b/docs/59/api/renderers/WebGLRenderTarget.html new file mode 100644 index 0000000000..d7b03a759e --- /dev/null +++ b/docs/59/api/renderers/WebGLRenderTarget.html @@ -0,0 +1,44 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo width], [page:todo height], [page:todo options])

+
+ width -- todo
+ height -- todo
+ options -- todo +
+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/WebGLRenderTargetCube.html b/docs/59/api/renderers/WebGLRenderTargetCube.html new file mode 100644 index 0000000000..d7b03a759e --- /dev/null +++ b/docs/59/api/renderers/WebGLRenderTargetCube.html @@ -0,0 +1,44 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo width], [page:todo height], [page:todo options])

+
+ width -- todo
+ height -- todo
+ options -- todo +
+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/WebGLRenderer.html b/docs/59/api/renderers/WebGLRenderer.html new file mode 100644 index 0000000000..ba69c630eb --- /dev/null +++ b/docs/59/api/renderers/WebGLRenderer.html @@ -0,0 +1,371 @@ + + + + + + + + + +

[name]

+ +
The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it.
+
This renderer has way better performance than [page:CanvasRenderer].
+ + +

Constructor

+ + +

[name]( [page:Object parameters] )

+ +
parameters is an optional object with properties defining the renderer's behaviour. The constructor also accepts no parameters at all. In all cases, it will assume sane defaults when parameters are missing.
+ +
+ canvas — A [page:Canvas] where the renderer draws its output.
+ precision — shader precision. Can be *"highp"*, *"mediump"* or *"lowp"*.
+ alpha — [page:Boolean], default is *true*.
+ premultipliedAlpha — [page:Boolean], default is *true*.
+ antialias — [page:Boolean], default is *false*.
+ stencil — [page:Boolean], default is *true*.
+ preserveDrawingBuffer — [page:Boolean], default is *false*.
+ clearColor — [page:Integer], default is *0x000000*.
+ clearAlpha — [page:Float], default is *0*.
+ maxLights — [page:Integer], default is *4*.
+
+ +

Properties

+ +

.[page:DOMElement domElement]

+ +
A [page:Canvas] where the renderer draws its output.
+ This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page.
+ +

.[page:todo context]

+ +
The HTML5 Canvas's 'webgl' context obtained from the canvas where the renderer will draw.
+ +

.[page:Boolean autoClear]

+ +
Defines whether the renderer should automatically clear its output before rendering.
+ + +

.[page:Boolean autoClearColor]

+ +
If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.
+ + +

.[page:Boolean autoClearDepth]

+ +
If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.
+ + +

.[page:Boolean autoClearStencil]

+ +
If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.
+ + +

.[page:Boolean sortObjects]

+ +
Defines whether the renderer should sort objects. Default is true.
+ +
TODO
+ + +

.[page:Boolean autoUpdateObjects]

+ +
Defines whether the renderer should auto update objects. Default is true.
+ +
TODO
+ + + +

.[page:Boolean gammaInput]

+ +
Default is false. TODO
+ + +

.[page:Boolean gammaOutput]

+ +
Default is false. TODO
+ + +

.[page:Boolean physicallyBasedShading]

+ +
Default is false. TODO
+ + +

.[page:Boolean shadowMapEnabled]

+ +
Default is false. TODO
+ + +

.[page:Boolean shadowMapAutoUpdate]

+ +
Default is true. TODO
+ + +

.[page:Integer shadowMapType]

+ +
Defines shadow map type (unfiltered, percentage close filtering, percentage close filtering with bilinear filtering in shader)
+
Options are THREE.BasicShadowMap, THREE.PCFShadowMap, THREE.PCFSoftShadowMap. Default is THREE.PCFShadowMap.
+ + +

.[page:Boolean shadowMapCullFace]

+ +
Default is true. TODO
+ + +

.[page:Boolean shadowMapDebug]

+ +
Default is false. TODO
+ + +

.[page:Boolean shadowMapCascade]

+ +
Default is false. TODO
+ + +

.[page:Integer maxMorphTargets]

+ +
Default is 8. TODO
+ + +

.[page:Integer maxMorphNormals]

+ +
Default is 4. TODO
+ + +

.[page:Boolean autoScaleCubemaps]

+ +
Default is true. TODO
+ + +

.[page:Boolean renderPluginsPre]

+ +
An array with render plugins to be applied before rendering.
+
Default is an empty array, or [].
+ + +

.[page:Boolean renderPluginsPost]

+ +
An array with render plugins to be applied after rendering.
+
Default is an empty array, or [].
+ + +

.[page:Object info]

+ +
An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields:
+
+
    +
  • memory: +
      +
    • programs
    • +
    • geometries
    • +
    • textures
    • +
    +
  • +
  • render: +
      +
    • calls
    • +
    • vertices
    • +
    • faces
    • +
    • points
    • +
    +
  • +
+
+ +

.[page:ShadowMapPlugin shadowMapPlugin]

+
+ todo +
+ +

.[page:number shadowMapCullFace]

+
+ todo +
+ +

.[page:number devicePixelRatio]

+
+ todo +
+ +

Methods

+ +

.getContext()

+
+ Return the WebGL context. +
+ +

.supportsVertexTextures()

+
+ Return a [page:Boolean] true if the context supports vertex textures. +
+ + +

.setSize( [page:Integer width], [page:Integer height] )

+
Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0).
+ +

.setViewport( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )

+
Sets the viewport to render from (x, y) to (x + width, y + height).
+ + +

.setScissor( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )

+
Sets the scissor area from (x, y) to (x + width, y + height).
+ +

.enableScissorTest( [page:Boolean enable] )

+
Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.
+ +

.setClearColor( [page:Color color], [page:Float alpha] )

+
Sets the clear color and opacity.
+ + // Creates a renderer with red background + var renderer = new THREE.WebGLRenderer(); + renderer.setSize(200, 100); + renderer.setClearColor(0xff0000, 1); + + +

.getClearColor() [page:Color]

+
Returns a [page:Color THREE.Color] instance with the current clear color.
+ +

.getClearAlpha() [page:Float]

+
Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.
+ +

.clear( [page:Boolean color], [page:Boolean depth], [page:Boolean stencil] )

+
Tells the renderer to clear its color, depth or stencil drawing buffer(s).
+
If no parameters are passed, no buffer will be cleared.
+ +

.addPostPlugin( plugin )

+
Initialises the postprocessing plugin, and adds it to the renderPluginsPost array.
+ +

.addPrePlugin( plugin )

+
Initialises the preprocessing plugin, and adds it to the renderPluginsPre array.
+ +

.updateShadowMap( [page:Scene scene], [page:Camera camera] )

+
scene — an instance of [page:Scene]
+ camera — an instance of [page:Camera]
+
Tells the shadow map plugin to update using the passed scene and camera parameters.
+ + +

.renderBufferImmediate( [page:Object3D object], [page:??? program], [page:??? shading] )

+
object — an instance of [page:Object3D]]
+ program — an instance of ???
+ shading — an instance of ???
+
+
TODO.
+ + +

.renderBufferDirect( camera, lights, fog, material, geometryGroup, object )

+
TODO.
+ + +

.renderBuffer( camera, lights, fog, material, geometryGroup, object )

+
TODO.
+ + +

.render( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )

+
Render a scene using a camera.
+
The render is done to the renderTarget (if specified) or to the canvas as usual.
+
If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false.
+ + +

.renderImmediateObject( camera, lights, fog, material, object )

+
TODO.
+ + +

.initWebGLObjects( [page:Scene scene] )

+
TODO.
+ + +

.initMaterial( material, lights, fog, object )

+
TODO.
+ + +

.setFaceCulling( cullFace, frontFace )

+
+ [page:String cullFace] — "back", "front", "front_and_back", or false.
+ [page:String frontFace] — "ccw" or "cw
+
+
Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering.
+
If cullFace is false, culling will be disabled.
+ + +

.setDepthTest( depthTest )

+
TODO.
+ + +

.setDepthWrite( depthWrite )

+
TODO.
+ + +

.setBlending( blending, blendEquation, blendSrc, blendDst )

+
TODO.
+ + +

.setTexture( texture, slot )

+
TODO.
+ + +

.setRenderTarget( renderTarget )

+
TODO.
+ + + +

.supportsCompressedTextureS3TC() [page:todo]

+
+ todo +
+ +

.getMaxAnisotropy() [page:todo]

+
+ todo +
+ +

.getPrecision() [page:todo]

+
+ todo +
+ +

.setMaterialFaces([page:todo material]) [page:todo]

+
+ material -- todo +
+
+ todo +
+ +

.supportsStandardDerivatives() [page:todo]

+
+ todo +
+ +

.supportsFloatTextures() [page:todo]

+
+ todo +
+ +

.clearTarget([page:todo renderTarget], [page:todo color], [page:todo depth], [page:todo stencil]) [page:todo]

+
+ renderTarget -- todo
+ color -- todo
+ depth -- todo
+ stencil -- todo +
+
+ todo +
+ +

.setClearColorHex([page:todo hex], [page:todo alpha]) [page:todo]

+
+ hex -- todo
+ alpha -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/WebGLShaders.html b/docs/59/api/renderers/WebGLShaders.html new file mode 100644 index 0000000000..2ca70df3a0 --- /dev/null +++ b/docs/59/api/renderers/WebGLShaders.html @@ -0,0 +1,32 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ +

[name]()

+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableFace3.html b/docs/59/api/renderers/renderables/RenderableFace3.html new file mode 100644 index 0000000000..e6d6c00a85 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableFace3.html @@ -0,0 +1,104 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:array vertexNormalsModelView]

+
+ todo +
+ +

.[page:Vector3 normalModel]

+
+ todo +
+ +

.[page:object color]

+
+ todo +
+ +

.[page:object material]

+
+ todo +
+ +

.[page:array uvs]

+
+ todo +
+ +

.[page:RenderableVertex v1]

+
+ todo +
+ +

.[page:RenderableVertex v2]

+
+ todo +
+ +

.[page:RenderableVertex v3]

+
+ todo +
+ +

.[page:Vector3 normalModelView]

+
+ todo +
+ +

.[page:Vector3 centroidModel]

+
+ todo +
+ +

.[page:number vertexNormalsLength]

+
+ todo +
+ +

.[page:object z]

+
+ todo +
+ +

.[page:array vertexNormalsModel]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableFace4.html b/docs/59/api/renderers/renderables/RenderableFace4.html new file mode 100644 index 0000000000..626f956f15 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableFace4.html @@ -0,0 +1,109 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:array vertexNormalsModelView]

+
+ todo +
+ +

.[page:Vector3 normalModel]

+
+ todo +
+ +

.[page:object color]

+
+ todo +
+ +

.[page:object material]

+
+ todo +
+ +

.[page:array uvs]

+
+ todo +
+ +

.[page:RenderableVertex v1]

+
+ todo +
+ +

.[page:RenderableVertex v2]

+
+ todo +
+ +

.[page:RenderableVertex v3]

+
+ todo +
+ +

.[page:RenderableVertex v4]

+
+ todo +
+ +

.[page:Vector3 centroidModel]

+
+ todo +
+ +

.[page:Vector3 normalModelView]

+
+ todo +
+ +

.[page:number vertexNormalsLength]

+
+ todo +
+ +

.[page:object z]

+
+ todo +
+ +

.[page:array vertexNormalsModel]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableLine.html b/docs/59/api/renderers/renderables/RenderableLine.html new file mode 100644 index 0000000000..970a89f1b5 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableLine.html @@ -0,0 +1,59 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:RenderableVertex v1]

+
+ todo +
+ +

.[page:RenderableVertex v2]

+
+ todo +
+ +

.[page:object z]

+
+ todo +
+ +

.[page:object material]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableObject.html b/docs/59/api/renderers/renderables/RenderableObject.html new file mode 100644 index 0000000000..207be75380 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableObject.html @@ -0,0 +1,49 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:object object]

+
+ todo +
+ +

.[page:object z]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableParticle.html b/docs/59/api/renderers/renderables/RenderableParticle.html new file mode 100644 index 0000000000..86002a25b8 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableParticle.html @@ -0,0 +1,74 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:Vector2 scale]

+
+ todo +
+ +

.[page:object material]

+
+ todo +
+ +

.[page:object object]

+
+ todo +
+ +

.[page:object y]

+
+ todo +
+ +

.[page:object x]

+
+ todo +
+ +

.[page:object rotation]

+
+ todo +
+ +

.[page:object z]

+
+ todo +
+ +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/renderers/renderables/RenderableVertex.html b/docs/59/api/renderers/renderables/RenderableVertex.html new file mode 100644 index 0000000000..5bfffdc2a2 --- /dev/null +++ b/docs/59/api/renderers/renderables/RenderableVertex.html @@ -0,0 +1,62 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

[name]()

+ + +

Properties

+ + + +

.[page:boolean visible]

+
+ todo +
+ +

.[page:Vector4 positionScreen]

+
+ todo +
+ +

.[page:Vector3 positionWorld]

+
+ todo +
+ +

Methods

+ + + +

.copy([page:todo vertex]) [page:todo]

+
+ vertex -- todo +
+
+ todo +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/scenes/Fog.html b/docs/59/api/scenes/Fog.html new file mode 100644 index 0000000000..20c6ee43b2 --- /dev/null +++ b/docs/59/api/scenes/Fog.html @@ -0,0 +1,46 @@ + + + + + + + + + +

[name]

+ +
This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance.
+ + +

Constructor

+ + +

[name]( [page:Integer hex], [page:Float near], [page:Float far] )

+
The hex parameter is passed to the [page:Color] constructor to set the color property. Hex can be a hexadecimal integer or a CSS-style string.
+ +

Properties

+ +

.[page:String name]

+
Default is the empty string.
+ +

.[page:Color color]

+
Fog color. Example: If set to black, far away objects will be rendered black.
+ +

.[page:Float near]

+
The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog.
+
Default is 1.
+ +

.[page:Float far]

+
The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog.
+
Default is 1000.
+ +

Methods

+ +

.clone() [page:Fog]

+
Returns a copy of this.
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/scenes/FogExp2.html b/docs/59/api/scenes/FogExp2.html new file mode 100644 index 0000000000..a2e19b296e --- /dev/null +++ b/docs/59/api/scenes/FogExp2.html @@ -0,0 +1,43 @@ + + + + + + + + + +

[name]

+ +
This class contains the parameters that define exponential fog, i.e., that grows exponentially denser with the distance.
+ + +

Constructor

+ + +

[name]( [page:Integer hex], [page:Float density])

+ +
The hex parameter is passed to the [page:Color] constructor to set the color property. Hex can be a hexadecimal integer or a CSS-style string.
+

Properties

+ +

.[page:String name]

+
Default is the empty string.
+ +

.[page:Color color]

+
Fog color. Example: If set to black, far away objects will be rendered black.
+ +

.[page:Float density]

+
Defines how fast the fog will grow dense.
+
Default is 0.00025.
+ +

Methods

+ +

.clone() [page:FogExp2]

+
Returns a copy of this.
+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/scenes/Scene.html b/docs/59/api/scenes/Scene.html new file mode 100644 index 0000000000..43db559c10 --- /dev/null +++ b/docs/59/api/scenes/Scene.html @@ -0,0 +1,50 @@ + + + + + + + + + + [page:Object3D] → +

[name]

+ +
Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.
+ + +

Constructor

+ + +

[name]()

+
+ todo +
+ + +

Properties

+ +

.[page:Fog fog]

+ +
A [page:Fog fog] instance defining the type of fog that affects everything rendered in the scene. Default is null.
+ +

.[page:Material overrideMaterial]

+ +
If not null, it will force everything in the scene to be rendered with that material. Default is null.
+ +

.[page:Boolean matrixAutoUpdate]

+ +
??? - Default is false.
+ +

.[page:boolean autoUpdate]

+
+ todo +
+ +

Methods

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/textures/CompressedTexture.html b/docs/59/api/textures/CompressedTexture.html new file mode 100644 index 0000000000..4b75e06e44 --- /dev/null +++ b/docs/59/api/textures/CompressedTexture.html @@ -0,0 +1,51 @@ + + + + + + + + + + [page:Texture] → + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo mipmaps], [page:todo width], [page:todo height], [page:todo format], [page:todo type], [page:todo mapping], [page:todo wrapS], [page:todo wrapT], [page:todo magFilter], [page:todo minFilter], [page:todo anisotropy])

+
+ mipmaps -- todo
+ width -- todo
+ height -- todo
+ format -- todo
+ type -- todo
+ mapping -- todo
+ wrapS -- todo
+ wrapT -- todo
+ magFilter -- todo
+ minFilter -- todo
+ anisotropy -- todo +
+
+ todo +
+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/textures/DataTexture.html b/docs/59/api/textures/DataTexture.html new file mode 100644 index 0000000000..662d547353 --- /dev/null +++ b/docs/59/api/textures/DataTexture.html @@ -0,0 +1,49 @@ + + + + + + + + + +

[name]

+ +
todo
+ + +

Constructor

+ + +

[name]([page:todo data], [page:todo width], [page:todo height], [page:todo format], [page:todo type], [page:todo mapping], [page:todo wrapS], [page:todo wrapT], [page:todo magFilter], [page:todo minFilter], [page:todo anisotropy])

+
+ data -- todo
+ width -- todo
+ height -- todo
+ format -- todo
+ type -- todo
+ mapping -- todo
+ wrapS -- todo
+ wrapT -- todo
+ magFilter -- todo
+ minFilter -- todo
+ anisotropy -- todo +
+
+ todo +
+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/api/textures/Texture.html b/docs/59/api/textures/Texture.html new file mode 100644 index 0000000000..c585f439ce --- /dev/null +++ b/docs/59/api/textures/Texture.html @@ -0,0 +1,152 @@ + + + + + + + + + +

[name]

+ +
Create a texture to apply to a surface or as a reflection or refraction map.
+ + +

Constructor

+ +

[name]( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy )

+ +

Example

+ + + // load a texture, set wrap mode to repeat + var texture = THREE.ImageUtils.loadTexture( "textures/water.jpg" ); + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set( 4, 4 ); + + +

Properties

+ +

.[page:Image image]

+
+ An Image object, typically created using the ImageUtils or [page:ImageLoader ImageLoader] classes. The Image object can include an image (e.g., PNG, JPG, GIF, DDS), video (e.g., MP4, OGG/OGV), or set of six images for a cube map. +
+ +

.[page:object mapping]

+
+ How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; THREE.SphericalReflectionMapping, a spherical reflection map projection; and THREE.SphericalRefractionMapping. +
+ +

.[page:number wrapS]

+
+ The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping. +
+ +

.[page:number wrapT]

+
+ The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping. +
+ +

.[page:number magFilter]

+
+ How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texel. +
+ +

.[page:number minFilter]

+
+ How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipMapLinearFilter, which uses mipmapping and a trilinear filter. Other choices are THREE.NearestFilter, THREE.NearestMipMapNearestFilter, THREE.NearestMipMapLinearFilter, THREE.LinearFilter, and THREE.LinearMipMapNearestFilter. These vary whether the nearest texel or nearest four texels are retrieved on the nearest mipmap or nearest two mipmaps. Interpolation occurs among the samples retrieved. +
+ +

.[page:number format]

+
+ The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. There are also compressed texture formats, if the S3TC extension is supported: THREE.RGB_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT3_Format, and THREE.RGBA_S3TC_DXT5_Format. +
+ +

.[page:number type]

+
+ The default is THREE.UnsignedByteType. Other valid types (as WebGL allows) are THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.FloatType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type. +
+ +

.[page:number anisotropy]

+
+ The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2. +
+ +

.[page:boolean needsUpdate]

+
+ If a texture is changed after creation, set this flag to true so that the texture is properly set up. Particularly important for setting the wrap mode. +
+ +

.[page:Vector2 repeat]

+
+ How many times the texture is repeated across the surface, in each direction U and V. +
+ +

.[page:Vector2 offset]

+
+ How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0. +
+ +

.[page:string name]

+
+ Given name of the texture, empty string by default. +
+ +

.[page:boolean generateMipmaps]

+
+ Whether to generate mipmaps (if possible) for a texture. True by default. +
+ +

.[page:boolean flipY]

+
+ False by default, set this to true if the texture needs to be flipped vertically. +
+ +

.[page:array mipmaps]

+
+ Array of mipmaps generated. +
+ +

.[page:number unpackAlignment]

+
+ 4 by default. Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries). See glPixelStorei for more information. +
+ +

.[page:boolean premultiplyAlpha]

+
+ False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha. +
+ +

.[page:object onUpdate]

+
+ A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used). +
+ +

.[page:number id]

+
+ An internal ID number, starting from 0; should not be modified. THREE.TextureIdCount is the number of textures created so far. +
+ +

Methods

+ +

[page:EventDispatcher EventDispatcher] methods are available on this class.

+ +

.clone([page:todo texture]) [page:todo]

+
+ Make copy of texture. Note this is not a "deep copy", the image is shared. +
+
+ todo +
+ +

.dispose() [page:todo]

+
+ Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type. +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/59/files/inconsolata.woff b/docs/59/files/inconsolata.woff new file mode 100644 index 0000000000000000000000000000000000000000..6170a0bfc93b586d544d2e070d0b496e68efdb13 GIT binary patch literal 28040 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 + + + + three.js - documentation + + + +
+ + + + + + diff --git a/docs/59/list.js b/docs/59/list.js new file mode 100644 index 0000000000..8af697897f --- /dev/null +++ b/docs/59/list.js @@ -0,0 +1,227 @@ +var list = { + + "Manual": { + "Introduction": [ + [ "Creating a scene", "manual/introduction/Creating-a-scene" ] + ] + }, + + "Reference": { + "Cameras": [ + [ "Camera", "api/cameras/Camera" ], + [ "OrthographicCamera", "api/cameras/OrthographicCamera" ], + [ "PerspectiveCamera", "api/cameras/PerspectiveCamera" ] + ], + + "Core": [ + [ "BufferGeometry", "api/core/BufferGeometry" ], + [ "Clock", "api/core/Clock" ], + [ "EventDispatcher", "api/core/EventDispatcher" ], + [ "Face3", "api/core/Face3" ], + [ "Face4", "api/core/Face4" ], + [ "Geometry", "api/core/Geometry" ], + [ "Object3D", "api/core/Object3D" ], + [ "Projector", "api/core/Projector" ], + [ "Raycaster", "api/core/Raycaster" ], + ], + + "Lights": [ + [ "Light", "api/lights/Light" ], + [ "AmbientLight", "api/lights/AmbientLight" ], + [ "AreaLight", "api/lights/AreaLight" ], + [ "DirectionalLight", "api/lights/DirectionalLight" ], + [ "HemisphereLight", "api/lights/HemisphereLight" ], + [ "PointLight", "api/lights/PointLight" ], + [ "SpotLight", "api/lights/SpotLight" ] + ], + + + "Loaders": [ + [ "Loader", "api/loaders/Loader" ], + [ "GeometryLoader", "api/loaders/GeometryLoader" ], + [ "ImageLoader", "api/loaders/ImageLoader" ], + [ "JSONLoader", "api/loaders/JSONLoader" ], + [ "LoadingMonitor", "api/loaders/LoadingMonitor" ], + [ "SceneLoader", "api/loaders/SceneLoader" ], + [ "TextureLoader", "api/loaders/TextureLoader" ], + ], + + "Materials": [ + [ "Material", "api/materials/Material" ], + [ "LineBasicMaterial", "api/materials/LineBasicMaterial" ], + [ "LineDashedMaterial", "api/materials/LineDashedMaterial" ], + [ "MeshBasicMaterial", "api/materials/MeshBasicMaterial" ], + [ "MeshDepthMaterial", "api/materials/MeshDepthMaterial" ], + [ "MeshFaceMaterial", "api/materials/MeshFaceMaterial" ], + [ "MeshLambertMaterial", "api/materials/MeshLambertMaterial" ], + [ "MeshNormalMaterial", "api/materials/MeshNormalMaterial" ], + [ "MeshPhongMaterial", "api/materials/MeshPhongMaterial" ], + [ "ParticleBasicMaterial", "api/materials/ParticleBasicMaterial" ], + [ "ParticleCanvasMaterial", "api/materials/ParticleCanvasMaterial" ], + [ "ParticleDOMMaterial", "api/materials/ParticleDOMMaterial" ], + [ "ShaderMaterial", "api/materials/ShaderMaterial" ], + [ "SpriteMaterial", "api/materials/SpriteMaterial" ] + + ], + + "Math": [ + [ "Box2", "api/math/Box2" ], + [ "Box3", "api/math/Box3" ], + [ "Color", "api/math/Color" ], + [ "Frustum", "api/math/Frustum" ], + [ "Math", "api/math/Math" ], + [ "Matrix3", "api/math/Matrix3" ], + [ "Matrix4", "api/math/Matrix4" ], + [ "Plane", "api/math/Plane" ], + [ "Quaternion", "api/math/Quaternion" ], + [ "Ray", "api/math/Ray" ], + [ "Sphere", "api/math/Sphere" ], + [ "Spline", "api/math/Spline" ], + [ "Triangle", "api/math/Triangle" ], + [ "Vector2", "api/math/Vector2" ], + [ "Vector3", "api/math/Vector3" ], + [ "Vector4", "api/math/Vector4" ] + ], + + "Objects": [ + [ "Bone", "api/objects/Bone" ], + [ "Line", "api/objects/Line" ], + [ "LOD", "api/objects/LOD" ], + [ "Mesh", "api/objects/Mesh" ], + [ "MorphAnimMesh", "api/objects/MorphAnimMesh" ], + [ "Particle", "api/objects/Particle" ], + [ "ParticleSystem", "api/objects/ParticleSystem" ], + [ "Ribbon", "api/objects/Ribbon" ], + [ "SkinnedMesh", "api/objects/SkinnedMesh" ], + [ "Sprite", "api/objects/Sprite" ] + + ], + + "Renderers": [ + [ "CanvasRenderer", "api/renderers/CanvasRenderer" ], + [ "WebGLRenderer", "api/renderers/WebGLRenderer" ], + [ "WebGLRenderTarget", "api/renderers/WebGLRenderTarget" ], + [ "WebGLRenderTargetCube", "api/renderers/WebGLRenderTargetCube" ], + [ "WebGLShaders", "api/renderers/WebGLShaders" ] + ], + + "Renderers / Renderables": [ + [ "RenderableFace3", "api/renderers/renderables/RenderableFace3" ], + [ "RenderableFace4", "api/renderers/renderables/RenderableFace4" ], + [ "RenderableLine", "api/renderers/renderables/RenderableLine" ], + [ "RenderableObject", "api/renderers/renderables/RenderableObject" ], + [ "RenderableParticle", "api/renderers/renderables/RenderableParticle" ], + [ "RenderableVertex", "api/renderers/renderables/RenderableVertex" ] + ], + + "Scenes": [ + [ "Fog", "api/scenes/Fog" ], + [ "FogExp2", "api/scenes/FogExp2" ], + [ "Scene", "api/scenes/Scene" ] + ], + + "Textures": [ + [ "CompressedTexture", "api/textures/CompressedTexture" ], + [ "DataTexture", "api/textures/DataTexture" ], + [ "Texture", "api/textures/Texture" ] + ], + + "Extras": [ + [ "FontUtils", "api/extras/FontUtils" ], + [ "GeometryUtils", "api/extras/GeometryUtils" ], + [ "ImageUtils", "api/extras/ImageUtils" ], + [ "SceneUtils", "api/extras/SceneUtils" ] + ], + + "Extras / Animation": [ + [ "Animation", "api/extras/animation/Animation" ], + [ "AnimationHandler", "api/extras/animation/AnimationHandler" ], + [ "AnimationMorphTarget", "api/extras/animation/AnimationMorphTarget" ], + [ "KeyFrameAnimation", "api/extras/animation/KeyFrameAnimation" ] + ], + + "Extras / Cameras": [ + [ "CombinedCamera", "api/extras/cameras/CombinedCamera" ], + [ "CubeCamera", "api/extras/cameras/CubeCamera" ] + ], + + "Extras / Core": [ + [ "Curve", "api/extras/core/Curve" ], + [ "CurvePath", "api/extras/core/CurvePath" ], + [ "Gyroscope", "api/extras/core/Gyroscope" ], + [ "Path", "api/extras/core/Path" ], + [ "Shape", "api/extras/core/Shape" ] + ], + + "Extras / Geometries": [ + [ "CircleGeometry", "api/extras/geometries/CircleGeometry" ], + [ "ConvexGeometry", "api/extras/geometries/ConvexGeometry" ], + [ "CubeGeometry", "api/extras/geometries/CubeGeometry" ], + [ "CylinderGeometry", "api/extras/geometries/CylinderGeometry" ], + [ "ExtrudeGeometry", "api/extras/geometries/ExtrudeGeometry" ], + [ "IcosahedronGeometry", "api/extras/geometries/IcosahedronGeometry" ], + [ "LatheGeometry", "api/extras/geometries/LatheGeometry" ], + [ "OctahedronGeometry", "api/extras/geometries/OctahedronGeometry" ], + [ "ParametricGeometry", "api/extras/geometries/ParametricGeometry" ], + [ "PlaneGeometry", "api/extras/geometries/PlaneGeometry" ], + [ "PolyhedronGeometry", "api/extras/geometries/PolyhedronGeometry" ], + [ "ShapeGeometry", "api/extras/geometries/ShapeGeometry" ], + [ "SphereGeometry", "api/extras/geometries/SphereGeometry" ], + [ "TetrahedronGeometry", "api/extras/geometries/TetrahedronGeometry" ], + [ "TextGeometry", "api/extras/geometries/TextGeometry" ], + [ "TorusGeometry", "api/extras/geometries/TorusGeometry" ], + [ "TorusKnotGeometry", "api/extras/geometries/TorusKnotGeometry" ], + [ "TubeGeometry", "api/extras/geometries/TubeGeometry" ] + ], + + "Extras / Helpers": [ + [ "ArrowHelper", "api/extras/helpers/ArrowHelper" ], + [ "AxisHelper", "api/extras/helpers/AxisHelper" ], + [ "CameraHelper", "api/extras/helpers/CameraHelper" ], + [ "DirectionalLightHelper", "api/extras/helpers/DirectionalLightHelper" ], + [ "HemisphereLightHelper", "api/extras/helpers/HemisphereLightHelper" ], + [ "PointLightHelper", "api/extras/helpers/PointLightHelper" ], + [ "SpotLightHelper", "api/extras/helpers/SpotLightHelper" ] + ], + + "Extras / Objects": [ + [ "ImmediateRenderObject", "api/extras/objects/ImmediateRenderObject" ], + [ "LensFlare", "api/extras/objects/LensFlare" ], + [ "MorphBlendMesh", "api/extras/objects/MorphBlendMesh" ] + ], + + "Extras / Renderers / Plugins": [ + [ "DepthPassPlugin", "api/extras/renderers/plugins/DepthPassPlugin" ], + [ "LensFlarePlugin", "api/extras/renderers/plugins/LensFlarePlugin" ], + [ "ShadowMapPlugin", "api/extras/renderers/plugins/ShadowMapPlugin" ], + [ "SpritePlugin", "api/extras/renderers/plugins/SpritePlugin" ] + ], + + "Extras / Shaders": [ + [ "ShaderFlares", "api/extras/shaders/ShaderFlares" ], + [ "ShaderSprite", "api/extras/shaders/ShaderSprite" ] + ] + } + +}; + +var pages = {}; + +for ( var section in list ) { + + pages[ section ] = {}; + + for ( var category in list[ section ] ) { + + pages[ section ][ category ] = {}; + + for ( var i = 0; i < list[ section ][ category ].length; i ++ ) { + + var page = list[ section ][ category ][ i ]; + pages[ section ][ category ][ page[ 0 ] ] = page[ 1 ]; + + } + + } + +} diff --git a/docs/59/manual/introduction/Creating-a-scene.html b/docs/59/manual/introduction/Creating-a-scene.html new file mode 100644 index 0000000000..a0170719b0 --- /dev/null +++ b/docs/59/manual/introduction/Creating-a-scene.html @@ -0,0 +1,155 @@ + + + + + + + + + +

[name]

+ +
The goal of this section is to give a brief introduction to Three.js. We will start by setting up a scene, with a spinning cube. A working example is provided at the bottom of the page, if you get stuck, and need help.
+ +

What is Three.js?

+ +
If you're reading this, you probably have some understanding of what Three.js is, and what it helps you with, but let's try to describe it briefly anyway.
+ +
Three.js is a library that makes WebGL - 3D in the browser - very easy. While a simple cube in raw WebGL would turn out hundreds of lines of Javascript and shader code, a Three.js equivalent is only a fraction of that.
+ +

Before we start

+
Before you can use Three.js, you need somewhere to display it. Save the following HTML to a file on your computer, and open it in your browser.
+ + + <html> + <head> + <title>My first Three.js app</title> + <style>canvas { width: 100%; height: 100% }</style> + </head> + <body> + <script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script> + <script> + // Our Javascript will go here. + </script> + </body> + </html> + + +
That's all. All the code below goes into the empty <script> tag.
+ +

Creating the scene

+ +
To actually be able to display anything with Three.js, we need three things: A scene, a camera, and a renderer so we can render the scene with the camera.
+ + + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); + + var renderer = new THREE.WebGLRenderer(); + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + + +
Let's take a moment to explain what's going on here. We have now set up the scene, our camera and the renderer. There are a few different cameras in Three.js, but we'll go more into that later. For now, let's use a PerspectiveCamera. The first attribute is the field of view.
+ +
The second one is the aspect ratio. You almost always want to use the width of the element divided by the height, or you'll get the same result as when you play old movies on a widescreen TV - the image looks squished.
+ +
The next two attributes are the near and far clipping plane. What that means, is that objects further away from the camera than the value of far or closer than near won't be rendered. You don't have to worry about this now, but you may want to use other values in your games to get better performance.
+ +
Next up is the renderer. This is where the magic happens. In addition to the WebGLRenderer we use here, Three.js comes with a few others, often used as fallbacks for users with older browsers or for those who don't have WebGL support for some reason.
+ +
In addition to creating the renderer instance, we also need to set the size at which we want it to render our app. It's a good idea to use the width and height of the area we want to fill with our game - in this case, the width and height of the browser window. For performance intensive games, you can also give setSize smaller values, like window.innerWidth/2 and window.innerHeight/2, for half the resolution. This does not mean that the game will only fill half the window, but rather look a bit blurry and scaled up.
+ +
Last but not least, we add the renderer element to our HTML document. This is a <canvas> element the renderer uses to display the scene to us.
+ +
"That's all good, but where's that cube you promised?" Let's add it now.
+ + + var geometry = new THREE.CubeGeometry(1,1,1); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + + camera.position.z = 5; + + +
To create a cube, we need a CubeGeometry. This is an object that contains all the points (vertices) and fill (faces) of the cube. We'll explore this more in the future.
+ +
In addition to the geometry, we need a material to color it. Three.js comes with several materials, but we'll stick to the MeshBasicMaterial for now. All materials take an object of properties which will be applied to them. To keep things very simple, we only supply a color attribute of 0x00ff00, which is green. This works the same way that colors work in CSS or Photoshop (hex colors).
+ +
The third thing we need is a Mesh. A mesh is an object that takes a geometry, and applies a material to it, which we then can insert to our scene, and move freely around.
+ +
By default, when we call scene.add(), the thing we add will be added to the coordinates (0,0,0). This would cause both the camera and the cube to be inside each other. To avoid this, we simply move the camera out a bit.
+ +

Rendering the scene

+ +
If you copied the code from above into the HTML file we created earlier, you wouldn't be able to see anything. This is because we're not actually rendering anything yet. For that, we need what's called a render loop.
+ + + function render() { + requestAnimationFrame(render); + renderer.render(scene, camera); + } + render(); + + +
This will create a loop that causes the renderer to draw the scene 60 times per second. If you're new to writing games in the browser, you might say "why don't we just create a setInterval? The thing is - we could, but requestAnimationFrame has a number of advantages. Perhaps the most important one is that it pauses when the user navigates to another browser tab, hence not wasting their precious processing power and battery life.
+ +

Animating the cube

+ +
If you insert all the code above into the file you created before we began, you should see a green box. Let's make it all a little more interesting by rotating it.
+ +
Add the following right above the renderer.render call in your render function:
+ + + cube.rotation.x += 0.1; + cube.rotation.y += 0.1; + + +
This will be run every frame (60 times per second), and give the cube a nice rotation animation. Basically, anything you want to move or change while the game / app is running has to go through the render loop. You can of course call other functions from there, so that you don't end up with a render function that's hundreds of lines. +
+ +

The result

+
Congratulations! You have now completed your first Three.js application. It's simple, you have to start somewhere.
+ +
The full code is available below. Play around with it to get a better understanding of how it works.
+ + + <html> + <head> + <title>My first Three.js app</title> + <style>canvas { width: 100%; height: 100% }</style> + </head> + <body> + <script src="three.min.js"></script> + <script> + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000); + + var renderer = new THREE.WebGLRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + var geometry = new THREE.CubeGeometry(1,1,1); + var material = new THREE.MeshBasicMaterial({color: 0x00ff00}); + var cube = new THREE.Mesh(geometry, material); + scene.add(cube); + + camera.position.z = 5; + + var render = function () { + requestAnimationFrame(render); + + cube.rotation.x += 0.1; + cube.rotation.y += 0.1; + + renderer.render(scene, camera); + }; + + render(); + </script> + </body> + </html> + + + diff --git a/docs/59/page.css b/docs/59/page.css new file mode 100644 index 0000000000..b607360133 --- /dev/null +++ b/docs/59/page.css @@ -0,0 +1,87 @@ +@font-face { + font-family: 'inconsolata'; + src: url('files/inconsolata.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +body { + margin: 25px 20px; + color: #555; + font-family: 'inconsolata'; + font-size: 15px; + line-height: 18px; + overflow: auto; +} + +a { + color: #1184CE; +} + +h1 { + color: #333; + font-size: 25px; + font-weight: normal; + + margin-top: 10px; +} + +h2 { + color: #4B0; + font-size: 18px; + font-weight: normal; + + margin-top: 40px; +} + +h3 { + color: #000; + font-size: 16px; + font-weight: normal; + + margin-top: 30px; +} + +div { + /* padding-left: 30px; */ + margin-bottom: 20px; +} + +div.desc { + padding-left: 0px; +} + +pre, code { + margin-top: 20px; + margin-bottom: 20px; +} +code { + display: block; + width: -webkit-calc( 100% - 40px ); + width: -moz-calc( 100% - 40px ); + width: calc( 100% - 40px ); + padding: 20px; + white-space: pre-wrap; + background-color: #f9f9f9; + overflow: auto; +} + +strong { + color: #000; + font-weight: normal; +} + +#button { + position: fixed; + top: 20px; + right: 20px; + padding: 8px; + color: #fff; + background-color: #555; + opacity: 0.5; +} + + #button:hover { + cursor: pointer; + opacity: 1; + } diff --git a/docs/59/page.js b/docs/59/page.js new file mode 100644 index 0000000000..f535812797 --- /dev/null +++ b/docs/59/page.js @@ -0,0 +1,97 @@ +var onDocumentLoad = function ( event ) { + + var path; + var pathname = window.location.pathname; + var section = /\/(manual|api)\//.exec( pathname )[ 1 ].toString().split( '.html' )[ 0 ]; + var name = /[\-A-z0-9]+\.html/.exec( pathname ).toString().split( '.html' )[ 0 ]; + + if ( section == 'manual' ) { + + name = name.replace(/\-/g, ' '); + + path = pathname.replace( /\ /g, '-' ); + path = /\/manual\/[-A-z0-9\/]+/.exec( path ).toString().substr( 8 ); + + } else { + + path = /\/api\/[A-z0-9\/]+/.exec( pathname ).toString().substr( 5 ); + + } + + var text = document.body.innerHTML; + + text = text.replace(/\[name\]/gi, name); + text = text.replace(/\[path\]/gi, path); + text = text.replace(/\[page:(\w+)\]/gi, "[page:$1 $1]" ); // [page:name] to [page:name title] + text = text.replace(/\[page:(\w+) ([\w|\.]+)\]/gi, "$2" ); // [page:name title] + text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_]+)\]/gi, "[link:$1 $1]" ); // [link:url] to [link:url title] + text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_|\(|\)]+) ([\w|\:|\/|\.|\-|\_ ]+)\]/gi, "$2" ); // [link:url title] + text = text.replace(/\*([\w|\d|\"|\-|\(][\w|\d|\ |\-|\/|\+|\-|\(|\)|\=|\,|\.\"]*[\w|\d|\"|\)]|\w)\*/gi, "$1" ); // * + + document.body.innerHTML = text; + + // handle code snippets formatting + + var elements = document.getElementsByTagName( 'code' ); + + for ( var i = 0; i < elements.length; i ++ ) { + + var element = elements[ i ]; + + text = element.textContent.trim(); + text = text.replace( /^\t\t/gm, '' ); + + element.textContent = text; + + } + + // Edit button + + var button = document.createElement( 'div' ); + button.id = 'button'; + button.textContent = 'Edit this page'; + + button.addEventListener( 'click', function ( event ) { + + window.open( 'https://github.com/mrdoob/three.js/blob/dev/docs/' + section + '/' + path + '.html' ); + + }, false ); + + document.body.appendChild( button ); + + // Syntax highlighting + + var styleBase = document.createElement( 'link' ); + styleBase.href = '../../prettify/prettify.css'; + styleBase.rel = 'stylesheet'; + + var styleCustom = document.createElement( 'link' ); + styleCustom.href = '../../prettify/threejs.css'; + styleCustom.rel = 'stylesheet'; + + document.head.appendChild( styleBase ); + document.head.appendChild( styleCustom ); + + var prettify = document.createElement( 'script' ); + prettify.src = '../../prettify/prettify.js'; + + prettify.onload = function () { + + var elements = document.getElementsByTagName( 'code' ); + + for ( var i = 0; i < elements.length; i ++ ) { + + var e = elements[ i ]; + e.className += ' prettyprint'; + + } + + prettyPrint(); + + } + + document.head.appendChild( prettify ); + +}; + +document.addEventListener( 'DOMContentLoaded', onDocumentLoad, false ); diff --git a/docs/59/prettify/prettify.css b/docs/59/prettify/prettify.css new file mode 100644 index 0000000000..d44b3a2282 --- /dev/null +++ b/docs/59/prettify/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file diff --git a/docs/59/prettify/prettify.js b/docs/59/prettify/prettify.js new file mode 100644 index 0000000000..eef5ad7e6a --- /dev/null +++ b/docs/59/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p - + diff --git a/editor/index.html b/editor/index.html index 0616796448..a6a01c0429 100644 --- a/editor/index.html +++ b/editor/index.html @@ -2,6 +2,8 @@ three.js editor + + - + + + @@ -89,449 +109,73 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/editor/js/Editor.js b/editor/js/Editor.js new file mode 100644 index 0000000000..b04928dd06 --- /dev/null +++ b/editor/js/Editor.js @@ -0,0 +1,270 @@ +var Editor = function () { + + var SIGNALS = signals; + + this.signals = { + + // actions + + playAnimations: new SIGNALS.Signal(), + + // notifications + + transformModeChanged: new SIGNALS.Signal(), + snapChanged: new SIGNALS.Signal(), + rendererChanged: new SIGNALS.Signal(), + + sceneGraphChanged: new SIGNALS.Signal(), + + objectSelected: new SIGNALS.Signal(), + objectAdded: new SIGNALS.Signal(), + objectChanged: new SIGNALS.Signal(), + objectRemoved: new SIGNALS.Signal(), + + helperAdded: new SIGNALS.Signal(), + helperRemoved: new SIGNALS.Signal(), + + materialChanged: new SIGNALS.Signal(), + clearColorChanged: new SIGNALS.Signal(), + fogTypeChanged: new SIGNALS.Signal(), + fogColorChanged: new SIGNALS.Signal(), + fogParametersChanged: new SIGNALS.Signal(), + windowResize: new SIGNALS.Signal() + + }; + + this.scene = new THREE.Scene(); + this.sceneHelpers = new THREE.Scene(); + + this.object = {}; + this.geometries = {}; + this.materials = {}; + this.textures = {}; + + this.selected = null; + this.helpers = {}; + +}; + +Editor.prototype = { + + setScene: function ( scene ) { + + this.scene.name = scene.name; + this.scene.userData = JSON.parse( JSON.stringify( scene.userData ) ); + + while ( scene.children.length > 0 ) { + + this.addObject( scene.children[ 0 ] ); + + } + + }, + + // + + addObject: function ( object ) { + + var scope = this; + + object.traverse( function ( child ) { + + scope.addHelper( child ); + + } ); + + this.scene.add( object ); + + this.signals.objectAdded.dispatch( object ); + this.signals.sceneGraphChanged.dispatch(); + + }, + + removeObject: function ( object ) { + + if ( object.parent === undefined ) return; // avoid deleting the camera or scene + + if ( confirm( 'Delete ' + object.name + '?' ) === false ) return; + + var scope = this; + + object.traverse( function ( child ) { + + scope.removeHelper( child ); + + } ); + + object.parent.remove( object ); + + this.signals.objectRemoved.dispatch( object ); + this.signals.sceneGraphChanged.dispatch(); + + }, + + addGeometry: function ( geometry ) { + + }, + + removeGeometry: function ( geometry ) { + + }, + + addMaterial: function ( material ) { + + }, + + removeMaterial: function ( material ) { + + }, + + addTexture: function ( texture ) { + + }, + + removeTexture: function ( texture ) { + + }, + + // + + addHelper: function () { + + var geometry = new THREE.SphereGeometry( 20, 4, 2 ); + var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); + + return function ( object ) { + + if ( object instanceof THREE.Camera ) { + + var picker = new THREE.Mesh( geometry, material ); + picker.name = 'picker'; + picker.userData.object = object; + picker.visible = false; + + var helper = new THREE.CameraHelper( object, 10 ); + helper.add( picker ); + + this.sceneHelpers.add( helper ); + this.helpers[ object.id ] = helper; + + this.signals.helperAdded.dispatch( helper ); + + } else if ( object instanceof THREE.PointLight ) { + + var picker = new THREE.Mesh( geometry, material ); + picker.name = 'picker'; + picker.userData.object = object; + picker.visible = false; + + var helper = new THREE.PointLightHelper( object, 10 ); + helper.add( picker ); + + this.sceneHelpers.add( helper ); + this.helpers[ object.id ] = helper; + + this.signals.helperAdded.dispatch( helper ); + + } else if ( object instanceof THREE.DirectionalLight ) { + + var picker = new THREE.Mesh( geometry, material ); + picker.name = 'picker'; + picker.userData.object = object; + picker.visible = false; + + var helper = new THREE.DirectionalLightHelper( object, 20 ); + helper.add( picker ); + + this.sceneHelpers.add( helper ); + this.helpers[ object.id ] = helper; + + this.signals.helperAdded.dispatch( helper ); + + } else if ( object instanceof THREE.SpotLight ) { + + var picker = new THREE.Mesh( geometry, material ); + picker.name = 'picker'; + picker.userData.object = object; + picker.visible = false; + + var helper = new THREE.SpotLightHelper( object, 10 ); + helper.add( picker ); + + this.sceneHelpers.add( helper ); + this.helpers[ object.id ] = helper; + + this.signals.helperAdded.dispatch( helper ); + + } else if ( object instanceof THREE.HemisphereLight ) { + + var picker = new THREE.Mesh( geometry, material ); + picker.name = 'picker'; + picker.userData.object = object; + picker.visible = false; + + var helper = new THREE.HemisphereLightHelper( object, 10 ); + helper.add( picker ); + + this.sceneHelpers.add( helper ); + this.helpers[ object.id ] = helper; + + this.signals.helperAdded.dispatch( helper ); + + } + + }; + + }(), + + removeHelper: function ( object ) { + + if ( this.helpers[ object.id ] !== undefined ) { + + var helper = this.helpers[ object.id ]; + helper.parent.remove( helper ); + + delete this.helpers[ object.id ]; + + this.signals.helperRemoved.dispatch( helper ); + + } + + }, + + // + + parent: function ( object, parent ) { + + if ( parent === undefined ) { + + parent = this.scene; + + } + + parent.add( object ); + + this.signals.sceneGraphChanged.dispatch(); + + }, + + // + + select: function ( object ) { + + this.selected = object; + this.signals.objectSelected.dispatch( object ); + + }, + + selectById: function ( id ) { + + this.select( this.scene.getObjectById( id, true ) ); + + }, + + deselect: function () { + + this.select( null ); + + } + +} diff --git a/editor/js/Loader.js b/editor/js/Loader.js new file mode 100644 index 0000000000..9606665f8a --- /dev/null +++ b/editor/js/Loader.js @@ -0,0 +1,381 @@ +var Loader = function ( editor ) { + + var scope = this; + var signals = editor.signals; + + document.addEventListener( 'dragover', function ( event ) { + + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + + }, false ); + + document.addEventListener( 'drop', function ( event ) { + + event.preventDefault(); + + var file = event.dataTransfer.files[ 0 ]; + + var chunks = file.name.split( '.' ); + var extension = chunks.pop().toLowerCase(); + var filename = chunks.join( '.' ); + + scope.parseFile( file, filename, extension ); + + }, false ); + + this.loadLocalStorage = function () { + + if ( localStorage.threejsEditor !== undefined ) { + + var loader = new THREE.ObjectLoader(); + var scene = loader.parse( JSON.parse( localStorage.threejsEditor ) ); + + editor.setScene( scene ); + + } + + }; + + var exporter = new THREE.ObjectExporter(); + var timeout; + + this.saveLocalStorage = function ( scene ) { + + clearTimeout( timeout ); + + timeout = setTimeout( function () { + + localStorage.threejsEditor = JSON.stringify( exporter.parse( editor.scene ) ); + console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved state to LocalStorage.' ); + + }, 3000 ); + + }; + + signals.objectAdded.add( this.saveLocalStorage ); + signals.objectChanged.add( this.saveLocalStorage ); + signals.objectRemoved.add( this.saveLocalStorage ); + + this.parseFile = function ( file, filename, extension ) { + + switch ( extension ) { + + case 'ctm': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var stream = new CTM.Stream( contents ); + stream.offset = 0; + + var loader = new THREE.CTMLoader(); + loader.createModelClassic( new CTM.File( stream ), function( geometry ) { + + geometry.sourceType = "ctm"; + geometry.sourceFile = file.name; + + var material = new THREE.MeshPhongMaterial(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = filename; + + editor.addObject( mesh ); + + } ); + + }, false ); + reader.readAsBinaryString( file ); + + break; + + case 'dae': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var parser = new DOMParser(); + var xml = parser.parseFromString( contents, 'text/xml' ); + + var loader = new THREE.ColladaLoader(); + loader.parse( xml, function ( collada ) { + + collada.scene.name = filename; + + editor.addObject( collada.scene ); + + } ); + + }, false ); + reader.readAsText( file ); + + break; + + case 'js': + case 'json': + + case '3geo': + case '3mat': + case '3obj': + case '3scn': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + // 2.0 + + if ( contents.indexOf( 'postMessage' ) !== -1 ) { + + var blob = new Blob( [ contents ], { type: 'text/javascript' } ); + var url = URL.createObjectURL( blob ); + + var worker = new Worker( url ); + + worker.onmessage = function ( event ) { + + event.data.metadata = { version: 2 }; + handleJSON( event.data, file, filename ); + + }; + + worker.postMessage( Date.now() ); + + return; + + } + + // >= 3.0 + + var data; + + try { + + data = JSON.parse( contents ); + + } catch ( error ) { + + alert( error ); + return; + + } + + handleJSON( data, file, filename ); + + }, false ); + reader.readAsText( file ); + + break; + + case 'obj': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var object = new THREE.OBJLoader().parse( contents ); + object.name = filename; + + editor.addObject( object ); + + }, false ); + reader.readAsText( file ); + + break; + + case 'ply': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + console.log( contents ); + + var geometry = new THREE.PLYLoader().parse( contents ); + geometry.sourceType = "ply"; + geometry.sourceFile = file.name; + + var material = new THREE.MeshPhongMaterial(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = filename; + + editor.addObject( mesh ); + + }, false ); + reader.readAsText( file ); + + break; + + case 'stl': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var geometry = new THREE.STLLoader().parse( contents ); + geometry.sourceType = "stl"; + geometry.sourceFile = file.name; + + var material = new THREE.MeshPhongMaterial(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = filename; + + editor.addObject( mesh ); + + }, false ); + + if ( reader.readAsBinaryString !== undefined ) { + + reader.readAsBinaryString( file ); + + } else { + + reader.readAsArrayBuffer( file ); + + } + + break; + + /* + case 'utf8': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var geometry = new THREE.UTF8Loader().parse( contents ); + var material = new THREE.MeshLambertMaterial(); + + var mesh = new THREE.Mesh( geometry, material ); + + editor.addObject( mesh ); + + }, false ); + reader.readAsBinaryString( file ); + + break; + */ + + case 'vtk': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var geometry = new THREE.VTKLoader().parse( contents ); + geometry.sourceType = "vtk"; + geometry.sourceFile = file.name; + + var material = new THREE.MeshPhongMaterial(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = filename; + + editor.addObject( mesh ); + + }, false ); + reader.readAsText( file ); + + break; + + case 'wrl': + + var reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + var contents = event.target.result; + + var result = new THREE.VRMLLoader().parse( contents ); + + editor.setScene( result ); + + }, false ); + reader.readAsText( file ); + + break; + + } + + } + + var handleJSON = function ( data, file, filename ) { + + if ( data.metadata === undefined ) { // 2.0 + + data.metadata = { type: 'geometry' }; + + } + + if ( data.metadata.type === undefined ) { // 3.0 + + data.metadata.type = 'geometry'; + + } + + if ( data.metadata.version === undefined ) { + + data.metadata.version = data.metadata.formatVersion; + + } + + if ( data.metadata.type === 'geometry' ) { + + var loader = new THREE.JSONLoader(); + var result = loader.parse( data ); + + var geometry = result.geometry; + var material = result.materials !== undefined + ? new THREE.MeshFaceMaterial( result.materials ) + : new THREE.MeshPhongMaterial(); + + geometry.sourceType = "ascii"; + geometry.sourceFile = file.name; + + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = filename; + + editor.addObject( mesh ); + + } else if ( data.metadata.type === 'object' ) { + + var loader = new THREE.ObjectLoader(); + var result = loader.parse( data ); + + if ( result instanceof THREE.Scene ) { + + editor.setScene( result ); + + } else { + + editor.addObject( result ); + + } + + } else if ( data.metadata.type === 'scene' ) { + + // DEPRECATED + + var loader = new THREE.SceneLoader(); + loader.parse( data, function ( result ) { + + editor.setScene( result.scene ); + + }, '' ); + + } + + }; + +} diff --git a/editor/js/ui/Menubar.Add.js b/editor/js/Menubar.Add.js similarity index 72% rename from editor/js/ui/Menubar.Add.js rename to editor/js/Menubar.Add.js index 330438c541..ff0c9e64f7 100644 --- a/editor/js/ui/Menubar.Add.js +++ b/editor/js/Menubar.Add.js @@ -1,4 +1,4 @@ -Menubar.Add = function ( signals ) { +Menubar.Add = function ( editor ) { var container = new UI.Panel(); container.setClass( 'menu' ); @@ -19,6 +19,9 @@ Menubar.Add = function ( signals ) { options.setDisplay( 'none' ); container.add( options ); + var meshCount = 0; + var lightCount = 0; + // add plane var option = new UI.Panel(); @@ -33,12 +36,14 @@ Menubar.Add = function ( signals ) { var heightSegments = 1; var geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Plane ' + mesh.id; + var material = new THREE.MeshPhongMaterial(); + var mesh = new THREE.Mesh( geometry, material ); + mesh.name = 'Plane ' + ( ++ meshCount ); mesh.rotation.x = - Math.PI/2; - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -59,11 +64,11 @@ Menubar.Add = function ( signals ) { var depthSegments = 1; var geometry = new THREE.CubeGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Cube ' + mesh.id; - - signals.objectAdded.dispatch( mesh ); + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'Cube ' + ( ++ meshCount ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -83,10 +88,11 @@ Menubar.Add = function ( signals ) { var openEnded = false; var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Cylinder ' + mesh.id; + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'Cylinder ' + ( ++ meshCount ); - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -103,10 +109,11 @@ Menubar.Add = function ( signals ) { var heightSegments = 16; var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Sphere ' + mesh.id; + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'Sphere ' + ( ++ meshCount ); - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -122,10 +129,11 @@ Menubar.Add = function ( signals ) { var detail = 2; var geometry = new THREE.IcosahedronGeometry ( radius, detail ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Icosahedron ' + mesh.id; + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'Icosahedron ' + ( ++ meshCount ); - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -144,10 +152,11 @@ Menubar.Add = function ( signals ) { var arc = Math.PI * 2; var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'Torus ' + mesh.id; + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'Torus ' + ( ++ meshCount ); - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -168,10 +177,11 @@ Menubar.Add = function ( signals ) { var heightScale = 1; var geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale ); - var mesh = new THREE.Mesh( geometry, createDummyMaterial( geometry ) ); - mesh.name = 'TorusKnot ' + mesh.id; + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + mesh.name = 'TorusKnot ' + ( ++ meshCount ); - signals.objectAdded.dispatch( mesh ); + editor.addObject( mesh ); + editor.select( mesh ); } ); options.add( option ); @@ -192,9 +202,10 @@ Menubar.Add = function ( signals ) { var distance = 0; var light = new THREE.PointLight( color, intensity, distance ); - light.name = 'PointLight ' + light.id; + light.name = 'PointLight ' + ( ++ lightCount ); - signals.objectAdded.dispatch( light ); + editor.addObject( light ); + editor.select( light ); } ); options.add( option ); @@ -213,12 +224,13 @@ Menubar.Add = function ( signals ) { var exponent = 10; var light = new THREE.SpotLight( color, intensity, distance, angle, exponent ); - light.name = 'SpotLight ' + light.id; - light.target.name = 'SpotLight ' + light.id + ' Target'; + light.name = 'SpotLight ' + ( ++ lightCount ); + light.target.name = 'SpotLight ' + ( lightCount ) + ' Target'; light.position.set( 0, 1, 0 ).multiplyScalar( 200 ); - signals.objectAdded.dispatch( light ); + editor.addObject( light ); + editor.select( light ); } ); options.add( option ); @@ -234,12 +246,13 @@ Menubar.Add = function ( signals ) { var intensity = 1; var light = new THREE.DirectionalLight( color, intensity ); - light.name = 'DirectionalLight ' + light.id; - light.target.name = 'DirectionalLight ' + light.id + ' Target'; + light.name = 'DirectionalLight ' + ( ++ lightCount ); + light.target.name = 'DirectionalLight ' + ( lightCount ) + ' Target'; light.position.set( 1, 1, 1 ).multiplyScalar( 200 ); - signals.objectAdded.dispatch( light ); + editor.addObject( light ); + editor.select( light ); } ); options.add( option ); @@ -256,11 +269,12 @@ Menubar.Add = function ( signals ) { var intensity = 1; var light = new THREE.HemisphereLight( skyColor, groundColor, intensity ); - light.name = 'HemisphereLight ' + light.id; + light.name = 'HemisphereLight ' + ( ++ lightCount ); light.position.set( 1, 1, 1 ).multiplyScalar( 200 ); - signals.objectAdded.dispatch( light ); + editor.addObject( light ); + editor.select( light ); } ); options.add( option ); @@ -275,21 +289,16 @@ Menubar.Add = function ( signals ) { var color = 0x222222; var light = new THREE.AmbientLight( color ); - light.name = 'AmbientLight ' + light.id; + light.name = 'AmbientLight ' + ( ++ lightCount ); - signals.objectAdded.dispatch( light ); + editor.addObject( light ); + editor.select( light ); } ); options.add( option ); // - function createDummyMaterial() { - - return new THREE.MeshPhongMaterial(); - - }; - return container; } diff --git a/editor/js/Menubar.Edit.js b/editor/js/Menubar.Edit.js new file mode 100644 index 0000000000..7d0128bd4a --- /dev/null +++ b/editor/js/Menubar.Edit.js @@ -0,0 +1,87 @@ +Menubar.Edit = function ( editor ) { + + var container = new UI.Panel(); + container.setClass( 'menu' ); + container.onMouseOver( function () { options.setDisplay( 'block' ) } ); + container.onMouseOut( function () { options.setDisplay( 'none' ) } ); + container.onClick( function () { options.setDisplay( 'block' ) } ); + + var title = new UI.Panel(); + title.setTextContent( 'Edit' ).setColor( '#666' ); + title.setMargin( '0px' ); + title.setPadding( '8px' ); + container.add( title ); + + // + + var options = new UI.Panel(); + options.setClass( 'options' ); + options.setDisplay( 'none' ); + container.add( options ); + + // clone + + var option = new UI.Panel(); + option.setClass( 'option' ); + option.setTextContent( 'Clone' ); + option.onClick( function () { + + var object = editor.selected; + + if ( object.parent === undefined ) return; // avoid cloning the camera or scene + + object = object.clone(); + + editor.addObject( object ); + editor.select( object ); + + } ); + options.add( option ); + + // flatten + + var option = new UI.Panel(); + option.setClass( 'option' ); + option.setTextContent( 'Flatten' ); + option.onClick( function () { + + var object = editor.selected; + + if ( object.parent === undefined ) return; // avoid flattening the camera or scene + + if ( confirm( 'Flatten ' + object.name + '?' ) === false ) return; + + delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring) + + var geometry = object.geometry.clone(); + geometry.applyMatrix( object.matrix ); + + object.geometry = geometry; + + object.position.set( 0, 0, 0 ); + object.rotation.set( 0, 0, 0 ); + object.scale.set( 1, 1, 1 ); + + editor.signals.objectChanged.dispatch( object ); + + } ); + options.add( option ); + + // delete + + var option = new UI.Panel(); + option.setClass( 'option' ); + option.setTextContent( 'Delete' ); + option.onClick( function () { + + editor.removeObject( editor.selected ); + editor.deselect(); + + } ); + options.add( option ); + + // + + return container; + +} diff --git a/editor/js/ui/Menubar.File.js b/editor/js/Menubar.File.js similarity index 85% rename from editor/js/ui/Menubar.File.js rename to editor/js/Menubar.File.js index a2537a4f12..713ccf1411 100644 --- a/editor/js/ui/Menubar.File.js +++ b/editor/js/Menubar.File.js @@ -1,4 +1,4 @@ -Menubar.File = function ( signals ) { +Menubar.File = function ( editor ) { var container = new UI.Panel(); container.setClass( 'menu' ); @@ -14,9 +14,6 @@ Menubar.File = function ( signals ) { // - var selectedObject; - var scene; - var options = new UI.Panel(); options.setClass( 'options' ); options.setDisplay( 'none' ); @@ -120,7 +117,9 @@ Menubar.File = function ( signals ) { var exportGeometry = function ( exporterClass ) { - if ( selectedObject.geometry === undefined ) { + var object = editor.selected; + + if ( object.geometry === undefined ) { alert( "Selected object doesn't have any geometry" ); return; @@ -133,12 +132,12 @@ Menubar.File = function ( signals ) { if ( exporter instanceof THREE.GeometryExporter ) { - output = JSON.stringify( exporter.parse( selectedObject.geometry ), null, '\t' ); + output = JSON.stringify( exporter.parse( object.geometry ), null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); } else { - output = exporter.parse( selectedObject.geometry ); + output = exporter.parse( object.geometry ); } @@ -154,7 +153,9 @@ Menubar.File = function ( signals ) { var exporter = new exporterClass(); - var output = JSON.stringify( exporter.parse( selectedObject ), null, '\t' ); + var object = editor.selected; + + var output = JSON.stringify( exporter.parse( object ), null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); var blob = new Blob( [ output ], { type: 'text/plain' } ); @@ -169,7 +170,7 @@ Menubar.File = function ( signals ) { var exporter = new exporterClass(); - var output = JSON.stringify( exporter.parse( scene ), null, '\t' ); + var output = JSON.stringify( exporter.parse( editor.scene ), null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); var blob = new Blob( [ output ], { type: 'text/plain' } ); @@ -180,20 +181,6 @@ Menubar.File = function ( signals ) { }; - // signals - - signals.objectSelected.add( function ( object ) { - - selectedObject = object; - - } ); - - signals.sceneChanged.add( function ( object ) { - - scene = object; - - } ); - return container; } diff --git a/editor/js/ui/Menubar.Help.js b/editor/js/Menubar.Help.js similarity index 96% rename from editor/js/ui/Menubar.Help.js rename to editor/js/Menubar.Help.js index c141dd06bb..bd1b3a91b1 100644 --- a/editor/js/ui/Menubar.Help.js +++ b/editor/js/Menubar.Help.js @@ -1,4 +1,4 @@ -Menubar.Help = function ( signals ) { +Menubar.Help = function ( editor ) { var container = new UI.Panel(); container.setClass( 'menu' ); diff --git a/editor/js/Menubar.js b/editor/js/Menubar.js new file mode 100644 index 0000000000..72a151daf8 --- /dev/null +++ b/editor/js/Menubar.js @@ -0,0 +1,14 @@ +var Menubar = function ( editor ) { + + var container = new UI.Panel(); + container.setPosition( 'absolute' ); + container.setClass( 'menubar' ); + + container.add( new Menubar.File( editor ) ); + container.add( new Menubar.Edit( editor ) ); + container.add( new Menubar.Add( editor ) ); + container.add( new Menubar.Help( editor ) ); + + return container; + +} diff --git a/editor/js/Sidebar.Animation.js b/editor/js/Sidebar.Animation.js new file mode 100644 index 0000000000..17215b7489 --- /dev/null +++ b/editor/js/Sidebar.Animation.js @@ -0,0 +1,96 @@ +Sidebar.Animation = function ( editor ) { + + var signals = editor.signals; + + var options = {}; + var possibleAnimations = {}; + + var container = new UI.Panel(); + container.setBorderTop( '1px solid #ccc' ); + container.setPadding( '10px' ); + container.setDisplay( 'none' ); + + container.add( new UI.Text( 'Animation' ).setColor( '#666' ) ); + container.add( new UI.Break(), new UI.Break() ); + + var AnimationsRow = new UI.Panel(); + var Animations = new UI.Select().setOptions( options ).setWidth( '130px' ).setColor( '#444' ).setFontSize( '12px' ); + AnimationsRow.add( new UI.Text( 'animations' ).setWidth( '90px' ).setColor( '#666' ) ); + AnimationsRow.add( Animations ); + container.add( AnimationsRow ); + container.add( new UI.Break() ); + + var PlayRow = new UI.Panel(); + var playButton = new UI.Button().setLabel("Play").onClick(play); + PlayRow.add( playButton ); + container.add( PlayRow ); + container.add( new UI.Break() ); + + function play() { + + var value = Animations.getValue(); + + if ( possibleAnimations[ value ] ) { + + var anims = possibleAnimations[value] + + for ( var i = 0; i < anims.length; i ++ ) { + + anims[ i ].play(); + + } + + signals.playAnimations.dispatch( anims ); + + }; + + } + + signals.objectAdded.add( function ( object ) { + + if ( object instanceof THREE.Mesh ) { + + if ( object.geometry && object.geometry.animation ) { + + var name = object.geometry.animation.name; + options[name] = name + + Animations.setOptions( options ); + + THREE.AnimationHandler.add( object.geometry.animation ); + + var animation = new THREE.Animation( object, name, THREE.AnimationHandler.CATMULLROM ); + + if ( possibleAnimations[ name ] ){ + + possibleAnimations[ name ].push( animation ); + + } else { + + possibleAnimations[ name ] = [ animation ]; + + } + + } + + } + + } ); + + signals.objectSelected.add( function ( object ) { + + if ( object && object.geometry && object.geometry.animation ) { + + container.setDisplay( 'block' ); + + } else { + + container.setDisplay( 'none' ); + + } + + } ); + + return container; + +} diff --git a/editor/js/ui/Sidebar.Geometry.CubeGeometry.js b/editor/js/Sidebar.Geometry.CubeGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.CubeGeometry.js rename to editor/js/Sidebar.Geometry.CubeGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.CylinderGeometry.js b/editor/js/Sidebar.Geometry.CylinderGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.CylinderGeometry.js rename to editor/js/Sidebar.Geometry.CylinderGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.IcosahedronGeometry.js b/editor/js/Sidebar.Geometry.IcosahedronGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.IcosahedronGeometry.js rename to editor/js/Sidebar.Geometry.IcosahedronGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.PlaneGeometry.js b/editor/js/Sidebar.Geometry.PlaneGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.PlaneGeometry.js rename to editor/js/Sidebar.Geometry.PlaneGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.SphereGeometry.js b/editor/js/Sidebar.Geometry.SphereGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.SphereGeometry.js rename to editor/js/Sidebar.Geometry.SphereGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.TorusGeometry.js b/editor/js/Sidebar.Geometry.TorusGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.TorusGeometry.js rename to editor/js/Sidebar.Geometry.TorusGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.TorusKnotGeometry.js b/editor/js/Sidebar.Geometry.TorusKnotGeometry.js similarity index 100% rename from editor/js/ui/Sidebar.Geometry.TorusKnotGeometry.js rename to editor/js/Sidebar.Geometry.TorusKnotGeometry.js diff --git a/editor/js/ui/Sidebar.Geometry.js b/editor/js/Sidebar.Geometry.js similarity index 93% rename from editor/js/ui/Sidebar.Geometry.js rename to editor/js/Sidebar.Geometry.js index b5e7eac5bc..64d03f285d 100644 --- a/editor/js/ui/Sidebar.Geometry.js +++ b/editor/js/Sidebar.Geometry.js @@ -1,9 +1,10 @@ -Sidebar.Geometry = function ( signals ) { +Sidebar.Geometry = function ( editor ) { + + var signals = editor.signals; var geometryClasses = { "CircleGeometry": THREE.CircleGeometry, - "ConvexGeometry": THREE.ConvexGeometry, "CubeGeometry": THREE.CubeGeometry, "CylinderGeometry": THREE.CylinderGeometry, "ExtrudeGeometry": THREE.ExtrudeGeometry, @@ -26,8 +27,8 @@ Sidebar.Geometry = function ( signals ) { var container = new UI.Panel(); container.setBorderTop( '1px solid #ccc' ); - container.setDisplay( 'none' ); container.setPadding( '10px' ); + container.setDisplay( 'none' ); var objectType = new UI.Text().setColor( '#666' ).setTextTransform( 'uppercase' ); container.add( objectType ); @@ -82,7 +83,7 @@ Sidebar.Geometry = function ( signals ) { } - signals.objectSelected.add( function ( object ) { + function build( object ) { if ( object && object.geometry ) { @@ -148,17 +149,10 @@ Sidebar.Geometry = function ( signals ) { } - } ); - - signals.objectChanged.add( function ( object ) { - - if ( object && object.geometry ) { - - updateFields( object.geometry ); - - } + } - } ); + signals.objectSelected.add( build ); + signals.objectChanged.add( build ); // diff --git a/editor/js/ui/Sidebar.Material.js b/editor/js/Sidebar.Material.js similarity index 82% rename from editor/js/ui/Sidebar.Material.js rename to editor/js/Sidebar.Material.js index 1787d036d8..f61f4e3986 100644 --- a/editor/js/ui/Sidebar.Material.js +++ b/editor/js/Sidebar.Material.js @@ -1,6 +1,8 @@ -Sidebar.Material = function ( signals ) { +Sidebar.Material = function ( editor ) { - var materialClasses = { + var signals = editor.signals; + + var materialClasses = { 'LineBasicMaterial': THREE.LineBasicMaterial, 'LineDashedMaterial': THREE.LineDashedMaterial, @@ -19,8 +21,8 @@ Sidebar.Material = function ( signals ) { var container = new UI.Panel(); container.setBorderTop( '1px solid #ccc' ); - container.setDisplay( 'none' ); container.setPadding( '10px' ); + container.setDisplay( 'none' ); container.add( new UI.Text().setValue( 'MATERIAL' ).setColor( '#666' ) ); container.add( new UI.Break(), new UI.Break() ); @@ -106,6 +108,22 @@ Sidebar.Material = function ( signals ) { container.add( materialShininessRow ); + // vertex colors + + var materialVertexColorsRow = new UI.Panel(); + var materialVertexColors = new UI.Select().setOptions( { + + 0: 'No', + 1: 'Face', + 2: 'Vertex' + + } ).onChange( update ); + + materialVertexColorsRow.add( new UI.Text( 'Vertex Colors' ).setWidth( '90px' ).setColor( '#666' ) ); + materialVertexColorsRow.add( materialVertexColors ); + + container.add( materialVertexColorsRow ); + // map var materialMapRow = new UI.Panel(); @@ -218,22 +236,25 @@ Sidebar.Material = function ( signals ) { // - var selected = null; - var selectedHasUvs = false; - function update() { - var material = selected.material; + var object = editor.selected; + var objectHasUvs = object.geometry.faceVertexUvs[ 0 ].length > 0; + var material = object.material; var textureWarning = false; if ( material ) { - material.name = materialName.getValue(); + if ( material.name !== undefined ) { + + material.name = materialName.getValue(); + + } if ( material instanceof materialClasses[ materialClass.getValue() ] == false ) { material = new materialClasses[ materialClass.getValue() ](); - selected.material = material; + object.material = material; } @@ -267,16 +288,24 @@ Sidebar.Material = function ( signals ) { } + if ( material.vertexColors !== undefined ) { + + material.vertexColors = parseInt( materialVertexColors.getValue() ); + material.needsUpdate = true; + + } + if ( material.map !== undefined ) { var mapEnabled = materialMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.map = mapEnabled ? materialMap.getValue() : null; material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -291,12 +320,12 @@ Sidebar.Material = function ( signals ) { var lightMapEnabled = materialLightMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.lightMap = lightMapEnabled ? materialLightMap.getValue() : null; material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -311,13 +340,13 @@ Sidebar.Material = function ( signals ) { var bumpMapEnabled = materialBumpMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.bumpMap = bumpMapEnabled ? materialBumpMap.getValue() : null; material.bumpScale = materialBumpScale.getValue(); material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -331,12 +360,12 @@ Sidebar.Material = function ( signals ) { var normalMapEnabled = materialNormalMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.normalMap = normalMapEnabled ? materialNormalMap.getValue() : null; material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -350,12 +379,12 @@ Sidebar.Material = function ( signals ) { var specularMapEnabled = materialSpecularMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.specularMap = specularMapEnabled ? materialSpecularMap.getValue() : null; material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -369,13 +398,13 @@ Sidebar.Material = function ( signals ) { var envMapEnabled = materialEnvMapEnabled.getValue() === true; - if ( selectedHasUvs ) { + if ( objectHasUvs ) { material.envMap = envMapEnabled ? materialEnvMap.getValue() : null; material.reflectivity = materialReflectivity.getValue(); material.needsUpdate = true; - selected.geometry.buffersNeedUpdate = true; - selected.geometry.uvsNeedUpdate = true; + object.geometry.buffersNeedUpdate = true; + object.geometry.uvsNeedUpdate = true; } else { @@ -426,11 +455,13 @@ Sidebar.Material = function ( signals ) { function updateRows() { var properties = { + 'name': materialNameRow, 'color': materialColorRow, 'ambient': materialAmbientRow, 'emissive': materialEmissiveRow, 'specular': materialSpecularRow, 'shininess': materialShininessRow, + 'vertexColors': materialVertexColorsRow, 'map': materialMapRow, 'lightMap': materialLightMapRow, 'bumpMap': materialBumpMapRow, @@ -443,9 +474,11 @@ Sidebar.Material = function ( signals ) { }; + var object = editor.selected; + for ( var property in properties ) { - properties[ property ].setDisplay( selected.material[ property ] !== undefined ? '' : 'none' ); + properties[ property ].setDisplay( object.material[ property ] !== undefined ? '' : 'none' ); } @@ -467,14 +500,16 @@ Sidebar.Material = function ( signals ) { if ( object && object.material ) { - selected = object; - selectedHasUvs = object.geometry.faceVertexUvs[ 0 ].length > 0; - container.setDisplay( '' ); var material = object.material; - materialName.setValue( material.name ); + if ( material.name !== undefined ) { + + materialName.setValue( material.name ); + + } + materialClass.setValue( getMaterialInstanceName( material ) ); if ( material.color !== undefined ) { @@ -507,25 +542,28 @@ Sidebar.Material = function ( signals ) { } + if ( material.vertexColors !== undefined ) { + + materialVertexColors.setValue( material.vertexColors ); + + } + if ( material.map !== undefined ) { - if ( selectedHasUvs ) { + materialMapEnabled.setValue( material.map !== null ); - if ( material.map !== null ) { + if ( material.map !== null ) { + + if ( object.geometry.faceVertexUvs[ 0 ].length > 0 ) { - materialMapEnabled.setValue( true ); materialMap.setValue( material.map ); } else { - materialMapEnabled.setValue( false ); + console.warn( "Can't set texture, model doesn't have texture coordinates" ); } - } else { - - console.warn( "Can't set texture, model doesn't have texture coordinates" ); - } } @@ -533,80 +571,39 @@ Sidebar.Material = function ( signals ) { /* if ( material.lightMap !== undefined ) { - if ( material.lightMap !== null ) { - - materialLightMapEnabled.setValue( true ); - materialLightMap.setValue( material.lightMap ); - - } else { - - materialLightMapEnabled.setValue( false ); - - } + materialLightMapEnabled.setValue( material.lightMap !== null ); + materialLightMap.setValue( material.lightMap ); } */ if ( material.bumpMap !== undefined ) { - if ( material.bumpMap !== null ) { - - materialBumpMapEnabled.setValue( true ); - materialBumpMap.setValue( material.bumpMap ); - materialBumpScale.setValue( material.bumpScale ); - - } else { - - materialBumpMapEnabled.setValue( false ); - materialBumpScale.setValue( 1 ); - - } + materialBumpMapEnabled.setValue( material.bumpMap !== null ); + materialBumpMap.setValue( material.bumpMap ); + materialBumpScale.setValue( material.bumpScale ); } if ( material.normalMap !== undefined ) { - if ( material.normalMap !== null ) { - - materialNormalMapEnabled.setValue( true ); - materialNormalMap.setValue( material.normalMap ); - - } else { - - materialNormalMapEnabled.setValue( false ); - - } + materialNormalMapEnabled.setValue( material.normalMap !== null ); + materialNormalMap.setValue( material.normalMap ); } if ( material.specularMap !== undefined ) { - if ( material.specularMap !== null ) { - - materialSpecularMapEnabled.setValue( true ); - materialSpecularMap.setValue( material.specularMap ); - - } else { - - materialSpecularMapEnabled.setValue( false ); - - } + materialSpecularMapEnabled.setValue( material.specularMap !== null ); + materialSpecularMap.setValue( material.specularMap ); } if ( material.envMap !== undefined ) { - if ( material.envMap !== null ) { - - materialEnvMapEnabled.setValue( true ); - materialEnvMap.setValue( material.envMap ); - materialReflectivity.setValue( material.reflectivity ); - - } else { - - materialEnvMapEnabled.setValue( false ); - - } + materialEnvMapEnabled.setValue( material.envMap !== null ); + materialEnvMap.setValue( material.envMap ); + materialReflectivity.setValue( material.reflectivity ); } @@ -638,9 +635,6 @@ Sidebar.Material = function ( signals ) { } else { - selected = null; - selectedHasUvs = false; - container.setDisplay( 'none' ); } diff --git a/editor/js/ui/Sidebar.Object3D.js b/editor/js/Sidebar.Object3D.js similarity index 59% rename from editor/js/ui/Sidebar.Object3D.js rename to editor/js/Sidebar.Object3D.js index d245b4048d..3b2f259ee3 100644 --- a/editor/js/ui/Sidebar.Object3D.js +++ b/editor/js/Sidebar.Object3D.js @@ -1,4 +1,6 @@ -Sidebar.Object3D = function ( signals ) { +Sidebar.Object3D = function ( editor ) { + + var signals = editor.signals; var container = new UI.Panel(); container.setBorderTop( '1px solid #ccc' ); @@ -9,15 +11,22 @@ Sidebar.Object3D = function ( signals ) { container.add( objectType ); container.add( new UI.Break(), new UI.Break() ); - // parent + // id - var objectParentRow = new UI.Panel(); - var objectParent = new UI.Select().setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( update ); + var objectUUIDRow = new UI.Panel(); + var objectUUID = new UI.Input().setWidth( '115px' ).setColor( '#444' ).setFontSize( '12px' ).setDisabled( true ); + var objectUUIDRenew = new UI.Button( '⟳' ).setMarginLeft( '7px' ).onClick( function () { - objectParentRow.add( new UI.Text( 'Parent' ).setWidth( '90px' ).setColor( '#666' ) ); - objectParentRow.add( objectParent ); + objectUUID.setValue( THREE.Math.generateUUID() ); + update(); - container.add( objectParentRow ); + } ); + + objectUUIDRow.add( new UI.Text( 'UUID' ).setWidth( '90px' ).setColor( '#666' ) ); + objectUUIDRow.add( objectUUID ); + objectUUIDRow.add( objectUUIDRenew ); + + container.add( objectUUIDRow ); // name @@ -29,6 +38,16 @@ Sidebar.Object3D = function ( signals ) { container.add( objectNameRow ); + // parent + + var objectParentRow = new UI.Panel(); + var objectParent = new UI.Select().setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( update ); + + objectParentRow.add( new UI.Text( 'Parent' ).setWidth( '90px' ).setColor( '#666' ) ); + objectParentRow.add( objectParent ); + + container.add( objectParentRow ); + // position var objectPositionRow = new UI.Panel(); @@ -56,7 +75,7 @@ Sidebar.Object3D = function ( signals ) { // scale var objectScaleRow = new UI.Panel(); - var objectScaleLock = new UI.Checkbox().setPosition( 'absolute' ).setLeft( '75px' ).onChange( updateScaleLock ); + var objectScaleLock = new UI.Checkbox().setPosition( 'absolute' ).setLeft( '75px' ); var objectScaleX = new UI.Number( 1 ).setWidth( '50px' ).onChange( updateScaleX ); var objectScaleY = new UI.Number( 1 ).setWidth( '50px' ).onChange( updateScaleY ); var objectScaleZ = new UI.Number( 1 ).setWidth( '50px' ).onChange( updateScaleZ ); @@ -196,169 +215,158 @@ Sidebar.Object3D = function ( signals ) { // - var selected = null; - - var scene = null; + function updateScaleX() { - var uniformScale = 1; + var object = editor.selected; - var scaleRatioX = 1; - var scaleRatioY = 1; - var scaleRatioZ = 1; + if ( objectScaleLock.getValue() === true ) { - var scaleLock = false; + var scale = objectScaleX.getValue() / object.scale.x; - function updateScaleLock() { + objectScaleY.setValue( objectScaleY.getValue() * scale ); + objectScaleZ.setValue( objectScaleZ.getValue() * scale ); - scaleLock = objectScaleLock.getValue(); + } - if ( scaleLock ) { + update(); - scaleRatioX = objectScaleX.getValue() / uniformScale; - scaleRatioY = objectScaleY.getValue() / uniformScale; - scaleRatioZ = objectScaleZ.getValue() / uniformScale; + } - } + function updateScaleY() { - } + var object = editor.selected; - function updateScaleX() { + if ( objectScaleLock.getValue() === true ) { - uniformScale = objectScaleX.getValue(); - update(); + var scale = objectScaleY.getValue() / object.scale.y; - } + objectScaleX.setValue( objectScaleX.getValue() * scale ); + objectScaleZ.setValue( objectScaleZ.getValue() * scale ); - function updateScaleY() { + } - uniformScale = objectScaleY.getValue(); update(); } function updateScaleZ() { - uniformScale = objectScaleZ.getValue(); - update(); + var object = editor.selected; - } + if ( objectScaleLock.getValue() === true ) { - function update() { + var scale = objectScaleZ.getValue() / object.scale.z; + + objectScaleX.setValue( objectScaleX.getValue() * scale ); + objectScaleY.setValue( objectScaleY.getValue() * scale ); - if ( selected ) { + } - selected.name = objectName.getValue(); + update(); - if ( selected.parent !== undefined ) { + } - var newParentId = parseInt( objectParent.getValue() ); + function update() { - if ( selected.parent.id !== newParentId && selected.id !== newParentId ) { + var object = editor.selected; - var parent = scene.getObjectById( newParentId, true ); + if ( object !== null ) { - if ( parent === undefined ) { + object.uuid = objectUUID.getValue(); + object.name = objectName.getValue(); - parent = scene; + if ( object.parent !== undefined ) { - } + var newParentId = parseInt( objectParent.getValue() ); - parent.add( selected ); + if ( object.parent.id !== newParentId && object.id !== newParentId ) { - signals.sceneChanged.dispatch( scene ); + editor.parent( object, editor.scene.getObjectById( newParentId, true ) ); } } - selected.position.x = objectPositionX.getValue(); - selected.position.y = objectPositionY.getValue(); - selected.position.z = objectPositionZ.getValue(); - - selected.rotation.x = objectRotationX.getValue(); - selected.rotation.y = objectRotationY.getValue(); - selected.rotation.z = objectRotationZ.getValue(); + object.position.x = objectPositionX.getValue(); + object.position.y = objectPositionY.getValue(); + object.position.z = objectPositionZ.getValue(); - if ( scaleLock ) { - - objectScaleX.setValue( uniformScale * scaleRatioX ); - objectScaleY.setValue( uniformScale * scaleRatioY ); - objectScaleZ.setValue( uniformScale * scaleRatioZ ); - - } + object.rotation.x = objectRotationX.getValue(); + object.rotation.y = objectRotationY.getValue(); + object.rotation.z = objectRotationZ.getValue(); - selected.scale.x = objectScaleX.getValue(); - selected.scale.y = objectScaleY.getValue(); - selected.scale.z = objectScaleZ.getValue(); + object.scale.x = objectScaleX.getValue(); + object.scale.y = objectScaleY.getValue(); + object.scale.z = objectScaleZ.getValue(); - if ( selected.fov !== undefined ) { + if ( object.fov !== undefined ) { - selected.fov = objectFov.getValue(); - selected.updateProjectionMatrix(); + object.fov = objectFov.getValue(); + object.updateProjectionMatrix(); } - if ( selected.near !== undefined ) { + if ( object.near !== undefined ) { - selected.near = objectNear.getValue(); + object.near = objectNear.getValue(); } - if ( selected.far !== undefined ) { + if ( object.far !== undefined ) { - selected.far = objectFar.getValue(); + object.far = objectFar.getValue(); } - if ( selected.intensity !== undefined ) { + if ( object.intensity !== undefined ) { - selected.intensity = objectIntensity.getValue(); + object.intensity = objectIntensity.getValue(); } - if ( selected.color !== undefined ) { + if ( object.color !== undefined ) { - selected.color.setHex( objectColor.getHexValue() ); + object.color.setHex( objectColor.getHexValue() ); } - if ( selected.groundColor !== undefined ) { + if ( object.groundColor !== undefined ) { - selected.groundColor.setHex( objectGroundColor.getHexValue() ); + object.groundColor.setHex( objectGroundColor.getHexValue() ); } - if ( selected.distance !== undefined ) { + if ( object.distance !== undefined ) { - selected.distance = objectDistance.getValue(); + object.distance = objectDistance.getValue(); } - if ( selected.angle !== undefined ) { + if ( object.angle !== undefined ) { - selected.angle = objectAngle.getValue(); + object.angle = objectAngle.getValue(); } - if ( selected.exponent !== undefined ) { + if ( object.exponent !== undefined ) { - selected.exponent = objectExponent.getValue(); + object.exponent = objectExponent.getValue(); } - selected.visible = objectVisible.getValue(); + object.visible = objectVisible.getValue(); try { - selected.userData = JSON.parse( objectUserData.getValue() ); + object.userData = JSON.parse( objectUserData.getValue() ); - } catch ( error ) { + } catch ( exception ) { - console.log( error ); + console.warn( exception ); } - signals.objectChanged.dispatch( selected ); + signals.objectChanged.dispatch( object ); } @@ -366,6 +374,8 @@ Sidebar.Object3D = function ( signals ) { function updateRows() { + var object = editor.selected; + var properties = { 'parent': objectParentRow, 'fov': objectFovRow, @@ -381,7 +391,7 @@ Sidebar.Object3D = function ( signals ) { for ( var property in properties ) { - properties[ property ].setDisplay( selected[ property ] !== undefined ? '' : 'none' ); + properties[ property ].setDisplay( object[ property ] !== undefined ? '' : 'none' ); } @@ -389,7 +399,10 @@ Sidebar.Object3D = function ( signals ) { function updateTransformRows() { - if ( selected instanceof THREE.Light || ( selected instanceof THREE.Object3D && selected.userData.targetInverse ) ) { + var object = editor.selected; + + if ( object instanceof THREE.Light || + ( object instanceof THREE.Object3D && object.userData.targetInverse ) ) { objectRotationRow.setDisplay( 'none' ); objectScaleRow.setDisplay( 'none' ); @@ -429,9 +442,15 @@ Sidebar.Object3D = function ( signals ) { // events - signals.sceneChanged.add( function ( object ) { + signals.objectSelected.add( function ( object ) { + + updateUI(); + + } ); - scene = object; + signals.sceneGraphChanged.add( function () { + + var scene = editor.scene; var options = {}; @@ -449,123 +468,126 @@ Sidebar.Object3D = function ( signals ) { } - } )( object.children ); + } )( scene.children ); objectParent.setOptions( options ); } ); - signals.objectSelected.add( function ( object ) { + signals.objectChanged.add( function ( object ) { + + if ( object !== editor.selected ) return; - selected = object; updateUI(); } ); - signals.objectChanged.add( function ( object ) { - if ( selected === object ) updateUI(); + function updateUI() { - } ); + container.setDisplay( 'none' ); - function updateUI() { + var object = editor.selected; - container.setDisplay( 'block' ); + if ( object !== null ) { - var object = selected; + container.setDisplay( 'block' ); - objectType.setValue( getObjectInstanceName( object ) ); + objectType.setValue( getObjectInstanceName( object ) ); - if ( object.parent !== undefined ) { + objectUUID.setValue( object.uuid ); + objectName.setValue( object.name ); - objectParent.setValue( object.parent.id ); + if ( object.parent !== undefined ) { - } + objectParent.setValue( object.parent.id ); - objectName.setValue( object.name ); + } - objectPositionX.setValue( object.position.x ); - objectPositionY.setValue( object.position.y ); - objectPositionZ.setValue( object.position.z ); + objectPositionX.setValue( object.position.x ); + objectPositionY.setValue( object.position.y ); + objectPositionZ.setValue( object.position.z ); - objectRotationX.setValue( object.rotation.x ); - objectRotationY.setValue( object.rotation.y ); - objectRotationZ.setValue( object.rotation.z ); + objectRotationX.setValue( object.rotation.x ); + objectRotationY.setValue( object.rotation.y ); + objectRotationZ.setValue( object.rotation.z ); - objectScaleX.setValue( object.scale.x ); - objectScaleY.setValue( object.scale.y ); - objectScaleZ.setValue( object.scale.z ); + objectScaleX.setValue( object.scale.x ); + objectScaleY.setValue( object.scale.y ); + objectScaleZ.setValue( object.scale.z ); - if ( object.fov !== undefined ) { + if ( object.fov !== undefined ) { - objectFov.setValue( object.fov ); + objectFov.setValue( object.fov ); - } + } - if ( object.near !== undefined ) { + if ( object.near !== undefined ) { - objectNear.setValue( object.near ); + objectNear.setValue( object.near ); - } + } - if ( object.far !== undefined ) { + if ( object.far !== undefined ) { - objectFar.setValue( object.far ); + objectFar.setValue( object.far ); - } + } - if ( object.intensity !== undefined ) { + if ( object.intensity !== undefined ) { - objectIntensity.setValue( object.intensity ); + objectIntensity.setValue( object.intensity ); - } + } - if ( object.color !== undefined ) { + if ( object.color !== undefined ) { - objectColor.setValue( '#' + object.color.getHexString() ); + objectColor.setValue( '#' + object.color.getHexString() ); - } + } - if ( object.groundColor !== undefined ) { + if ( object.groundColor !== undefined ) { - objectGroundColor.setValue( '#' + object.groundColor.getHexString() ); + objectGroundColor.setValue( '#' + object.groundColor.getHexString() ); - } + } - if ( object.distance !== undefined ) { + if ( object.distance !== undefined ) { - objectDistance.setValue( object.distance ); + objectDistance.setValue( object.distance ); - } + } - if ( object.angle !== undefined ) { + if ( object.angle !== undefined ) { - objectAngle.setValue( object.angle ); + objectAngle.setValue( object.angle ); - } + } - if ( object.exponent !== undefined ) { + if ( object.exponent !== undefined ) { - objectExponent.setValue( object.exponent ); + objectExponent.setValue( object.exponent ); - } + } - objectVisible.setValue( object.visible ); + objectVisible.setValue( object.visible ); - try { + try { - objectUserData.setValue( JSON.stringify( object.userData, null, ' ' ) ); + objectUserData.setValue( JSON.stringify( object.userData, null, ' ' ) ); - } catch ( error ) { + } catch ( error ) { + + console.log( error ); - console.log( error ); + } - } + objectUserData.setBorderColor( '#ccc' ); + objectUserData.setBackgroundColor( '' ); - objectUserData.setBorderColor( '#ccc' ); - objectUserData.setBackgroundColor( '' ); + updateRows(); + updateTransformRows(); - updateRows(); - updateTransformRows(); + } } diff --git a/editor/js/ui/Sidebar.Renderer.js b/editor/js/Sidebar.Renderer.js similarity index 96% rename from editor/js/ui/Sidebar.Renderer.js rename to editor/js/Sidebar.Renderer.js index 5a6d0624e6..321e473a9b 100644 --- a/editor/js/ui/Sidebar.Renderer.js +++ b/editor/js/Sidebar.Renderer.js @@ -1,4 +1,6 @@ -Sidebar.Renderer = function ( signals ) { +Sidebar.Renderer = function ( editor ) { + + var signals = editor.signals; var rendererClasses = { diff --git a/editor/js/ui/Sidebar.Scene.js b/editor/js/Sidebar.Scene.js similarity index 82% rename from editor/js/ui/Sidebar.Scene.js rename to editor/js/Sidebar.Scene.js index 79811d4a7b..77825af27e 100644 --- a/editor/js/ui/Sidebar.Scene.js +++ b/editor/js/Sidebar.Scene.js @@ -1,4 +1,6 @@ -Sidebar.Scene = function ( signals ) { +Sidebar.Scene = function ( editor ) { + + var signals = editor.signals; var selected = null; @@ -9,12 +11,27 @@ Sidebar.Scene = function ( signals ) { container.add( new UI.Text( 'SCENE' ).setColor( '#666' ) ); container.add( new UI.Break(), new UI.Break() ); - var outliner = new UI.FancySelect().setWidth( '100%' ).setHeight('140px').setColor( '#444' ).setFontSize( '12px' ).onChange( updateOutliner ); + var outliner = new UI.FancySelect().setWidth( '100%' ).setHeight('140px').setColor( '#444' ).setFontSize( '12px' ) + outliner.onChange( function () { + + editor.selectById( parseInt( outliner.getValue() ) ); + + } ); container.add( outliner ); container.add( new UI.Break() ); // fog + var updateFogParameters = function () { + + var near = fogNear.getValue(); + var far = fogFar.getValue(); + var density = fogDensity.getValue(); + + signals.fogParametersChanged.dispatch( near, far, density ); + + }; + var fogTypeRow = new UI.Panel(); var fogType = new UI.Select().setOptions( { @@ -22,7 +39,15 @@ Sidebar.Scene = function ( signals ) { 'Fog': 'Linear', 'FogExp2': 'Exponential' - } ).setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ).onChange( updateFogType ); + } ).setWidth( '150px' ).setColor( '#444' ).setFontSize( '12px' ) + fogType.onChange( function () { + + var type = fogType.getValue(); + signals.fogTypeChanged.dispatch( type ); + + refreshFogUI(); + + } ); fogTypeRow.add( new UI.Text( 'Fog' ).setWidth( '90px' ).setColor( '#666' ) ); fogTypeRow.add( fogType ); @@ -34,7 +59,12 @@ Sidebar.Scene = function ( signals ) { var fogColorRow = new UI.Panel(); fogColorRow.setDisplay( 'none' ); - var fogColor = new UI.Color().setValue( '#aaaaaa' ).onChange( updateFogColor ); + var fogColor = new UI.Color().setValue( '#aaaaaa' ) + fogColor.onChange( function () { + + signals.fogColorChanged.dispatch( fogColor.getHexValue() ); + + } ); fogColorRow.add( new UI.Text( 'Fog color' ).setWidth( '90px' ).setColor( '#666' ) ); fogColorRow.add( fogColor ); @@ -79,9 +109,7 @@ Sidebar.Scene = function ( signals ) { // - var scene = null; - - function getObjectType( object ) { + var getObjectType = function ( object ) { var objects = { @@ -105,33 +133,7 @@ Sidebar.Scene = function ( signals ) { } - function updateOutliner() { - - var id = parseInt( outliner.getValue() ); - - scene.traverse( function ( node ) { - - if ( node.id === id ) { - - signals.objectSelected.dispatch( node ); - return; - - } - - } ); - - } - - function updateFogType() { - - var type = fogType.getValue(); - signals.fogTypeChanged.dispatch( type ); - - refreshFogUI(); - - } - - function refreshFogUI() { + var refreshFogUI = function () { var type = fogType.getValue(); @@ -140,25 +142,13 @@ Sidebar.Scene = function ( signals ) { fogFarRow.setDisplay( type === 'Fog' ? '' : 'none' ); fogDensityRow.setDisplay( type === 'FogExp2' ? '' : 'none' ); - } - - function updateFogColor() { - - signals.fogColorChanged.dispatch( fogColor.getHexValue() ); - - } - - function updateFogParameters() { - - signals.fogParametersChanged.dispatch( fogNear.getValue(), fogFar.getValue(), fogDensity.getValue() ); - - } + }; // events - signals.sceneChanged.add( function ( object ) { + signals.sceneGraphChanged.add( function () { - scene = object; + var scene = editor.scene; var options = {}; @@ -179,6 +169,7 @@ Sidebar.Scene = function ( signals ) { } )( scene.children, '   ' ); outliner.setOptions( options ); + outliner.setValue( selected ); if ( scene.fog ) { @@ -209,7 +200,9 @@ Sidebar.Scene = function ( signals ) { signals.objectSelected.add( function ( object ) { - outliner.setValue( object !== null ? object.id : null ); + selected = object !== null ? object.id : null; + + outliner.setValue( selected ); } ); diff --git a/editor/js/Sidebar.js b/editor/js/Sidebar.js new file mode 100644 index 0000000000..fff15475d5 --- /dev/null +++ b/editor/js/Sidebar.js @@ -0,0 +1,16 @@ +var Sidebar = function ( editor ) { + + var container = new UI.Panel(); + container.setPosition( 'absolute' ); + container.setClass( 'sidebar' ); + + container.add( new Sidebar.Renderer( editor ) ); + container.add( new Sidebar.Scene( editor ) ); + container.add( new Sidebar.Object3D( editor ) ); + container.add( new Sidebar.Geometry( editor ) ); + container.add( new Sidebar.Material( editor ) ); + container.add( new Sidebar.Animation( editor ) ); + + return container; + +} diff --git a/editor/js/Toolbar.js b/editor/js/Toolbar.js new file mode 100644 index 0000000000..d1f7feb807 --- /dev/null +++ b/editor/js/Toolbar.js @@ -0,0 +1,56 @@ +var Toolbar = function ( editor ) { + + var signals = editor.signals; + + var container = new UI.Panel(); + container.setPosition( 'absolute' ); + container.setClass( 'toolbar' ); + + var buttons = new UI.Panel(); + container.add( buttons ); + + // translate / rotate / scale + + var translate = new UI.Button( 'translate' ).onClick( function () { + + signals.transformModeChanged.dispatch( 'translate' ); + + } ); + buttons.add( translate ); + + var rotate = new UI.Button( 'rotate' ).onClick( function () { + + signals.transformModeChanged.dispatch( 'rotate' ); + + } ); + buttons.add( rotate ); + + var scale = new UI.Button( 'scale' ).onClick( function () { + + signals.transformModeChanged.dispatch( 'scale' ); + + } ); + buttons.add( scale ); + + // grid + + var grid = new UI.Number( 25 ).onChange( update ); + grid.dom.style.width = '42px'; + buttons.add( new UI.Text( 'Grid: ' ) ); + buttons.add( grid ); + + var snap = new UI.Checkbox( false ).onChange( update ); + buttons.add( snap ); + buttons.add( new UI.Text( 'snap' ) ); + + function update() { + + signals.snapChanged.dispatch( snap.getValue() === true ? grid.getValue() : null ); + + } + + update(); + + return container; + +} diff --git a/editor/js/ui/Viewport.js b/editor/js/Viewport.js similarity index 50% rename from editor/js/ui/Viewport.js rename to editor/js/Viewport.js index 245b05d646..4e76efb265 100644 --- a/editor/js/ui/Viewport.js +++ b/editor/js/Viewport.js @@ -1,4 +1,6 @@ -var Viewport = function ( signals ) { +var Viewport = function ( editor ) { + + var signals = editor.signals; var container = new UI.Panel(); container.setPosition( 'absolute' ); @@ -12,43 +14,41 @@ var Viewport = function ( signals ) { info.setColor( '#ffffff' ); container.add( info ); + var scene = editor.scene; + var sceneHelpers = editor.sceneHelpers; + var clearColor = 0xAAAAAA; var objects = []; // helpers - var helpersToObjects = {}; - var objectsToHelpers = {}; - - var sceneHelpers = new THREE.Scene(); - var grid = new THREE.GridHelper( 500, 25 ); sceneHelpers.add( grid ); - var modifierAxis = new THREE.Vector3( 1, 1, 1 ); - var snapDist = null; + // + + var camera = new THREE.PerspectiveCamera( 50, container.dom.offsetWidth / container.dom.offsetHeight, 1, 5000 ); + camera.position.set( 500, 250, 500 ); + camera.lookAt( scene.position ); + + // var selectionBox = new THREE.BoxHelper(); - selectionBox.material.color.setHex( 0xffff00 ); selectionBox.material.depthTest = false; selectionBox.material.transparent = true; selectionBox.visible = false; sceneHelpers.add( selectionBox ); - var selectionAxis = new THREE.AxisHelper( 100 ); - selectionAxis.material.depthTest = false; - selectionAxis.material.transparent = true; - selectionAxis.matrixAutoUpdate = false; - selectionAxis.visible = false; - sceneHelpers.add( selectionAxis ); + var transformControls = new THREE.TransformControls( camera, container.dom ); + transformControls.addEventListener( 'change', function () { - // + // TODO: Differentiate from transform hovers change and object transform change - var scene = new THREE.Scene(); + signals.objectChanged.dispatch( editor.selected ); - var camera = new THREE.PerspectiveCamera( 50, container.dom.offsetWidth / container.dom.offsetHeight, 1, 5000 ); - camera.position.set( 500, 250, 500 ); - camera.lookAt( scene.position ); + } ); + sceneHelpers.add( transformControls.gizmo ); + transformControls.hide(); // fog @@ -60,15 +60,8 @@ var Viewport = function ( signals ) { // object picking - var intersectionPlane = new THREE.Mesh( new THREE.PlaneGeometry( 5000, 5000 ) ); - intersectionPlane.visible = false; - sceneHelpers.add( intersectionPlane ); - var ray = new THREE.Raycaster(); var projector = new THREE.Projector(); - var offset = new THREE.Vector3(); - - var selected = camera; // events @@ -95,86 +88,23 @@ var Viewport = function ( signals ) { }; var onMouseDownPosition = new THREE.Vector2(); - var onMouseMovePosition = new THREE.Vector2(); var onMouseUpPosition = new THREE.Vector2(); var onMouseDown = function ( event ) { event.preventDefault(); - container.dom.focus(); - onMouseDownPosition.set( event.layerX, event.layerY ); - if ( event.button === 0 ) { - - var intersects = getIntersects( event, objects ); - - if ( intersects.length > 0 ) { - - var object = intersects[ 0 ].object; - - if ( selected === object || selected === helpersToObjects[ object.id ] ) { - - intersectionPlane.position.copy( selected.position ); - intersectionPlane.lookAt( camera.position ); - intersectionPlane.updateMatrixWorld(); - - var intersects = ray.intersectObject( intersectionPlane ); - - offset.copy( intersects[ 0 ].point ).sub( intersectionPlane.position ); - - document.addEventListener( 'mousemove', onMouseMove, false ); - - controls.enabled = false; - - } - - } else { - - controls.enabled = true; - - } + if ( transformControls.hovered === false ) { + controls.enabled = true; document.addEventListener( 'mouseup', onMouseUp, false ); } }; - var onMouseMove = function ( event ) { - - onMouseMovePosition.set( event.layerX, event.layerY ); - - if ( onMouseDownPosition.distanceTo( onMouseUpPosition ) > 1 ) { - - var intersects = getIntersects( event, intersectionPlane ); - - if ( intersects.length > 0 ) { - - var point = intersects[ 0 ].point.sub( offset ); - - if (snapDist) { - point.x = Math.round( point.x / snapDist ) * snapDist; - point.y = Math.round( point.y / snapDist ) * snapDist; - point.z = Math.round( point.z / snapDist ) * snapDist; - } - - selected.position.x = modifierAxis.x === 1 ? point.x : intersectionPlane.position.x; - selected.position.y = modifierAxis.y === 1 ? point.y : intersectionPlane.position.y; - selected.position.z = modifierAxis.z === 1 ? point.z : intersectionPlane.position.z; - - - signals.objectChanged.dispatch( selected ); - - render(); - - } - - } - - }; - var onMouseUp = function ( event ) { onMouseUpPosition.set( event.layerX, event.layerY ); @@ -185,23 +115,22 @@ var Viewport = function ( signals ) { if ( intersects.length > 0 ) { - selected = intersects[ 0 ].object; - - if ( helpersToObjects[ selected.id ] !== undefined ) { + var object = intersects[ 0 ].object; - selected = helpersToObjects[ selected.id ]; + if ( object.userData.object !== undefined ) { - } + + editor.select( object.userData.object ); - signals.objectSelected.dispatch( selected ); + } else { - } else { + editor.select( object ); - controls.enabled = true; + } - selected = camera; + } else { - signals.objectSelected.dispatch( selected ); + editor.select( camera ); } @@ -209,7 +138,8 @@ var Viewport = function ( signals ) { } - document.removeEventListener( 'mousemove', onMouseMove ); + controls.enabled = false; + document.removeEventListener( 'mouseup', onMouseUp ); }; @@ -218,10 +148,9 @@ var Viewport = function ( signals ) { var intersects = getIntersects( event, objects ); - if ( intersects.length > 0 && intersects[ 0 ].object === selected ) { + if ( intersects.length > 0 && intersects[ 0 ].object === editor.selected ) { - controls.focus( selected ); - controls.enabled = true; + controls.focus( editor.selected ); } @@ -236,15 +165,24 @@ var Viewport = function ( signals ) { var controls = new THREE.EditorControls( camera, container.dom ); controls.addEventListener( 'change', function () { + transformControls.update(); signals.objectChanged.dispatch( camera ); } ); + controls.enabled = false; // signals - signals.modifierAxisChanged.add( function ( axis ) { + signals.transformModeChanged.add( function ( mode ) { + + transformControls.setMode( mode ); + render(); + + } ); + + signals.snapChanged.add( function ( dist ) { - modifierAxis.copy( axis ); + transformControls.snapDist = dist; } ); @@ -270,97 +208,17 @@ var Viewport = function ( signals ) { } ); - signals.sceneAdded.add( function ( object ) { - - scene.userData = JSON.parse( JSON.stringify( object.userData ) ); - - while ( object.children.length > 0 ) { - - signals.objectAdded.dispatch( object.children[ 0 ] ); - - } - - } ); - - signals.objectAdded.add( function ( object ) { - - // handle children - - object.traverse( function ( object ) { - - // create helpers for invisible object types (lights, cameras, targets) - - if ( object instanceof THREE.PointLight ) { - - var helper = new THREE.PointLightHelper( object, 10 ); - sceneHelpers.add( helper ); - - objectsToHelpers[ object.id ] = helper; - helpersToObjects[ helper.lightSphere.id ] = object; - - objects.push( helper.lightSphere ); - - } else if ( object instanceof THREE.DirectionalLight ) { - - var helper = new THREE.DirectionalLightHelper( object, 10 ); - sceneHelpers.add( helper ); - - objectsToHelpers[ object.id ] = helper; - helpersToObjects[ helper.lightSphere.id ] = object; - - objects.push( helper.lightSphere ); - - } else if ( object instanceof THREE.SpotLight ) { - - var helper = new THREE.SpotLightHelper( object, 10 ); - sceneHelpers.add( helper ); - - objectsToHelpers[ object.id ] = helper; - helpersToObjects[ helper.lightSphere.id ] = object; - - objects.push( helper.lightSphere ); - - } else if ( object instanceof THREE.HemisphereLight ) { - - var helper = new THREE.HemisphereLightHelper( object, 10 ); - sceneHelpers.add( helper ); - - objectsToHelpers[ object.id ] = helper; - helpersToObjects[ helper.lightSphere.id ] = object; - - objects.push( helper.lightSphere ); - - } else { - - // add to picking list - - objects.push( object ); - - } - - } ); - - scene.add( object ); - - // TODO: Add support for hierarchies with lights - - if ( object instanceof THREE.Light ) { - - updateMaterials( scene ); - - } + signals.sceneGraphChanged.add( function () { + render(); updateInfo(); - signals.sceneChanged.dispatch( scene ); - signals.objectSelected.dispatch( object ); - } ); signals.objectSelected.add( function ( object ) { selectionBox.visible = false; - selectionAxis.visible = false; + transformControls.detach(); if ( object !== null ) { @@ -371,10 +229,11 @@ var Viewport = function ( signals ) { } - selectionAxis.matrixWorld = object.matrixWorld; - selectionAxis.visible = true; + if ( object instanceof THREE.PerspectiveCamera === false ) { + + transformControls.attach( object ); - selected = object; + } } @@ -382,93 +241,60 @@ var Viewport = function ( signals ) { } ); - signals.objectChanged.add( function ( object ) { - - if ( object.geometry !== undefined ) { - - selectionBox.update( object ); - updateInfo(); - - } + signals.objectAdded.add( function ( object ) { - if ( objectsToHelpers[ object.id ] !== undefined ) { + if ( object instanceof THREE.Light ) { - objectsToHelpers[ object.id ].update(); + updateMaterials(); } - render(); - - signals.sceneChanged.dispatch( scene ); - - } ); - - signals.cloneSelectedObject.add( function () { - - if ( selected === camera ) return; - - var object = selected.clone(); - - signals.objectAdded.dispatch( object ); + objects.push( object ); } ); - signals.removeSelectedObject.add( function () { - - if ( selected.parent === undefined ) return; - - var name = selected.name ? '"' + selected.name + '"': "selected object"; - - if ( confirm( 'Delete ' + name + '?' ) === false ) return; - - var parent = selected.parent; + signals.objectChanged.add( function ( object ) { - if ( selected instanceof THREE.PointLight || - selected instanceof THREE.DirectionalLight || - selected instanceof THREE.SpotLight || - selected instanceof THREE.HemisphereLight ) { + if ( object.geometry !== undefined ) { - var helper = objectsToHelpers[ selected.id ]; + selectionBox.update( object ); - objects.splice( objects.indexOf( helper.lightSphere ), 1 ); + } - helper.parent.remove( helper ); - selected.parent.remove( selected ); + if ( editor.helpers[ object.id ] !== undefined ) { - delete objectsToHelpers[ selected.id ]; - delete helpersToObjects[ helper.id ]; + editor.helpers[ object.id ].update(); - if ( selected instanceof THREE.DirectionalLight || - selected instanceof THREE.SpotLight ) { + } - selected.target.parent.remove( selected.target ); + transformControls.update(); - } + render(); + updateInfo(); - updateMaterials( scene ); + } ); - } else { + signals.objectRemoved.add( function ( object ) { - selected.traverse( function ( object ) { + if ( object instanceof THREE.Light ) { - var index = objects.indexOf( object ); + updateMaterials(); - if ( index !== -1 ) { + } - objects.splice( index, 1 ) + objects.splice( objects.indexOf( object ), 1 ); - } + } ); - } ); + signals.helperAdded.add( function ( object ) { - selected.parent.remove( selected ); + objects.push( object.getObjectByName( 'picker' ) ); - updateInfo(); + } ); - } + signals.helperRemoved.add( function ( object ) { - signals.sceneChanged.dispatch( scene ); - signals.objectSelected.dispatch( parent ); + objects.splice( objects.indexOf( object.getObjectByName( 'picker' ) ), 1 ); } ); @@ -505,7 +331,7 @@ var Viewport = function ( signals ) { } - updateMaterials( scene ); + updateMaterials(); oldFogType = fogType; @@ -548,6 +374,23 @@ var Viewport = function ( signals ) { } ); + signals.playAnimations.add( function (animations) { + + function animate() { + requestAnimationFrame( animate ); + + for (var i = 0; i < animations.length ; i++ ){ + animations[i].update(0.016); + } + + + render(); + } + + animate(); + + } ); + // var renderer; @@ -593,9 +436,9 @@ var Viewport = function ( signals ) { } - function updateMaterials( root ) { + function updateMaterials() { - root.traverse( function ( node ) { + editor.scene.traverse( function ( node ) { if ( node.material ) { diff --git a/editor/js/UI.js b/editor/js/libs/ui.js similarity index 82% rename from editor/js/UI.js rename to editor/js/libs/ui.js index 8196d08a64..9957ced8fa 100644 --- a/editor/js/UI.js +++ b/editor/js/libs/ui.js @@ -22,6 +22,14 @@ UI.Element.prototype = { }, + setDisabled: function ( value ) { + + this.dom.disabled = value; + + return this; + + }, + setTextContent: function ( value ) { this.dom.textContent = value; @@ -53,7 +61,7 @@ properties.forEach( function ( property ) { // events -var events = [ 'MouseOver', 'MouseOut', 'Click' ]; +var events = [ 'KeyUp', 'KeyDown', 'MouseOver', 'MouseOut', 'Click', 'Change' ]; events.forEach( function ( event ) { @@ -162,16 +170,14 @@ UI.Input = function () { dom.style.marginLeft = '-2px'; dom.style.border = '1px solid #ccc'; - this.dom = dom; - - this.onChangeCallback = null; + dom.addEventListener( 'keydown', function ( event ) { - this.dom.addEventListener( 'change', function ( event ) { - - if ( scope.onChangeCallback ) scope.onChangeCallback(); + event.stopPropagation(); }, false ); + this.dom = dom; + return this; }; @@ -192,14 +198,6 @@ UI.Input.prototype.setValue = function ( value ) { }; -UI.Input.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // TextArea @@ -216,21 +214,13 @@ UI.TextArea = function () { dom.style.marginLeft = '-2px'; dom.style.border = '1px solid #ccc'; - this.dom = dom; - - this.onChangeCallback = null; - - this.dom.addEventListener( 'keyup', function ( event ) { + dom.addEventListener( 'keydown', function ( event ) { - if ( scope.onKeyUpCallback ) scope.onKeyUpCallback(); + event.stopPropagation(); }, false ); - this.dom.addEventListener( 'change', function ( event ) { - - if ( scope.onChangeCallback ) scope.onChangeCallback(); - - }, false ); + this.dom = dom; return this; @@ -252,22 +242,6 @@ UI.TextArea.prototype.setValue = function ( value ) { }; -UI.TextArea.prototype.onKeyUp = function ( callback ) { - - this.onKeyUpCallback = callback; - - return this; - -}; - -UI.TextArea.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Select @@ -286,14 +260,6 @@ UI.Select = function () { this.dom = dom; - this.onChangeCallback = null; - - this.dom.addEventListener( 'change', function ( event ) { - - if ( scope.onChangeCallback ) scope.onChangeCallback(); - - }, false ); - return this; }; @@ -310,6 +276,8 @@ UI.Select.prototype.setMultiple = function ( boolean ) { UI.Select.prototype.setOptions = function ( options ) { + var selected = this.dom.value; + while ( this.dom.children.length > 0 ) { this.dom.removeChild( this.dom.firstChild ); @@ -325,6 +293,8 @@ UI.Select.prototype.setOptions = function ( options ) { } + this.dom.value = selected; + return this; }; @@ -343,14 +313,6 @@ UI.Select.prototype.setValue = function ( value ) { }; -UI.Select.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // FancySelect UI.FancySelect = function () { @@ -369,8 +331,6 @@ UI.FancySelect = function () { this.dom = dom; - this.onChangeCallback = null; - this.options = []; this.selectedValue = null; @@ -384,6 +344,9 @@ UI.FancySelect.prototype.setOptions = function ( options ) { var scope = this; + var changeEvent = document.createEvent( 'HTMLEvents' ); + changeEvent.initEvent( 'change', true, true ); + while ( scope.dom.children.length > 0 ) { scope.dom.removeChild( scope.dom.firstChild ); @@ -392,26 +355,6 @@ UI.FancySelect.prototype.setOptions = function ( options ) { scope.options = []; - var generateOptionCallback = function ( element, value ) { - - return function ( event ) { - - for ( var i = 0; i < scope.options.length; i ++ ) { - - scope.options[ i ].style.backgroundColor = '#f0f0f0'; - - } - - element.style.backgroundColor = '#f0f0f0'; - - scope.selectedValue = value; - - if ( scope.onChangeCallback ) scope.onChangeCallback(); - - } - - }; - for ( var key in options ) { var option = document.createElement( 'div' ); @@ -422,7 +365,13 @@ UI.FancySelect.prototype.setOptions = function ( options ) { scope.dom.appendChild( option ); scope.options.push( option ); - option.addEventListener( 'click', generateOptionCallback( option, key ), false ); + + option.addEventListener( 'click', function ( event ) { + + scope.setValue( this.value ); + scope.dom.dispatchEvent( changeEvent ); + + }, false ); } @@ -438,19 +387,28 @@ UI.FancySelect.prototype.getValue = function () { UI.FancySelect.prototype.setValue = function ( value ) { - // must convert raw value into string for compatibility with UI.Select - // which uses string values (initialized from options keys) - - var key = value ? value.toString() : value; + if ( typeof value === 'number' ) value = value.toString(); for ( var i = 0; i < this.options.length; i ++ ) { var element = this.options[ i ]; - if ( element.value === key ) { + if ( element.value === value ) { element.style.backgroundColor = '#f0f0f0'; + // scroll into view + + var y = i * element.clientHeight; + var scrollTop = this.dom.scrollTop; + var domHeight = this.dom.clientHeight; + + if ( y < scrollTop || y > scrollTop + domHeight ) { + + this.dom.scrollTop = y; + + } + } else { element.style.backgroundColor = ''; @@ -465,14 +423,6 @@ UI.FancySelect.prototype.setValue = function ( value ) { }; -UI.FancySelect.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Checkbox UI.Checkbox = function ( boolean ) { @@ -488,14 +438,6 @@ UI.Checkbox = function ( boolean ) { this.dom = dom; this.setValue( boolean ); - this.onChangeCallback = null; - - this.dom.addEventListener( 'change', function ( event ) { - - if ( scope.onChangeCallback ) scope.onChangeCallback(); - - }, false ); - return this; }; @@ -520,14 +462,6 @@ UI.Checkbox.prototype.setValue = function ( value ) { }; -UI.Checkbox.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Color @@ -549,14 +483,6 @@ UI.Color = function () { this.dom = dom; - this.onChangeCallback = null; - - this.dom.addEventListener( 'change', function ( event ) { - - if ( scope.onChangeCallback ) scope.onChangeCallback(); - - }, false ); - return this; }; @@ -591,14 +517,6 @@ UI.Color.prototype.setHexValue = function ( hex ) { }; -UI.Color.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Number @@ -620,6 +538,14 @@ UI.Number = function ( number ) { dom.style.cursor = 'col-resize'; dom.value = '0.00'; + dom.addEventListener( 'keydown', function ( event ) { + + event.stopPropagation(); + + if ( event.keyCode === 13 ) dom.blur(); + + }, false ); + this.min = - Infinity; this.max = Infinity; @@ -629,7 +555,8 @@ UI.Number = function ( number ) { this.dom = dom; this.setValue( number ); - this.onChangeCallback = null; + var changeEvent = document.createEvent( 'HTMLEvents' ); + changeEvent.initEvent( 'change', true, true ); var distance = 0; var onMouseDownValue = 0; @@ -660,7 +587,7 @@ UI.Number = function ( number ) { dom.value = Math.min( scope.max, Math.max( scope.min, number ) ).toFixed( scope.precision ); - if ( currentValue !== dom.value && scope.onChangeCallback ) scope.onChangeCallback(); + if ( currentValue !== dom.value ) dom.dispatchEvent( changeEvent ); }; @@ -686,8 +613,6 @@ UI.Number = function ( number ) { dom.value = number; - if ( scope.onChangeCallback ) scope.onChangeCallback(); - } }; @@ -754,14 +679,6 @@ UI.Number.prototype.setPrecision = function ( precision ) { }; -UI.Number.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Integer @@ -783,6 +700,12 @@ UI.Integer = function ( number ) { dom.style.cursor = 'col-resize'; dom.value = '0.00'; + dom.addEventListener( 'keydown', function ( event ) { + + event.stopPropagation(); + + }, false ); + this.min = - Infinity; this.max = Infinity; @@ -791,7 +714,8 @@ UI.Integer = function ( number ) { this.dom = dom; this.setValue( number ); - this.onChangeCallback = null; + var changeEvent = document.createEvent( 'HTMLEvents' ); + changeEvent.initEvent( 'change', true, true ); var distance = 0; var onMouseDownValue = 0; @@ -822,7 +746,7 @@ UI.Integer = function ( number ) { dom.value = Math.min( scope.max, Math.max( scope.min, number ) ) | 0; - if ( currentValue !== dom.value && scope.onChangeCallback ) scope.onChangeCallback(); + if ( currentValue !== dom.value ) dom.dispatchEvent( changeEvent ); }; @@ -848,8 +772,6 @@ UI.Integer = function ( number ) { dom.value = number; - if ( scope.onChangeCallback ) scope.onChangeCallback(); - } }; @@ -908,14 +830,6 @@ UI.Integer.prototype.setRange = function ( min, max ) { }; -UI.Integer.prototype.onChange = function ( callback ) { - - this.onChangeCallback = callback; - - return this; - -}; - // Break @@ -955,7 +869,7 @@ UI.HorizontalRule.prototype = Object.create( UI.Element.prototype ); // Button -UI.Button = function () { +UI.Button = function ( value ) { UI.Element.call( this ); @@ -965,6 +879,7 @@ UI.Button = function () { dom.className = 'Button'; this.dom = dom; + this.dom.textContent = value; return this; diff --git a/editor/js/UI.three.js b/editor/js/libs/ui.three.js similarity index 75% rename from editor/js/UI.three.js rename to editor/js/libs/ui.three.js index c49cdccd66..1c1b00bdd1 100644 --- a/editor/js/UI.three.js +++ b/editor/js/libs/ui.three.js @@ -7,7 +7,7 @@ UI.Texture = function ( position ) { var scope = this; var image = new Image(); - this.texture = new THREE.Texture( image ); + this.texture = null; this.dom = document.createElement( 'input' ); this.dom.type = 'file'; @@ -25,40 +25,39 @@ UI.Texture = function ( position ) { reader.addEventListener( 'load', function ( event ) { var image = document.createElement( 'img' ); - image.addEventListener( 'load', function( event ) { - scope.texture.image = this; + scope.texture = new THREE.Texture( this ); scope.texture.needsUpdate = true; - if ( scope.onChangeCallback ) scope.onChangeCallback(); + // remember the original filename (including extension) + // this is used for url field in the scene export - }, false ); + scope.texture.sourceFile = file.name; - image.src = event.target.result; + // generate unique name per texture + // based on source file name - // remember the original filename (including extension) - // this is used for url field in the scene export + var chunks = file.name.split( '.' ); + var extension = chunks.pop().toLowerCase(); + var filename = chunks.join( '.' ); - scope.texture.sourceFile = file.name; + if ( ! ( filename in scope.textureNameMap ) ) { - // generate unique name per texture - // based on source file name + scope.textureNameMap[ filename ] = true; + scope.texture.name = filename; - var chunks = file.name.split( '.' ); - var extension = chunks.pop().toLowerCase(); - var filename = chunks.join( '.' ); + } else { - if ( ! ( filename in scope.textureNameMap ) ) { + scope.texture.name = filename + "_" + scope.texture.id; - scope.textureNameMap[ filename ] = true; - scope.texture.name = filename; + } - } else { + if ( scope.onChangeCallback ) scope.onChangeCallback(); - scope.texture.name = filename + "_" + scope.texture.id; + }, false ); - } + image.src = event.target.result; }, false ); @@ -105,7 +104,7 @@ UI.CubeTexture = function ( position ) { var scope = this; - this.texture = new THREE.Texture( [], new THREE.CubeReflectionMapping() ); + this.texture = null; this.dom = document.createElement( 'input' ); this.dom.type = 'file'; @@ -125,7 +124,7 @@ UI.CubeTexture = function ( position ) { var image = document.createElement( 'img' ); image.addEventListener( 'load', function( event ) { - scope.texture.image = [ this, this, this, this, this, this ]; + scope.texture = new THREE.Texture( [ this, this, this, this, this, this ], new THREE.CubeReflectionMapping() ) scope.texture.needsUpdate = true; if ( scope.onChangeCallback ) scope.onChangeCallback(); diff --git a/editor/js/ui/Menubar.Edit.js b/editor/js/ui/Menubar.Edit.js deleted file mode 100644 index 5edc2330fd..0000000000 --- a/editor/js/ui/Menubar.Edit.js +++ /dev/null @@ -1,42 +0,0 @@ -Menubar.Edit = function ( signals ) { - - var container = new UI.Panel(); - container.setClass( 'menu' ); - container.onMouseOver( function () { options.setDisplay( 'block' ) } ); - container.onMouseOut( function () { options.setDisplay( 'none' ) } ); - container.onClick( function () { options.setDisplay( 'block' ) } ); - - var title = new UI.Panel(); - title.setTextContent( 'Edit' ).setColor( '#666' ); - title.setMargin( '0px' ); - title.setPadding( '8px' ); - container.add( title ); - - // - - var options = new UI.Panel(); - options.setClass( 'options' ); - options.setDisplay( 'none' ); - container.add( options ); - - // clone - - var option = new UI.Panel(); - option.setClass( 'option' ); - option.setTextContent( 'Clone' ); - option.onClick( function () { signals.cloneSelectedObject.dispatch(); } ); - options.add( option ); - - // delete - - var option = new UI.Panel(); - option.setClass( 'option' ); - option.setTextContent( 'Delete' ); - option.onClick( function () { signals.removeSelectedObject.dispatch(); } ); - options.add( option ); - - // - - return container; - -} diff --git a/editor/js/ui/Menubar.js b/editor/js/ui/Menubar.js deleted file mode 100644 index ebc970dfcb..0000000000 --- a/editor/js/ui/Menubar.js +++ /dev/null @@ -1,14 +0,0 @@ -var Menubar = function ( signals ) { - - var container = new UI.Panel(); - container.setPosition( 'absolute' ); - container.setClass( 'menubar' ); - - container.add( new Menubar.File( signals ) ); - container.add( new Menubar.Edit( signals ) ); - container.add( new Menubar.Add( signals ) ); - container.add( new Menubar.Help( signals ) ); - - return container; - -} diff --git a/editor/js/ui/Sidebar.js b/editor/js/ui/Sidebar.js deleted file mode 100644 index e8b0244881..0000000000 --- a/editor/js/ui/Sidebar.js +++ /dev/null @@ -1,15 +0,0 @@ -var Sidebar = function ( signals ) { - - var container = new UI.Panel(); - container.setPosition( 'absolute' ); - container.setClass( 'sidebar' ); - - container.add( new Sidebar.Renderer( signals ) ); - container.add( new Sidebar.Scene( signals ) ); - container.add( new Sidebar.Object3D( signals ) ); - container.add( new Sidebar.Geometry( signals ) ); - container.add( new Sidebar.Material( signals ) ); - - return container; - -} diff --git a/editor/js/ui/Toolbar.js b/editor/js/ui/Toolbar.js deleted file mode 100644 index 216853416d..0000000000 --- a/editor/js/ui/Toolbar.js +++ /dev/null @@ -1,55 +0,0 @@ -var Toolbar = function ( signals ) { - - var container = new UI.Panel(); - container.setPosition( 'absolute' ); - container.setClass( 'toolbar' ); - - var buttons = new UI.Panel(); - buttons.setPadding( '7px' ); - container.add( buttons ); - - // axis - - var x = new UI.Checkbox( true ).onChange( update ); - buttons.add( x ); - buttons.add( new UI.Text( 'x' ) ); - - var y = new UI.Checkbox( true ).setMarginLeft( '10px' ).onChange( update ); - buttons.add( y ); - buttons.add( new UI.Text( 'y ' ) ); - - var z = new UI.Checkbox( true ).setMarginLeft( '10px' ).onChange( update ); - buttons.add( z ); - buttons.add( new UI.Text( 'z ' ) ); - - buttons.add( new UI.Text().setWidth( '25px' ) ); - - // grid - - var grid = new UI.Number( 25 ).onChange( update ); - grid.dom.style.width = '42px'; - buttons.add( new UI.Text( 'Grid: ' ) ); - buttons.add( grid ); - - var snap = new UI.Checkbox( false ).onChange( update ); - buttons.add( snap ); - buttons.add( new UI.Text( 'snap' ) ); - - function update() { - - var axis = new THREE.Vector3(); - axis.x = x.getValue() === true ? 1 : 0; - axis.y = y.getValue() === true ? 1 : 0; - axis.z = z.getValue() === true ? 1 : 0; - - signals.modifierAxisChanged.dispatch( axis ); - - signals.snapChanged.dispatch( snap.getValue() === true ? grid.getValue() : null ); - - } - - update(); - - return container; - -} diff --git a/examples/canvas_geometry_earth.html b/examples/canvas_geometry_earth.html index 578183d550..930d493d01 100644 --- a/examples/canvas_geometry_earth.html +++ b/examples/canvas_geometry_earth.html @@ -54,7 +54,7 @@ container = document.getElementById( 'container' ); - camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 ); + camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 2000 ); camera.position.z = 500; scene = new THREE.Scene(); @@ -64,24 +64,17 @@ // earth - var earthTexture = new THREE.Texture(); - var loader = new THREE.ImageLoader(); + var loader = new THREE.TextureLoader(); + loader.load( 'textures/land_ocean_ice_cloud_2048.jpg', function ( texture ) { - loader.addEventListener( 'load', function ( event ) { + var geometry = new THREE.SphereGeometry( 200, 20, 20 ); - earthTexture.image = event.content; - earthTexture.needsUpdate = true; + var material = new THREE.MeshBasicMaterial( { map: texture, overdraw: true } ); + var mesh = new THREE.Mesh( geometry, material ); + group.add( mesh ); } ); - loader.load( 'textures/land_ocean_ice_cloud_2048.jpg' ); - - var geometry = new THREE.SphereGeometry( 200, 20, 20 ); - var material = new THREE.MeshBasicMaterial( { map: earthTexture, overdraw: true } ); - - var mesh = new THREE.Mesh( geometry, material ); - group.add( mesh ); - // shadow var canvas = document.createElement( 'canvas' ); @@ -89,7 +82,14 @@ canvas.height = 128; var context = canvas.getContext( '2d' ); - var gradient = context.createRadialGradient( canvas.width / 2, canvas.height / 2, 0, canvas.width / 2, canvas.height / 2, canvas.width / 2 ); + var gradient = context.createRadialGradient( + canvas.width / 2, + canvas.height / 2, + 0, + canvas.width / 2, + canvas.height / 2, + canvas.width / 2 + ); gradient.addColorStop( 0.1, 'rgba(210,210,210,1)' ); gradient.addColorStop( 1, 'rgba(255,255,255,1)' ); diff --git a/examples/canvas_geometry_nurbs.html b/examples/canvas_geometry_nurbs.html new file mode 100644 index 0000000000..9102a84e04 --- /dev/null +++ b/examples/canvas_geometry_nurbs.html @@ -0,0 +1,240 @@ + + + + + three.js canvas - geometry - NURBS + + + + + + + +
three.js - NURBS curve example
+ + + + + + + + + + diff --git a/examples/canvas_interactive_cubes.html b/examples/canvas_interactive_cubes.html index fa3a40aba4..8186bce3f2 100644 --- a/examples/canvas_interactive_cubes.html +++ b/examples/canvas_interactive_cubes.html @@ -79,7 +79,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_interactive_lines.html b/examples/canvas_interactive_lines.html new file mode 100644 index 0000000000..875e6526c8 --- /dev/null +++ b/examples/canvas_interactive_lines.html @@ -0,0 +1,230 @@ + + + + three.js canvas - interactive lines + + + + + + + + + + + + + + diff --git a/examples/canvas_interactive_particles.html b/examples/canvas_interactive_particles.html index c4ac58cd1f..ca32162bd4 100644 --- a/examples/canvas_interactive_particles.html +++ b/examples/canvas_interactive_particles.html @@ -30,7 +30,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } @@ -40,7 +39,6 @@ context.lineWidth = 0.05; context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.stroke(); } diff --git a/examples/canvas_lines.html b/examples/canvas_lines.html index 0d2c907fe8..b3d70344e9 100644 --- a/examples/canvas_lines.html +++ b/examples/canvas_lines.html @@ -63,7 +63,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_lines_dashed.html b/examples/canvas_lines_dashed.html new file mode 100644 index 0000000000..37e3cda14e --- /dev/null +++ b/examples/canvas_lines_dashed.html @@ -0,0 +1,244 @@ + + + + three.js canvas - dashed lines + + + + + + +
three.js - dashed lines example
+
+ + + + + + + + + + + + diff --git a/examples/canvas_lines_sphere.html b/examples/canvas_lines_sphere.html index 80dbab1b46..e759a1e813 100644 --- a/examples/canvas_lines_sphere.html +++ b/examples/canvas_lines_sphere.html @@ -66,7 +66,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_materials.html b/examples/canvas_materials.html index 263ab6f2dc..0579c32c95 100644 --- a/examples/canvas_materials.html +++ b/examples/canvas_materials.html @@ -112,7 +112,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_materials_video.html b/examples/canvas_materials_video.html index 6c6f91df70..dd0570234a 100644 --- a/examples/canvas_materials_video.html +++ b/examples/canvas_materials_video.html @@ -129,7 +129,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_particles_random.html b/examples/canvas_particles_random.html index 1851d72abf..173c91b8db 100644 --- a/examples/canvas_particles_random.html +++ b/examples/canvas_particles_random.html @@ -49,7 +49,6 @@ context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); context.fill(); } diff --git a/examples/canvas_particles_shapes.html b/examples/canvas_particles_shapes.html index 4e16868651..a601b424a9 100644 --- a/examples/canvas_particles_shapes.html +++ b/examples/canvas_particles_shapes.html @@ -138,7 +138,6 @@ context.lineWidth = 0.05; context.beginPath(); context.arc( 0, 0, 1, 0, Math.PI*2, true ); - context.closePath(); context.stroke(); context.globalAlpha = 0.2; @@ -161,7 +160,6 @@ context.bezierCurveTo( x + 6.0, y + 7.7, x + 8.0, y + 5.5, x + 8.0, y + 3.5 ); context.bezierCurveTo( x + 8.0, y + 3.5, x + 8.0, y, x + 5.0, y ); context.bezierCurveTo( x + 3.5, y, x + 2.5, y + 2.5, x + 2.5, y + 2.5 ); - context.closePath(); context.fill(); context.lineWidth = 0.5; //0.05 context.stroke(); diff --git a/examples/css3d_molecules.html b/examples/css3d_molecules.html index 9d17acbf08..dd4df1ef54 100644 --- a/examples/css3d_molecules.html +++ b/examples/css3d_molecules.html @@ -19,7 +19,6 @@ background: -o-radial-gradient(center, ellipse cover, rgba(43,45,48,1) 0%,rgba(0,0,0,1) 100%); /* Opera 12+ */ background: -ms-radial-gradient(center, ellipse cover, rgba(43,45,48,1) 0%,rgba(0,0,0,1) 100%); /* IE10+ */ background: radial-gradient(ellipse at center, rgba(43,45,48,1) 0%,rgba(0,0,0,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2b2d30', endColorstr='#000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ margin: 0; font-family: Arial; @@ -115,24 +114,24 @@ var visualizationType = 2; var MOLECULES = { - "Ethanol" :"ethanol.pdb", - "Aspirin" :"aspirin.pdb", - "Caffeine" :"caffeine.pdb", - "Nicotine" :"nicotine.pdb", - "LSD" :"lsd.pdb", - "Cocaine" :"cocaine.pdb", - "Cholesterol" :"cholesterol.pdb", - "Lycopene" :"lycopene.pdb", - "Glucose" : "glucose.pdb", - "Aluminium oxide":"Al2O3.pdb", - "Cubane" :"cubane.pdb", - "Copper" :"cu.pdb", - "Fluorite" :"caf2.pdb", - "Salt" :"nacl.pdb", - "YBCO superconductor":"ybco.pdb", - "Buckyball" : "buckyball.pdb", - //"Diamond" :"diamond.pdb", - "Graphite" :"graphite.pdb" + "Ethanol": "ethanol.pdb", + "Aspirin": "aspirin.pdb", + "Caffeine": "caffeine.pdb", + "Nicotine": "nicotine.pdb", + "LSD": "lsd.pdb", + "Cocaine": "cocaine.pdb", + "Cholesterol": "cholesterol.pdb", + "Lycopene": "lycopene.pdb", + "Glucose": "glucose.pdb", + "Aluminium oxide": "Al2O3.pdb", + "Cubane": "cubane.pdb", + "Copper": "cu.pdb", + "Fluorite": "caf2.pdb", + "Salt": "nacl.pdb", + "YBCO superconductor": "ybco.pdb", + "Buckyball": "buckyball.pdb", + //"Diamond": "diamond.pdb", + "Graphite": "graphite.pdb" }; var loader = new THREE.PDBLoader(); @@ -339,21 +338,8 @@ for ( var i = 0; i < objects.length; i ++ ) { var object = objects[ i ]; - object.parent.remove( object ); - if ( object.element.parentNode === renderer.cameraElement ) { - - renderer.cameraElement.removeChild( object.element ); - - } - - if ( object.userData.joint ) { - - object.userData.joint.parent.remove( object.userData.joint ); - - } - } objects = []; @@ -390,7 +376,6 @@ var object = new THREE.CSS3DSprite( atom ); object.position.copy( position ); object.position.multiplyScalar( 75 ); - object.billboard = true; object.matrixAutoUpdate = false; object.updateMatrix(); @@ -433,7 +418,7 @@ var objMatrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians ); object.matrix = objMatrix; - object.rotation.setEulerFromRotationMatrix( object.matrix, object.eulerOrder ); + object.rotation.setFromRotationMatrix( object.matrix, object.rotation.order ); object.matrixAutoUpdate = false; object.updateMatrix(); @@ -453,7 +438,7 @@ joint.position.lerp( end, 0.5 ); joint.matrix.copy( objMatrix ); - joint.rotation.setEulerFromRotationMatrix( joint.matrix, joint.eulerOrder ); + joint.rotation.setFromRotationMatrix( joint.matrix, joint.rotation.order ); joint.matrixAutoUpdate = false; joint.updateMatrix(); diff --git a/examples/css3d_periodictable.html b/examples/css3d_periodictable.html index 7f636bf945..7dbebaa5da 100644 --- a/examples/css3d_periodictable.html +++ b/examples/css3d_periodictable.html @@ -115,128 +115,129 @@ + + + + + +
+
three.js css3d - sprites.
+ + + + diff --git a/examples/css3d_youtube.html b/examples/css3d_youtube.html index 2520cb7ec7..08435f4659 100644 --- a/examples/css3d_youtube.html +++ b/examples/css3d_youtube.html @@ -55,10 +55,120 @@ + + + + + + + + + diff --git a/examples/misc_controls_transform.html b/examples/misc_controls_transform.html new file mode 100644 index 0000000000..5f0a9893ce --- /dev/null +++ b/examples/misc_controls_transform.html @@ -0,0 +1,115 @@ + + + + three.js webgl - transform controls + + + + + +
+ "W" translate | "E" rotate | "R" scale | "+" increase size | "-" decrease size
+ Press "W/E/R" twice to toggle world/local space +
+ + + + + + + + diff --git a/examples/misc_uv_tests.html b/examples/misc_uv_tests.html index f98a04cc9b..7e17af67d8 100644 --- a/examples/misc_uv_tests.html +++ b/examples/misc_uv_tests.html @@ -1,111 +1,98 @@ - - - -three.js - uv mapping tests - - - - - - - Doing UV wrap tests here! - Please wait while it loads - - - \ No newline at end of file + + + + three.js - uv mapping tests + + + + + + + diff --git a/examples/models/collada/multimaterial.dae b/examples/models/collada/multimaterial.dae new file mode 100644 index 0000000000..93a64b1c6f --- /dev/null +++ b/examples/models/collada/multimaterial.dae @@ -0,0 +1,317 @@ + + + + + Igor Campbell + Blender 2.66.1 r55078 + + 2013-04-17T12:27:39 + 2013-04-17T12:27:39 + + Z_UP + + + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0.64 0 0 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0 0 0.64 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0 0.64 0 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0.64 0.64 0 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0.64 0 0.64 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + 0 0 0 1 + + + 0 0 0 1 + + + 0 0.64 0.64 1 + + + 0.25 0.25 0.25 1 + + + 50 + + + 1 + + + + + + 1 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1 + + + + + + + + + + 1 -1.49012e-7 1.49012e-7 0 0 1 -3.57628e-7 -1 -2.08616e-7 0 0 -1 1.19209e-7 1 1.19209e-7 -1 0 0 + + + + + + + + + + + + + + + 4 +

0 0 4 0 5 0 1 0

+
+ + + + 4 +

4 1 7 1 6 1 5 1

+
+ + + + 4 +

1 2 5 2 6 2 2 2

+
+ + + + 4 +

0 3 1 3 2 3 3 3

+
+ + + + 4 +

4 4 0 4 3 4 7 4

+
+ + + + 4 +

2 5 6 5 7 5 3 5

+
+
+ 1 +
+
+ + + + + 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 + + + + + + + + + + + + + + + + + + +
diff --git a/examples/scenes/test_scene.js b/examples/scenes/test_scene.js index 5572b2c4e8..46c0cd3450 100644 --- a/examples/scenes/test_scene.js +++ b/examples/scenes/test_scene.js @@ -9,337 +9,346 @@ "objects": { - "cube1" : { - "geometry" : "cubeNormals", - "material" : "phong_red", + "group" : { "position" : [ 0, 0, 0 ], - "rotation" : [ 0, -0.3, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true, - "userData" : { - "rotating" : true, - "rotateX" : true, - "rotateY" : true - } - }, - - "cube2" : { - "geometry" : "cubeWire", - "material" : "basic_white", - "position" : [ 0, 0, 0 ], - "rotation" : [ 0, -0.3, 0 ], - "scale" : [ 2, 2, 2 ], - "visible" : true - }, - - "cube3" : { - "geometry" : "cube", - "material" : "minecraft", - "position" : [ -30, -5, 25 ], - "rotation" : [ 0, 0.8, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "sphere_lambert" : { - "geometry" : "sphere", - "material" : "lambert_green", - "position" : [ -20, -5, 15 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "sphere_refraction" : { - "geometry" : "sphere", - "material" : "basic_refraction", - "position" : [ 50, 45, -50 ], "rotation" : [ 0, 0, 0 ], "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "sphere_cube" : { - "geometry" : "sphere_uvs", - "material" : "phong_compressed_cube", - "position" : [ -30, -2, -15 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1.5, 1.5, 1.5 ], - "visible" : true - }, - - "icosahedron" : { - "geometry" : "icosahedron", - "material" : "faceted_white", - "position" : [ 20, 10, -60 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "torus" : { - "geometry" : "torus", - "material" : "phong_orange", - "position" : [ -20, 5, -50 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 2, 2, 2 ], - "visible" : true - }, - - "cone" : { - "geometry" : "cone", - "material" : "lambert_blue", - "position" : [ -50, 15, -50 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "cylinder" : { - "geometry" : "cylinder", - "material" : "lambert_blue", - "position" : [ 50, 15, -50 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "colorcube1" : { - "geometry" : "colorcube", - "material" : "face", - "position" : [ -10, -5, 30 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 5, 5, 5 ], "visible" : true, "children" : { - "colorcube2" : { + + "cube1" : { + "geometry" : "cubeNormals", + "material" : "phong_red", + "position" : [ 0, 0, 0 ], + "rotation" : [ 0, -0.3, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true, + "userData" : { + "rotating" : true, + "rotateX" : true, + "rotateY" : true + } + }, + + "cube2" : { + "geometry" : "cubeWire", + "material" : "basic_white", + "position" : [ 0, 0, 0 ], + "rotation" : [ 0, -0.3, 0 ], + "scale" : [ 2, 2, 2 ], + "visible" : true + }, + + "cube3" : { + "geometry" : "cube", + "material" : "minecraft", + "position" : [ -30, -5, 25 ], + "rotation" : [ 0, 0.8, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "sphere_lambert" : { + "geometry" : "sphere", + "material" : "lambert_green", + "position" : [ -20, -5, 15 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "sphere_refraction" : { + "geometry" : "sphere", + "material" : "basic_refraction", + "position" : [ 50, 45, -50 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "sphere_cube" : { + "geometry" : "sphere_uvs", + "material" : "phong_compressed_cube", + "position" : [ -30, -2, -15 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1.5, 1.5, 1.5 ], + "visible" : true + }, + + "icosahedron" : { + "geometry" : "icosahedron", + "material" : "faceted_white", + "position" : [ 20, 10, -60 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "torus" : { + "geometry" : "torus", + "material" : "phong_orange", + "position" : [ -20, 5, -50 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 2, 2, 2 ], + "visible" : true + }, + + "cone" : { + "geometry" : "cone", + "material" : "lambert_blue", + "position" : [ -50, 15, -50 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "cylinder" : { + "geometry" : "cylinder", + "material" : "lambert_blue", + "position" : [ 50, 15, -50 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "colorcube1" : { "geometry" : "colorcube", "material" : "face", - "position" : [ 0, 2, 0 ], - "rotation" : [ 0.1, 0.1, 0.1 ], - "scale" : [ 0.5, 0.5, 0.5 ], + "position" : [ -10, -5, 30 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 5, 5, 5 ], "visible" : true, "children" : { - "colorcube3" : { + "colorcube2" : { "geometry" : "colorcube", "material" : "face", "position" : [ 0, 2, 0 ], "rotation" : [ 0.1, 0.1, 0.1 ], - "scale" : [ 0.5, 0.5, 0.5 ], + "scale" : [ 0.5, 0.5, 0.5 ], "visible" : true, "children" : { - "colorcube4" : { + "colorcube3" : { "geometry" : "colorcube", "material" : "face", "position" : [ 0, 2, 0 ], "rotation" : [ 0.1, 0.1, 0.1 ], - "scale" : [ 0.5, 0.5, 0.5 ], - "visible" : true + "scale" : [ 0.5, 0.5, 0.5 ], + "visible" : true, + "children" : { + "colorcube4" : { + "geometry" : "colorcube", + "material" : "face", + "position" : [ 0, 2, 0 ], + "rotation" : [ 0.1, 0.1, 0.1 ], + "scale" : [ 0.5, 0.5, 0.5 ], + "visible" : true + } + } } } } } + }, + + "veyron" : { + "geometry" : "veyron", + "material" : "multi_veyron", + "position" : [ 40, -1, 0 ], + "rotation" : [ 0, 0.3, 0 ], + "scale" : [ 0.25, 0.25, 0.25 ], + "visible" : true + }, + + "walt" : { + "geometry" : "WaltHead", + "material" : "lambert_cube", + "position" : [ -75, 10, -30 ], + "rotation" : [ 0, 0.5, 0 ], + "scale" : [ 0.5, 0.5, 0.5 ], + "visible" : true + }, + + "ben" : { + "geometry" : "ben", + "material" : "phong_ben", + "position" : [ -45, -10, 0 ], + "rotation" : [ 0, 0.5, 0 ], + "scale" : [ 55, 55, 55 ], + "visible" : true + }, + + "ninja" : { + "geometry" : "NinjaLo", + "material" : "phong_normal", + "position" : [ 75, 10, -30 ], + "rotation" : [ 0, -0.5, 0 ], + "scale" : [ 1.25, 1.25, 1.25 ], + "visible" : true + }, + + "sittingBox" : { + "geometry" : "sittingBox", + "material" : "phong_morph", + "position" : [ -60, -10, 10 ], + "rotation" : [ 0, 0.5, 0 ], + "scale" : [ 23, 23, 23 ], + "visible" : true, + "morph" : true, + "duration" : 8000, + "mirroredLoop" : true + }, + + "knight" : { + "geometry" : "knight", + "material" : "phong_skin", + "position" : [ 70, -10, 10 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 2.5, 2.5, 2.5 ], + "visible" : true, + "skin" : true + }, + + "man" : { + "type": "obj", + "url" : "obj/male02/male02.obj", + "material" : "phong_man", + "position" : [ -10, -10, -25 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 0.2, 0.2, 0.2 ], + "visible" : true + }, + + "man_clone_1" : { + "geometry" : "man", + "material" : "multi_1", + "position" : [ 2.5, -10, -25 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 0.2, 0.2, 0.2 ], + "visible" : true + }, + + "man_clone_2" : { + "geometry" : "man", + "material" : "multi_2", + "position" : [ 15, -10, -25 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 0.2, 0.2, 0.2 ], + "visible" : true + }, + + "monster" : { + "type": "dae", + "url" : "models/collada/monster/monster.dae", + "position" : [ -43, -10, 27 ], + "rotation" : [ -1.57, 0, 0 ], + "scale" : [ 0.01, 0.01, 0.01 ], + "visible" : true + }, + + "hand" : { + "type" : "utf8", + "url" : "models/utf8/hand.js", + "material" : "phong_hand", + "position" : [ -28, -1, 29 ], + "rotation" : [ 0, 0.5, 0 ], + "scale" : [ 12, 12, 12 ], + "visible" : true, + "userData" : { + "rotating" : true, + "rotateY" : true + } + }, + + "bunny" : { + "geometry" : "bunny", + "material" : "phong_bunny", + "position" : [ -25, -14, 0 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 100, 100, 100 ], + "visible" : true + }, + + "disk" : { + "geometry" : "disk", + "material" : "phong_disk", + "position" : [ 7, -10, 30 ], + "rotation" : [ 1.57, 0, 0 ], + "scale" : [ 10, 10, 10 ], + "visible" : true + }, + + "quad_bg" : { + "geometry" : "quad", + "material" : "textured_bg", + "position" : [ 0, 15, -90 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 20, 20, 20 ], + "visible" : true + }, + + "quad_texture1" : { + "geometry" : "quad", + "material" : "textured_compressed_dxt3", + "position" : [ 15, -5, 20 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "quad_texture2" : { + "geometry" : "quad", + "material" : "textured_compressed_dxt5", + "position" : [ 15, -5, 25 ], + "rotation" : [ 0, 0, 0 ], + "scale" : [ 1, 1, 1 ], + "visible" : true + }, + + "ground" : { + "geometry" : "plane", + "material" : "basic_gray", + "position" : [ 0, -10, 0 ], + "rotation" : [ -1.57, 0, 0 ], + "scale" : [ 100, 100, 100 ], + "visible" : true + }, + + "light1": { + "type" : "DirectionalLight", + "direction" : [ 0, 1, 1 ], + "color" : 16777215, + "intensity" : 1 + }, + + "light2": { + "type" : "PointLight", + "position": [ 0, 0, 0 ], + "color" : 16777215, + "intensity" : 1.25 + }, + + "camera1": { + "type" : "PerspectiveCamera", + "fov" : 50, + "aspect": 1.33333, + "near" : 1, + "far" : 1000, + "position": [ 0, 0, 100 ], + "target" : [ 0, 0, 0 ] + }, + + "camera2": { + "type" : "OrthographicCamera", + "left" : 0, + "right" : 1024, + "top" : 0, + "bottom": 1024, + "near" : 1, + "far" : 1000, + "position": [ 0, 0, 0 ], + "target" : [ 0, 0, 0 ] } } - }, - - "veyron" : { - "geometry" : "veyron", - "material" : "multi_veyron", - "position" : [ 40, -1, 0 ], - "rotation" : [ 0, 0.3, 0 ], - "scale" : [ 0.25, 0.25, 0.25 ], - "visible" : true - }, - - "walt" : { - "geometry" : "WaltHead", - "material" : "lambert_cube", - "position" : [ -75, 10, -30 ], - "rotation" : [ 0, 0.5, 0 ], - "scale" : [ 0.5, 0.5, 0.5 ], - "visible" : true - }, - - "ben" : { - "geometry" : "ben", - "material" : "phong_ben", - "position" : [ -45, -10, 0 ], - "rotation" : [ 0, 0.5, 0 ], - "scale" : [ 55, 55, 55 ], - "visible" : true - }, - - "ninja" : { - "geometry" : "NinjaLo", - "material" : "phong_normal", - "position" : [ 75, 10, -30 ], - "rotation" : [ 0, -0.5, 0 ], - "scale" : [ 1.25, 1.25, 1.25 ], - "visible" : true - }, - - "sittingBox" : { - "geometry" : "sittingBox", - "material" : "phong_morph", - "position" : [ -60, -10, 10 ], - "rotation" : [ 0, 0.5, 0 ], - "scale" : [ 23, 23, 23 ], - "visible" : true, - "morph" : true, - "duration" : 8000, - "mirroredLoop" : true - }, - - "knight" : { - "geometry" : "knight", - "material" : "phong_skin", - "position" : [ 70, -10, 10 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 2.5, 2.5, 2.5 ], - "visible" : true, - "skin" : true - }, - - "man" : { - "type": "obj", - "url" : "obj/male02/male02.obj", - "material" : "phong_man", - "position" : [ -10, -10, -25 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 0.2, 0.2, 0.2 ], - "visible" : true - }, - - "man_clone_1" : { - "geometry" : "man", - "material" : "multi_1", - "position" : [ 2.5, -10, -25 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 0.2, 0.2, 0.2 ], - "visible" : true - }, - - "man_clone_2" : { - "geometry" : "man", - "material" : "multi_2", - "position" : [ 15, -10, -25 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 0.2, 0.2, 0.2 ], - "visible" : true - }, - - "monster" : { - "type": "dae", - "url" : "models/collada/monster/monster.dae", - "position" : [ -43, -10, 27 ], - "rotation" : [ -1.57, 0, 0 ], - "scale" : [ 0.01, 0.01, 0.01 ], - "visible" : true - }, - - "hand" : { - "type" : "utf8", - "url" : "models/utf8/hand.js", - "material" : "phong_hand", - "position" : [ -28, -1, 29 ], - "rotation" : [ 0, 0.5, 0 ], - "scale" : [ 12, 12, 12 ], - "visible" : true, - "userData" : { - "rotating" : true, - "rotateY" : true - } - }, - - "bunny" : { - "geometry" : "bunny", - "material" : "phong_bunny", - "position" : [ -25, -14, 0 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 100, 100, 100 ], - "visible" : true - }, - - "disk" : { - "geometry" : "disk", - "material" : "phong_disk", - "position" : [ 7, -10, 30 ], - "rotation" : [ 1.57, 0, 0 ], - "scale" : [ 10, 10, 10 ], - "visible" : true - }, - - "quad_bg" : { - "geometry" : "quad", - "material" : "textured_bg", - "position" : [ 0, 15, -90 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 20, 20, 20 ], - "visible" : true - }, - - "quad_texture1" : { - "geometry" : "quad", - "material" : "textured_compressed_dxt3", - "position" : [ 15, -5, 20 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "quad_texture2" : { - "geometry" : "quad", - "material" : "textured_compressed_dxt5", - "position" : [ 15, -5, 25 ], - "rotation" : [ 0, 0, 0 ], - "scale" : [ 1, 1, 1 ], - "visible" : true - }, - - "ground" : { - "geometry" : "plane", - "material" : "basic_gray", - "position" : [ 0, -10, 0 ], - "rotation" : [ -1.57, 0, 0 ], - "scale" : [ 100, 100, 100 ], - "visible" : true - }, - - "light1": { - "type" : "DirectionalLight", - "direction" : [ 0, 1, 1 ], - "color" : 16777215, - "intensity" : 1 - }, - - "light2": { - "type" : "PointLight", - "position": [ 0, 0, 0 ], - "color" : 16777215, - "intensity" : 1.25 - }, - - "camera1": { - "type" : "PerspectiveCamera", - "fov" : 50, - "aspect": 1.33333, - "near" : 1, - "far" : 1000, - "position": [ 0, 0, 100 ], - "target" : [ 0, 0, 0 ] - }, - - "camera2": { - "type" : "OrthographicCamera", - "left" : 0, - "right" : 1024, - "top" : 0, - "bottom": 1024, - "near" : 1, - "far" : 1000, - "position": [ 0, 0, 0 ], - "target" : [ 0, 0, 0 ] } }, @@ -393,27 +402,27 @@ }, "sphere": { - "type" : "sphere", + "type" : "sphere", "radius" : 5, "widthSegments" : 32, "heightSegments" : 16 }, "sphere_uvs": { - "type" : "sphere", + "type" : "sphere", "radius" : 5, "widthSegments" : 32, "heightSegments" : 16 }, "icosahedron": { - "type" : "icosahedron", + "type" : "icosahedron", "radius" : 20, "subdivisions" : 2 }, "torus": { - "type" : "torus", + "type" : "torus", "radius" : 5, "tube" : 2, "segmentsR" : 16, @@ -421,7 +430,7 @@ }, "cylinder": { - "type" : "cylinder", + "type" : "cylinder", "topRad" : 5, "botRad" : 5, "height" : 50, @@ -430,7 +439,7 @@ }, "cone": { - "type" : "cylinder", + "type" : "cylinder", "topRad" : 0, "botRad" : 5, "height" : 50, diff --git a/examples/textures/sprite.png b/examples/textures/sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..8159c9a348ddea927e179742175b697bfcf3f140 GIT binary patch literal 18971 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 literal 0 HcmV?d00001 diff --git a/examples/webgl3_performance.html b/examples/webgl3_performance.html index 595ce52809..6fc18f853d 100644 --- a/examples/webgl3_performance.html +++ b/examples/webgl3_performance.html @@ -18,10 +18,11 @@ + + diff --git a/examples/webgl_geometry_extrude_shapes.html b/examples/webgl_geometry_extrude_shapes.html index 8a89c4927a..acf7486994 100644 --- a/examples/webgl_geometry_extrude_shapes.html +++ b/examples/webgl_geometry_extrude_shapes.html @@ -19,9 +19,6 @@ - - - diff --git a/examples/webgl_geometry_extrude_splines.html b/examples/webgl_geometry_extrude_splines.html index 755e16babd..80e525fca6 100644 --- a/examples/webgl_geometry_extrude_splines.html +++ b/examples/webgl_geometry_extrude_splines.html @@ -16,9 +16,11 @@ + @@ -380,7 +382,7 @@ if (!lookAhead) lookAt.copy( pos ).add( dir ); splineCamera.matrix.lookAt(splineCamera.position, lookAt, normal); - splineCamera.rotation.setEulerFromRotationMatrix( splineCamera.matrix, splineCamera.eulerOrder ); + splineCamera.rotation.setFromRotationMatrix( splineCamera.matrix, splineCamera.rotation.order ); cameraHelper.update(); diff --git a/examples/webgl_geometry_minecraft_ao.html b/examples/webgl_geometry_minecraft_ao.html index 516111584a..03ee91c1cc 100644 --- a/examples/webgl_geometry_minecraft_ao.html +++ b/examples/webgl_geometry_minecraft_ao.html @@ -123,6 +123,14 @@ pyGeometry.applyMatrix( matrix.makeRotationX( - Math.PI / 2 ) ); pyGeometry.applyMatrix( matrix.makeTranslation( 0, 50, 0 ) ); + var py2Geometry = new THREE.PlaneGeometry( 100, 100 ); + py2Geometry.faces[ 0 ].vertexColors = [ light, light, light, light ]; + py2Geometry.faceVertexUvs[ 0 ][ 0 ][ 1 ].y = 0.5; + py2Geometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5; + py2Geometry.applyMatrix( matrix.makeRotationX( - Math.PI / 2 ) ); + py2Geometry.applyMatrix( matrix.makeRotationY( Math.PI / 2 ) ); + py2Geometry.applyMatrix( matrix.makeTranslation( 0, 50, 0 ) ); + var pzGeometry = new THREE.PlaneGeometry( 100, 100 ); pzGeometry.faces[ 0 ].vertexColors = [ light, shadow, shadow, light ]; pzGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5; @@ -161,13 +169,32 @@ var pxnz = getY( x + 1, z - 1 ); var nxnz = getY( x - 1, z - 1 ); - dummy.geometry = pyGeometry; + var a = nx > h || nz > h || nxnz > h ? 0 : 1; + var b = nx > h || pz > h || nxpz > h ? 0 : 1; + var c = px > h || pz > h || pxpz > h ? 0 : 1; + var d = px > h || nz > h || pxnz > h ? 0 : 1; + + if ( a + c > b + d ) { + + dummy.geometry = py2Geometry; + + var colors = dummy.geometry.faces[ 0 ].vertexColors; + colors[ 3 ] = a === 0 ? shadow : light; + colors[ 0 ] = b === 0 ? shadow : light; + colors[ 1 ] = c === 0 ? shadow : light; + colors[ 2 ] = d === 0 ? shadow : light; + + } else { + + dummy.geometry = pyGeometry; - var colors = dummy.geometry.faces[ 0 ].vertexColors; - colors[ 0 ] = nx > h || nz > h || nxnz > h ? shadow : light; - colors[ 1 ] = nx > h || pz > h || nxpz > h ? shadow : light; - colors[ 2 ] = px > h || pz > h || pxpz > h ? shadow : light; - colors[ 3 ] = px > h || nz > h || pxnz > h ? shadow : light; + var colors = dummy.geometry.faces[ 0 ].vertexColors; + colors[ 0 ] = a === 0 ? shadow : light; + colors[ 1 ] = b === 0 ? shadow : light; + colors[ 2 ] = c === 0 ? shadow : light; + colors[ 3 ] = d === 0 ? shadow : light; + + } THREE.GeometryUtils.merge( geometry, dummy ); diff --git a/examples/webgl_geometry_normals.html b/examples/webgl_geometry_normals.html index 910fe1f602..de902e5dc1 100644 --- a/examples/webgl_geometry_normals.html +++ b/examples/webgl_geometry_normals.html @@ -16,6 +16,7 @@ + @@ -23,20 +24,10 @@ var container, stats; - var camera, scene, renderer; + var camera, controls, scene, renderer; var cube, plane; - var targetYRotation = targetXRotation = 0; - var targetYRotationOnMouseDown = targetXRotationOnMouseDown = 0; - - var mouseX = 0, mouseY = 0; - var mouseXOnMouseDown = 0; - - var windowHalfX = window.innerWidth / 2; - var windowHalfY = window.innerHeight / 2; - - // Create new object by parameters var createSomething = function( klass, args ) { @@ -290,6 +281,8 @@ camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 ); camera.position.z = 500; + controls = new THREE.OrbitControls( camera ); + scene = new THREE.Scene(); var light = new THREE.PointLight( 0xffffff, 1.5 ); @@ -308,10 +301,6 @@ stats.domElement.style.top = '0px'; container.appendChild( stats.domElement ); - document.addEventListener( 'mousedown', onDocumentMouseDown, false ); - document.addEventListener( 'touchstart', onDocumentTouchStart, false ); - document.addEventListener( 'touchmove', onDocumentTouchMove, false ); - // window.addEventListener( 'resize', onWindowResize, false ); @@ -320,9 +309,6 @@ function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); @@ -332,75 +318,12 @@ // - function onDocumentMouseDown( event ) { - - //event.preventDefault(); - - document.addEventListener( 'mousemove', onDocumentMouseMove, false ); - document.addEventListener( 'mouseup', onDocumentMouseUp, false ); - document.addEventListener( 'mouseout', onDocumentMouseOut, false ); - - mouseXOnMouseDown = event.clientX - windowHalfX; - mouseYOnMouseDown = event.clientY - windowHalfY; - targetYRotationOnMouseDown = targetYRotation; - targetXRotationOnMouseDown = targetXRotation; - - } - - function onDocumentMouseMove( event ) { - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; - - targetYRotation = targetYRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02; - targetXRotation = targetXRotationOnMouseDown + ( mouseY - mouseYOnMouseDown ) * 0.02; - - } - - function onDocumentMouseUp( event ) { - - document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); - document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); - document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); - } - - function onDocumentMouseOut( event ) { - - document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); - document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); - document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); - } - - function onDocumentTouchStart( event ) { - - if ( event.touches.length == 1 ) { - - event.preventDefault(); - - mouseXOnMouseDown = event.touches[ 0 ].pageX - windowHalfX; - targetRotationOnMouseDown = targetRotation; - - } - } - - function onDocumentTouchMove( event ) { - - if ( event.touches.length == 1 ) { - - event.preventDefault(); - - mouseX = event.touches[ 0 ].pageX - windowHalfX; - targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.05; - - } - } - - // - function animate() { requestAnimationFrame( animate ); + controls.update(); + render(); stats.update(); @@ -408,9 +331,6 @@ function render() { - group.rotation.x = ( targetXRotation) * 0.15; - group.rotation.y = ( targetYRotation ) * 0.15; - renderer.render( scene, camera ); } diff --git a/examples/webgl_geometry_nurbs.html b/examples/webgl_geometry_nurbs.html new file mode 100644 index 0000000000..60a16c48c5 --- /dev/null +++ b/examples/webgl_geometry_nurbs.html @@ -0,0 +1,290 @@ + + + + + three.js webgl - geometry - NURBS + + + + + + + +
three.js - NURBS curve and surface example
+ + + + + + + + + + + + diff --git a/examples/webgl_geometry_subdivision.html b/examples/webgl_geometry_subdivision.html index 627ebd17e9..d3b0abce63 100644 --- a/examples/webgl_geometry_subdivision.html +++ b/examples/webgl_geometry_subdivision.html @@ -16,9 +16,8 @@ - + - @@ -27,20 +26,10 @@ var container, stats; - var camera, scene, renderer; + var camera, controls, scene, renderer; var cube, plane; - var targetYRotation = targetXRotation = 0; - var targetYRotationOnMouseDown = targetXRotationOnMouseDown = 0; - - var mouseX = 0, mouseY = 0; - var mouseXOnMouseDown = 0; - - var windowHalfX = window.innerWidth / 2; - var windowHalfY = window.innerHeight / 2; - - // Create new object by parameters var createSomething = function( klass, args ) { @@ -251,67 +240,12 @@ } - group = new THREE.Object3D(); - group.add( new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xfefefe, wireframe: true, opacity: 0.5 } ) ) ); scene.add( group ); - - var debugNewPoints = false; - var debugOldPoints = false; - - // Debug new Points - - if (debugNewPoints) { - var PI2 = Math.PI * 2; - var program = function ( context ) { - - context.beginPath(); - context.arc( 0, 0, 1, 0, PI2, true ); - context.closePath(); - context.fill(); - - } - - for ( var i = 0; i < smooth.vertices.length; i++ ) { - - particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: program } ) ); - particle.position = smooth.vertices[ i ]; - var pos = smooth.vertices.position - particle.scale.x = particle.scale.y = 5; - group.add( particle ); - } - - } - - - //Debug original points - - if (debugOldPoints) { - - var drawText = function(i) { - - return function ( context ) { - - context.beginPath(); - context.scale(0.1,-0.1); - - context.fillText(i, 0,0); - - }; - - } - - for ( var i = 0; i < geometry.vertices.length; i++ ) { - - particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: drawText(i) } ) ); - particle.position = smooth.vertices[ i ]; - var pos = geometry.vertices.position - particle.scale.x = particle.scale.y = 30; - group.add( particle ); - } - } - + var material = new THREE.MeshBasicMaterial( { color: 0xfefefe, wireframe: true, opacity: 0.5 } ); + var mesh = new THREE.Mesh( geometry, material ) + group.add( mesh ); var meshmaterials = [ new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ), @@ -348,6 +282,8 @@ camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 ); camera.position.z = 500; + controls = new THREE.OrbitControls( camera ); + scene = new THREE.Scene(); var light = new THREE.PointLight( 0xffffff, 1.5 ); @@ -366,10 +302,6 @@ stats.domElement.style.top = '0px'; container.appendChild( stats.domElement ); - document.addEventListener( 'mousedown', onDocumentMouseDown, false ); - document.addEventListener( 'touchstart', onDocumentTouchStart, false ); - document.addEventListener( 'touchmove', onDocumentTouchMove, false ); - // window.addEventListener( 'resize', onWindowResize, false ); @@ -378,9 +310,6 @@ function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); @@ -390,75 +319,12 @@ // - function onDocumentMouseDown( event ) { - - //event.preventDefault(); - - document.addEventListener( 'mousemove', onDocumentMouseMove, false ); - document.addEventListener( 'mouseup', onDocumentMouseUp, false ); - document.addEventListener( 'mouseout', onDocumentMouseOut, false ); - - mouseXOnMouseDown = event.clientX - windowHalfX; - mouseYOnMouseDown = event.clientY - windowHalfY; - targetYRotationOnMouseDown = targetYRotation; - targetXRotationOnMouseDown = targetXRotation; - - } - - function onDocumentMouseMove( event ) { - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; - - targetYRotation = targetYRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02; - targetXRotation = targetXRotationOnMouseDown + ( mouseY - mouseYOnMouseDown ) * 0.02; - - } - - function onDocumentMouseUp( event ) { - - document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); - document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); - document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); - } - - function onDocumentMouseOut( event ) { - - document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); - document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); - document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); - } - - function onDocumentTouchStart( event ) { - - if ( event.touches.length == 1 ) { - - event.preventDefault(); - - mouseXOnMouseDown = event.touches[ 0 ].pageX - windowHalfX; - targetRotationOnMouseDown = targetRotation; - - } - } - - function onDocumentTouchMove( event ) { - - if ( event.touches.length == 1 ) { - - event.preventDefault(); - - mouseX = event.touches[ 0 ].pageX - windowHalfX; - targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.05; - - } - } - - // - function animate() { requestAnimationFrame( animate ); + controls.update(); + render(); stats.update(); @@ -466,9 +332,6 @@ function render() { - group.rotation.x = cube.rotation.x += ( targetXRotation - cube.rotation.x ) * 0.05; - group.rotation.y = cube.rotation.y += ( targetYRotation - cube.rotation.y ) * 0.05; - renderer.render( scene, camera ); } diff --git a/examples/webgl_geometry_terrain_raycast.html b/examples/webgl_geometry_terrain_raycast.html new file mode 100644 index 0000000000..5c2892a2fc --- /dev/null +++ b/examples/webgl_geometry_terrain_raycast.html @@ -0,0 +1,292 @@ + + + + three.js webgl - geometry - terrain + + + + + + +





Generating world...
+
three.js - webgl terrain raycasting demo
+ + + + + + + + + + + + + diff --git a/examples/webgl_helpers.html b/examples/webgl_helpers.html new file mode 100644 index 0000000000..ac59b7601b --- /dev/null +++ b/examples/webgl_helpers.html @@ -0,0 +1,108 @@ + + + + three.js webgl - helpers + + + + + + + + + + + diff --git a/examples/webgl_loader_obj.html b/examples/webgl_loader_obj.html index ac64c25f67..4d08042a64 100644 --- a/examples/webgl_loader_obj.html +++ b/examples/webgl_loader_obj.html @@ -68,28 +68,32 @@ scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffeedd ); - directionalLight.position.set( 0, 0, 1 ).normalize(); + directionalLight.position.set( 0, 0, 1 ); scene.add( directionalLight ); // texture + var manager = new THREE.LoadingManager(); + manager.onProgress = function ( item, loaded, total ) { + + console.log( item, loaded, total ); + + }; + var texture = new THREE.Texture(); - var loader = new THREE.ImageLoader(); - loader.addEventListener( 'load', function ( event ) { + var loader = new THREE.ImageLoader( manager ); + loader.load( 'textures/ash_uvgrid01.jpg', function ( image ) { - texture.image = event.content; + texture.image = image; texture.needsUpdate = true; } ); - loader.load( 'textures/ash_uvgrid01.jpg' ); // model - var loader = new THREE.OBJLoader(); - loader.addEventListener( 'load', function ( event ) { - - var object = event.content; + var loader = new THREE.OBJLoader( manager ); + loader.load( 'obj/male02/male02.obj', function ( object ) { object.traverse( function ( child ) { @@ -104,8 +108,7 @@ object.position.y = - 80; scene.add( object ); - }); - loader.load( 'obj/male02/male02.obj' ); + } ); // diff --git a/examples/webgl_loader_scene.html b/examples/webgl_loader_scene.html index 161b848f74..d075419ba2 100644 --- a/examples/webgl_loader_scene.html +++ b/examples/webgl_loader_scene.html @@ -188,6 +188,12 @@ document.addEventListener( 'mousemove', onDocumentMouseMove, false ); + THREE.DefaultLoadingManager.onProgress = function ( item, loaded, total ) { + + console.log( item, loaded, total ); + + }; + init(); animate(); diff --git a/examples/webgl_marching_cubes.html b/examples/webgl_marching_cubes.html index 66b93cec59..af0ca2a286 100644 --- a/examples/webgl_marching_cubes.html +++ b/examples/webgl_marching_cubes.html @@ -1,4 +1,4 @@ - + three.js webgl - marching cubes diff --git a/examples/webgl_materials_grass.html b/examples/webgl_materials_grass.html index 517897c6db..75362c9364 100644 --- a/examples/webgl_materials_grass.html +++ b/examples/webgl_materials_grass.html @@ -88,7 +88,6 @@ context.fillStyle = 'rgba(0,' + Math.floor( Math.random() * 64 + 32 ) + ',16,1)'; context.beginPath(); context.arc( Math.random() * canvas.width, Math.random() * canvas.height, Math.random() * 1 + 0.5, 0, Math.PI * 2, true ); - context.closePath(); context.fill(); } diff --git a/examples/webgl_multiple_canvases_circle.html b/examples/webgl_multiple_canvases_circle.html index aa0a6de52b..56436b2c08 100644 --- a/examples/webgl_multiple_canvases_circle.html +++ b/examples/webgl_multiple_canvases_circle.html @@ -203,7 +203,7 @@ container = document.getElementById( containerId ); camera = new THREE.PerspectiveCamera( 20, container.clientWidth / container.clientHeight, 1, 20000 ); - camera.rotation.setY( rotateY ); + camera.rotation.y = rotateY; // Think of the virtual camera as a post with 5 cameras on it (even though those cameras happen to live in difference scenes) // You need to move the post (ie, the virtualCamera) to move all 5 cameras together. diff --git a/examples/webgl_multiple_windows.html b/examples/webgl_multiple_windows.html new file mode 100644 index 0000000000..20dfd5e6b1 --- /dev/null +++ b/examples/webgl_multiple_windows.html @@ -0,0 +1,732 @@ + + + + three.js webgl - multiple windows + + + + + + +
+
three.js - multiple windows - webgl
+
Click for new Window
+ + + + + + + + diff --git a/examples/webgl_octree.html b/examples/webgl_octree.html new file mode 100644 index 0000000000..a3b905d29b --- /dev/null +++ b/examples/webgl_octree.html @@ -0,0 +1,239 @@ + + + + three.js webgl - octree + + + + + + + + + + + diff --git a/examples/webgl_particles_shapes.html b/examples/webgl_particles_shapes.html index 2df1465db1..b1966c8f07 100644 --- a/examples/webgl_particles_shapes.html +++ b/examples/webgl_particles_shapes.html @@ -305,11 +305,9 @@ // context.bezierCurveTo( x + 6.0, y + 7.7, x + 8.0, y + 5.5, x + 8.0, y + 3.5 ); // context.bezierCurveTo( x + 8.0, y + 3.5, x + 8.0, y, x + 5.0, y ); // context.bezierCurveTo( x + 3.5, y, x + 2.5, y + 2.5, x + 2.5, y + 2.5 ); - // context.closePath(); context.beginPath(); context.arc( 64, 64, 60, 0, Math.PI * 2, false) ; - context.closePath(); context.lineWidth = 0.5; //0.05 context.stroke(); diff --git a/examples/webgl_performance.html b/examples/webgl_performance.html index 7dfb597a1f..c50c14e0b1 100644 --- a/examples/webgl_performance.html +++ b/examples/webgl_performance.html @@ -17,7 +17,6 @@ -
-

three.js r58

+

three.js r59

download

-- GitLab