opal-js_wrap-three 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/lib/opal/js_wrap/three/version.rb +1 -1
- data/lib-opal/js_wrap/three/WebGL.js +102 -0
- data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
- data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
- data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
- data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
- data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
- data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
- data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
- data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
- data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
- data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
- data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
- data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
- data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
- data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
- data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
- data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
- data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
- data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
- data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
- data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
- data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
- data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
- data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
- data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
- data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
- data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
- data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
- data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
- data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
- data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
- data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
- data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
- data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
- data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
- data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
- data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
- data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
- data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
- data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
- data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
- data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
- data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
- data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
- data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
- data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
- data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
- data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
- data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
- data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
- data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
- data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
- data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
- data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
- data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
- data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
- data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
- data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
- data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
- data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
- data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
- data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
- data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
- data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
- data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
- data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
- data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
- data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
- data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
- data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
- data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
- data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
- data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
- data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
- data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
- data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
- data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
- data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
- data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
- data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
- data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
- data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
- data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
- data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
- data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
- data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
- data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
- data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
- data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
- data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
- data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
- data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
- data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
- data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
- data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
- data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
- data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
- data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
- data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
- data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
- data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
- data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
- data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
- data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
- data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
- data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
- data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
- data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
- data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
- data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
- data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
- data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
- data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
- data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
- data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
- data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
- data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
- data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
- data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
- data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
- data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
- data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
- data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
- data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
- data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
- data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
- data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
- data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
- data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
- data/lib-opal/js_wrap/three/math/Lut.js +170 -0
- data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
- data/lib-opal/js_wrap/three/math/OBB.js +345 -0
- data/lib-opal/js_wrap/three/math/Octree.js +409 -0
- data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
- data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
- data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
- data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
- data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
- data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
- data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
- data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
- data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
- data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
- data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
- data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
- data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
- data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
- data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
- data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
- data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
- data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
- data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
- data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
- data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
- data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
- data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
- data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
- data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
- data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
- data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
- data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
- data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
- data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
- data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
- data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
- data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
- data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
- data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
- data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
- data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
- data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
- data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
- data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
- data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
- data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
- data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
- data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
- data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
- data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
- data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
- data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
- data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
- data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
- data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
- data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
- data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
- data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
- data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
- data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
- data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
- data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
- data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
- data/lib-opal/js_wrap/three/objects/Water.js +246 -0
- data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
- data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
- data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
- data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
- data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
- data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
- data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
- data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
- data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
- data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
- data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
- data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
- data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
- data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
- data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
- data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
- data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
- data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
- data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
- data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
- data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
- data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
- data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
- data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
- data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
- data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
- data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
- data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
- data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
- data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
- data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
- data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
- data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
- data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
- data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
- data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
- data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
- data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
- data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
- data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
- data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
- data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
- data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
- data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
- data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
- data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
- data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
- data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
- data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
- data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
- data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
- data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
- data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
- data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
- data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
- data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
- data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
- data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
- data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
- data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
- data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
- data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
- data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
- data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
- data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
- data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
- data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
- data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
- data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
- data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
- data/opal-js_wrap-three.gemspec +4 -4
- metadata +502 -5
@@ -0,0 +1,860 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three);
|
11
|
+
global.CameraControls = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.TrackballControls = _exports.OrbitControls = _exports.MapControls = _exports.CameraControls = void 0;
|
20
|
+
|
21
|
+
var CameraControls = function CameraControls(object, domElement) {
|
22
|
+
if (domElement === undefined) console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.');
|
23
|
+
if (domElement === document) console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
|
24
|
+
this.object = object;
|
25
|
+
this.domElement = domElement; // Set to false to disable this control
|
26
|
+
|
27
|
+
this.enabled = true; // "target" sets the location of focus, where the object orbits around
|
28
|
+
|
29
|
+
this.target = new _three.Vector3(); // Set to true to enable trackball behavior
|
30
|
+
|
31
|
+
this.trackball = false; // How far you can dolly in and out ( PerspectiveCamera only )
|
32
|
+
|
33
|
+
this.minDistance = 0;
|
34
|
+
this.maxDistance = Infinity; // How far you can zoom in and out ( OrthographicCamera only )
|
35
|
+
|
36
|
+
this.minZoom = 0;
|
37
|
+
this.maxZoom = Infinity; // How far you can orbit vertically, upper and lower limits.
|
38
|
+
// Range is 0 to Math.PI radians.
|
39
|
+
|
40
|
+
this.minPolarAngle = 0; // radians
|
41
|
+
|
42
|
+
this.maxPolarAngle = Math.PI; // radians
|
43
|
+
// How far you can orbit horizontally, upper and lower limits.
|
44
|
+
// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
|
45
|
+
|
46
|
+
this.minAzimuthAngle = -Infinity; // radians
|
47
|
+
|
48
|
+
this.maxAzimuthAngle = Infinity; // radians
|
49
|
+
// Set to true to enable damping (inertia)
|
50
|
+
// If damping is enabled, you must call controls.update() in your animation loop
|
51
|
+
|
52
|
+
this.enableDamping = false;
|
53
|
+
this.dampingFactor = 0.05; // This option enables dollying in and out; property named as "zoom" for backwards compatibility
|
54
|
+
// Set to false to disable zooming
|
55
|
+
|
56
|
+
this.enableZoom = true;
|
57
|
+
this.zoomSpeed = 1.0; // Set to false to disable rotating
|
58
|
+
|
59
|
+
this.enableRotate = true;
|
60
|
+
this.rotateSpeed = 1.0; // Set to false to disable panning
|
61
|
+
|
62
|
+
this.enablePan = true;
|
63
|
+
this.panSpeed = 1.0;
|
64
|
+
this.screenSpacePanning = false; // if true, pan in screen-space
|
65
|
+
|
66
|
+
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
67
|
+
// Set to true to automatically rotate around the target
|
68
|
+
// If auto-rotate is enabled, you must call controls.update() in your animation loop
|
69
|
+
// auto-rotate is not supported for trackball behavior
|
70
|
+
|
71
|
+
this.autoRotate = false;
|
72
|
+
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
|
73
|
+
// Set to false to disable use of the keys
|
74
|
+
|
75
|
+
this.enableKeys = true; // The four arrow keys
|
76
|
+
|
77
|
+
this.keys = {
|
78
|
+
LEFT: 37,
|
79
|
+
UP: 38,
|
80
|
+
RIGHT: 39,
|
81
|
+
BOTTOM: 40
|
82
|
+
}; // Mouse buttons
|
83
|
+
|
84
|
+
this.mouseButtons = {
|
85
|
+
LEFT: _three.MOUSE.ROTATE,
|
86
|
+
MIDDLE: _three.MOUSE.DOLLY,
|
87
|
+
RIGHT: _three.MOUSE.PAN
|
88
|
+
}; // Touch fingers
|
89
|
+
|
90
|
+
this.touches = {
|
91
|
+
ONE: _three.TOUCH.ROTATE,
|
92
|
+
TWO: _three.TOUCH.DOLLY_PAN
|
93
|
+
}; // for reset
|
94
|
+
|
95
|
+
this.target0 = this.target.clone();
|
96
|
+
this.position0 = this.object.position.clone();
|
97
|
+
this.quaternion0 = this.object.quaternion.clone();
|
98
|
+
this.zoom0 = this.object.zoom; //
|
99
|
+
// public methods
|
100
|
+
//
|
101
|
+
|
102
|
+
this.getPolarAngle = function () {
|
103
|
+
return spherical.phi;
|
104
|
+
};
|
105
|
+
|
106
|
+
this.getAzimuthalAngle = function () {
|
107
|
+
return spherical.theta;
|
108
|
+
};
|
109
|
+
|
110
|
+
this.saveState = function () {
|
111
|
+
scope.target0.copy(scope.target);
|
112
|
+
scope.position0.copy(scope.object.position);
|
113
|
+
scope.quaternion0.copy(scope.object.quaternion);
|
114
|
+
scope.zoom0 = scope.object.zoom;
|
115
|
+
};
|
116
|
+
|
117
|
+
this.reset = function () {
|
118
|
+
scope.target.copy(scope.target0);
|
119
|
+
scope.object.position.copy(scope.position0);
|
120
|
+
scope.object.quaternion.copy(scope.quaternion0);
|
121
|
+
scope.object.zoom = scope.zoom0;
|
122
|
+
scope.object.updateProjectionMatrix();
|
123
|
+
scope.dispatchEvent(changeEvent);
|
124
|
+
scope.update();
|
125
|
+
state = STATE.NONE;
|
126
|
+
}; // this method is exposed, but perhaps it would be better if we can make it private...
|
127
|
+
|
128
|
+
|
129
|
+
this.update = function () {
|
130
|
+
var offset = new _three.Vector3(); // so camera.up is the orbit axis
|
131
|
+
|
132
|
+
var quat = new _three.Quaternion().setFromUnitVectors(object.up, new _three.Vector3(0, 1, 0));
|
133
|
+
var quatInverse = quat.clone().invert();
|
134
|
+
var lastPosition = new _three.Vector3();
|
135
|
+
var lastQuaternion = new _three.Quaternion();
|
136
|
+
var q = new _three.Quaternion();
|
137
|
+
var vec = new _three.Vector3();
|
138
|
+
return function update() {
|
139
|
+
var position = scope.object.position;
|
140
|
+
offset.copy(position).sub(scope.target);
|
141
|
+
|
142
|
+
if (scope.trackball) {
|
143
|
+
// rotate around screen-space y-axis
|
144
|
+
if (sphericalDelta.theta) {
|
145
|
+
vec.set(0, 1, 0).applyQuaternion(scope.object.quaternion);
|
146
|
+
var factor = scope.enableDamping ? scope.dampingFactor : 1;
|
147
|
+
q.setFromAxisAngle(vec, sphericalDelta.theta * factor);
|
148
|
+
scope.object.quaternion.premultiply(q);
|
149
|
+
offset.applyQuaternion(q);
|
150
|
+
} // rotate around screen-space x-axis
|
151
|
+
|
152
|
+
|
153
|
+
if (sphericalDelta.phi) {
|
154
|
+
vec.set(1, 0, 0).applyQuaternion(scope.object.quaternion);
|
155
|
+
var factor = scope.enableDamping ? scope.dampingFactor : 1;
|
156
|
+
q.setFromAxisAngle(vec, sphericalDelta.phi * factor);
|
157
|
+
scope.object.quaternion.premultiply(q);
|
158
|
+
offset.applyQuaternion(q);
|
159
|
+
}
|
160
|
+
|
161
|
+
offset.multiplyScalar(scale);
|
162
|
+
offset.clampLength(scope.minDistance, scope.maxDistance);
|
163
|
+
} else {
|
164
|
+
// rotate offset to "y-axis-is-up" space
|
165
|
+
offset.applyQuaternion(quat);
|
166
|
+
|
167
|
+
if (scope.autoRotate && state === STATE.NONE) {
|
168
|
+
rotateLeft(getAutoRotationAngle());
|
169
|
+
}
|
170
|
+
|
171
|
+
spherical.setFromVector3(offset);
|
172
|
+
|
173
|
+
if (scope.enableDamping) {
|
174
|
+
spherical.theta += sphericalDelta.theta * scope.dampingFactor;
|
175
|
+
spherical.phi += sphericalDelta.phi * scope.dampingFactor;
|
176
|
+
} else {
|
177
|
+
spherical.theta += sphericalDelta.theta;
|
178
|
+
spherical.phi += sphericalDelta.phi;
|
179
|
+
} // restrict theta to be between desired limits
|
180
|
+
|
181
|
+
|
182
|
+
spherical.theta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, spherical.theta)); // restrict phi to be between desired limits
|
183
|
+
|
184
|
+
spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));
|
185
|
+
spherical.makeSafe();
|
186
|
+
spherical.radius *= scale; // restrict radius to be between desired limits
|
187
|
+
|
188
|
+
spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));
|
189
|
+
offset.setFromSpherical(spherical); // rotate offset back to "camera-up-vector-is-up" space
|
190
|
+
|
191
|
+
offset.applyQuaternion(quatInverse);
|
192
|
+
} // move target to panned location
|
193
|
+
|
194
|
+
|
195
|
+
if (scope.enableDamping === true) {
|
196
|
+
scope.target.addScaledVector(panOffset, scope.dampingFactor);
|
197
|
+
} else {
|
198
|
+
scope.target.add(panOffset);
|
199
|
+
}
|
200
|
+
|
201
|
+
position.copy(scope.target).add(offset);
|
202
|
+
|
203
|
+
if (scope.trackball === false) {
|
204
|
+
scope.object.lookAt(scope.target);
|
205
|
+
}
|
206
|
+
|
207
|
+
if (scope.enableDamping === true) {
|
208
|
+
sphericalDelta.theta *= 1 - scope.dampingFactor;
|
209
|
+
sphericalDelta.phi *= 1 - scope.dampingFactor;
|
210
|
+
panOffset.multiplyScalar(1 - scope.dampingFactor);
|
211
|
+
} else {
|
212
|
+
sphericalDelta.set(0, 0, 0);
|
213
|
+
panOffset.set(0, 0, 0);
|
214
|
+
}
|
215
|
+
|
216
|
+
scale = 1; // update condition is:
|
217
|
+
// min(camera displacement, camera rotation in radians)^2 > EPS
|
218
|
+
// using small-angle approximation cos(x/2) = 1 - x^2 / 8
|
219
|
+
|
220
|
+
if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {
|
221
|
+
scope.dispatchEvent(changeEvent);
|
222
|
+
lastPosition.copy(scope.object.position);
|
223
|
+
lastQuaternion.copy(scope.object.quaternion);
|
224
|
+
zoomChanged = false;
|
225
|
+
return true;
|
226
|
+
}
|
227
|
+
|
228
|
+
return false;
|
229
|
+
};
|
230
|
+
}();
|
231
|
+
|
232
|
+
this.dispose = function () {
|
233
|
+
scope.domElement.removeEventListener('contextmenu', onContextMenu, false);
|
234
|
+
scope.domElement.removeEventListener('mousedown', onMouseDown, false);
|
235
|
+
scope.domElement.removeEventListener('wheel', onMouseWheel, false);
|
236
|
+
scope.domElement.removeEventListener('touchstart', onTouchStart, false);
|
237
|
+
scope.domElement.removeEventListener('touchend', onTouchEnd, false);
|
238
|
+
scope.domElement.removeEventListener('touchmove', onTouchMove, false);
|
239
|
+
document.removeEventListener('mousemove', onMouseMove, false);
|
240
|
+
document.removeEventListener('mouseup', onMouseUp, false);
|
241
|
+
scope.domElement.removeEventListener('keydown', onKeyDown, false); //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
|
242
|
+
}; //
|
243
|
+
// internals
|
244
|
+
//
|
245
|
+
|
246
|
+
|
247
|
+
var scope = this;
|
248
|
+
var changeEvent = {
|
249
|
+
type: 'change'
|
250
|
+
};
|
251
|
+
var startEvent = {
|
252
|
+
type: 'start'
|
253
|
+
};
|
254
|
+
var endEvent = {
|
255
|
+
type: 'end'
|
256
|
+
};
|
257
|
+
var STATE = {
|
258
|
+
NONE: -1,
|
259
|
+
ROTATE: 0,
|
260
|
+
DOLLY: 1,
|
261
|
+
PAN: 2,
|
262
|
+
TOUCH_ROTATE: 3,
|
263
|
+
TOUCH_PAN: 4,
|
264
|
+
TOUCH_DOLLY_PAN: 5,
|
265
|
+
TOUCH_DOLLY_ROTATE: 6
|
266
|
+
};
|
267
|
+
var state = STATE.NONE;
|
268
|
+
var EPS = 0.000001; // current position in spherical coordinates
|
269
|
+
|
270
|
+
var spherical = new _three.Spherical();
|
271
|
+
var sphericalDelta = new _three.Spherical();
|
272
|
+
var scale = 1;
|
273
|
+
var panOffset = new _three.Vector3();
|
274
|
+
var zoomChanged = false;
|
275
|
+
var rotateStart = new _three.Vector2();
|
276
|
+
var rotateEnd = new _three.Vector2();
|
277
|
+
var rotateDelta = new _three.Vector2();
|
278
|
+
var panStart = new _three.Vector2();
|
279
|
+
var panEnd = new _three.Vector2();
|
280
|
+
var panDelta = new _three.Vector2();
|
281
|
+
var dollyStart = new _three.Vector2();
|
282
|
+
var dollyEnd = new _three.Vector2();
|
283
|
+
var dollyDelta = new _three.Vector2();
|
284
|
+
|
285
|
+
function getAutoRotationAngle() {
|
286
|
+
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
|
287
|
+
}
|
288
|
+
|
289
|
+
function getZoomScale() {
|
290
|
+
return Math.pow(0.95, scope.zoomSpeed);
|
291
|
+
}
|
292
|
+
|
293
|
+
function rotateLeft(angle) {
|
294
|
+
sphericalDelta.theta -= angle;
|
295
|
+
}
|
296
|
+
|
297
|
+
function rotateUp(angle) {
|
298
|
+
sphericalDelta.phi -= angle;
|
299
|
+
}
|
300
|
+
|
301
|
+
var panLeft = function () {
|
302
|
+
var v = new _three.Vector3();
|
303
|
+
return function panLeft(distance, objectMatrix) {
|
304
|
+
v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix
|
305
|
+
|
306
|
+
v.multiplyScalar(-distance);
|
307
|
+
panOffset.add(v);
|
308
|
+
};
|
309
|
+
}();
|
310
|
+
|
311
|
+
var panUp = function () {
|
312
|
+
var v = new _three.Vector3();
|
313
|
+
return function panUp(distance, objectMatrix) {
|
314
|
+
if (scope.screenSpacePanning === true) {
|
315
|
+
v.setFromMatrixColumn(objectMatrix, 1);
|
316
|
+
} else {
|
317
|
+
v.setFromMatrixColumn(objectMatrix, 0);
|
318
|
+
v.crossVectors(scope.object.up, v);
|
319
|
+
}
|
320
|
+
|
321
|
+
v.multiplyScalar(distance);
|
322
|
+
panOffset.add(v);
|
323
|
+
};
|
324
|
+
}(); // deltaX and deltaY are in pixels; right and down are positive
|
325
|
+
|
326
|
+
|
327
|
+
var pan = function () {
|
328
|
+
var offset = new _three.Vector3();
|
329
|
+
return function pan(deltaX, deltaY) {
|
330
|
+
var element = scope.domElement;
|
331
|
+
|
332
|
+
if (scope.object.isPerspectiveCamera) {
|
333
|
+
// perspective
|
334
|
+
var position = scope.object.position;
|
335
|
+
offset.copy(position).sub(scope.target);
|
336
|
+
var targetDistance = offset.length(); // half of the fov is center to top of screen
|
337
|
+
|
338
|
+
targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0); // we use only clientHeight here so aspect ratio does not distort speed
|
339
|
+
|
340
|
+
panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);
|
341
|
+
panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);
|
342
|
+
} else if (scope.object.isOrthographicCamera) {
|
343
|
+
// orthographic
|
344
|
+
panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);
|
345
|
+
panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);
|
346
|
+
} else {
|
347
|
+
// camera neither orthographic nor perspective
|
348
|
+
console.warn('WARNING: CameraControls.js encountered an unknown camera type - pan disabled.');
|
349
|
+
scope.enablePan = false;
|
350
|
+
}
|
351
|
+
};
|
352
|
+
}();
|
353
|
+
|
354
|
+
function dollyIn(dollyScale) {
|
355
|
+
if (scope.object.isPerspectiveCamera) {
|
356
|
+
scale /= dollyScale;
|
357
|
+
} else if (scope.object.isOrthographicCamera) {
|
358
|
+
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));
|
359
|
+
scope.object.updateProjectionMatrix();
|
360
|
+
zoomChanged = true;
|
361
|
+
} else {
|
362
|
+
console.warn('WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled.');
|
363
|
+
scope.enableZoom = false;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
function dollyOut(dollyScale) {
|
368
|
+
if (scope.object.isPerspectiveCamera) {
|
369
|
+
scale *= dollyScale;
|
370
|
+
} else if (scope.object.isOrthographicCamera) {
|
371
|
+
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));
|
372
|
+
scope.object.updateProjectionMatrix();
|
373
|
+
zoomChanged = true;
|
374
|
+
} else {
|
375
|
+
console.warn('WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled.');
|
376
|
+
scope.enableZoom = false;
|
377
|
+
}
|
378
|
+
} //
|
379
|
+
// event callbacks - update the object state
|
380
|
+
//
|
381
|
+
|
382
|
+
|
383
|
+
function handleMouseDownRotate(event) {
|
384
|
+
rotateStart.set(event.clientX, event.clientY);
|
385
|
+
}
|
386
|
+
|
387
|
+
function handleMouseDownDolly(event) {
|
388
|
+
dollyStart.set(event.clientX, event.clientY);
|
389
|
+
}
|
390
|
+
|
391
|
+
function handleMouseDownPan(event) {
|
392
|
+
panStart.set(event.clientX, event.clientY);
|
393
|
+
}
|
394
|
+
|
395
|
+
function handleMouseMoveRotate(event) {
|
396
|
+
rotateEnd.set(event.clientX, event.clientY);
|
397
|
+
rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);
|
398
|
+
var element = scope.domElement;
|
399
|
+
rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height
|
400
|
+
|
401
|
+
rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);
|
402
|
+
rotateStart.copy(rotateEnd);
|
403
|
+
scope.update();
|
404
|
+
}
|
405
|
+
|
406
|
+
function handleMouseMoveDolly(event) {
|
407
|
+
dollyEnd.set(event.clientX, event.clientY);
|
408
|
+
dollyDelta.subVectors(dollyEnd, dollyStart);
|
409
|
+
|
410
|
+
if (dollyDelta.y > 0) {
|
411
|
+
dollyIn(getZoomScale());
|
412
|
+
} else if (dollyDelta.y < 0) {
|
413
|
+
dollyOut(getZoomScale());
|
414
|
+
}
|
415
|
+
|
416
|
+
dollyStart.copy(dollyEnd);
|
417
|
+
scope.update();
|
418
|
+
}
|
419
|
+
|
420
|
+
function handleMouseMovePan(event) {
|
421
|
+
panEnd.set(event.clientX, event.clientY);
|
422
|
+
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
423
|
+
pan(panDelta.x, panDelta.y);
|
424
|
+
panStart.copy(panEnd);
|
425
|
+
scope.update();
|
426
|
+
}
|
427
|
+
|
428
|
+
function
|
429
|
+
/*event*/
|
430
|
+
handleMouseUp() {// no-op
|
431
|
+
}
|
432
|
+
|
433
|
+
function handleMouseWheel(event) {
|
434
|
+
if (event.deltaY < 0) {
|
435
|
+
dollyOut(getZoomScale());
|
436
|
+
} else if (event.deltaY > 0) {
|
437
|
+
dollyIn(getZoomScale());
|
438
|
+
}
|
439
|
+
|
440
|
+
scope.update();
|
441
|
+
}
|
442
|
+
|
443
|
+
function handleKeyDown(event) {
|
444
|
+
var needsUpdate = false;
|
445
|
+
|
446
|
+
switch (event.keyCode) {
|
447
|
+
case scope.keys.UP:
|
448
|
+
pan(0, scope.keyPanSpeed);
|
449
|
+
needsUpdate = true;
|
450
|
+
break;
|
451
|
+
|
452
|
+
case scope.keys.BOTTOM:
|
453
|
+
pan(0, -scope.keyPanSpeed);
|
454
|
+
needsUpdate = true;
|
455
|
+
break;
|
456
|
+
|
457
|
+
case scope.keys.LEFT:
|
458
|
+
pan(scope.keyPanSpeed, 0);
|
459
|
+
needsUpdate = true;
|
460
|
+
break;
|
461
|
+
|
462
|
+
case scope.keys.RIGHT:
|
463
|
+
pan(-scope.keyPanSpeed, 0);
|
464
|
+
needsUpdate = true;
|
465
|
+
break;
|
466
|
+
}
|
467
|
+
|
468
|
+
if (needsUpdate) {
|
469
|
+
// prevent the browser from scrolling on cursor keys
|
470
|
+
event.preventDefault();
|
471
|
+
scope.update();
|
472
|
+
}
|
473
|
+
}
|
474
|
+
|
475
|
+
function handleTouchStartRotate(event) {
|
476
|
+
if (event.touches.length == 1) {
|
477
|
+
rotateStart.set(event.touches[0].pageX, event.touches[0].pageY);
|
478
|
+
} else {
|
479
|
+
var x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);
|
480
|
+
var y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);
|
481
|
+
rotateStart.set(x, y);
|
482
|
+
}
|
483
|
+
}
|
484
|
+
|
485
|
+
function handleTouchStartPan(event) {
|
486
|
+
if (event.touches.length == 1) {
|
487
|
+
panStart.set(event.touches[0].pageX, event.touches[0].pageY);
|
488
|
+
} else {
|
489
|
+
var x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);
|
490
|
+
var y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);
|
491
|
+
panStart.set(x, y);
|
492
|
+
}
|
493
|
+
}
|
494
|
+
|
495
|
+
function handleTouchStartDolly(event) {
|
496
|
+
var dx = event.touches[0].pageX - event.touches[1].pageX;
|
497
|
+
var dy = event.touches[0].pageY - event.touches[1].pageY;
|
498
|
+
var distance = Math.sqrt(dx * dx + dy * dy);
|
499
|
+
dollyStart.set(0, distance);
|
500
|
+
}
|
501
|
+
|
502
|
+
function handleTouchStartDollyPan(event) {
|
503
|
+
if (scope.enableZoom) handleTouchStartDolly(event);
|
504
|
+
if (scope.enablePan) handleTouchStartPan(event);
|
505
|
+
}
|
506
|
+
|
507
|
+
function handleTouchStartDollyRotate(event) {
|
508
|
+
if (scope.enableZoom) handleTouchStartDolly(event);
|
509
|
+
if (scope.enableRotate) handleTouchStartRotate(event);
|
510
|
+
}
|
511
|
+
|
512
|
+
function handleTouchMoveRotate(event) {
|
513
|
+
if (event.touches.length == 1) {
|
514
|
+
rotateEnd.set(event.touches[0].pageX, event.touches[0].pageY);
|
515
|
+
} else {
|
516
|
+
var x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);
|
517
|
+
var y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);
|
518
|
+
rotateEnd.set(x, y);
|
519
|
+
}
|
520
|
+
|
521
|
+
rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);
|
522
|
+
var element = scope.domElement;
|
523
|
+
rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height
|
524
|
+
|
525
|
+
rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);
|
526
|
+
rotateStart.copy(rotateEnd);
|
527
|
+
}
|
528
|
+
|
529
|
+
function handleTouchMovePan(event) {
|
530
|
+
if (event.touches.length == 1) {
|
531
|
+
panEnd.set(event.touches[0].pageX, event.touches[0].pageY);
|
532
|
+
} else {
|
533
|
+
var x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);
|
534
|
+
var y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);
|
535
|
+
panEnd.set(x, y);
|
536
|
+
}
|
537
|
+
|
538
|
+
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
539
|
+
pan(panDelta.x, panDelta.y);
|
540
|
+
panStart.copy(panEnd);
|
541
|
+
}
|
542
|
+
|
543
|
+
function handleTouchMoveDolly(event) {
|
544
|
+
var dx = event.touches[0].pageX - event.touches[1].pageX;
|
545
|
+
var dy = event.touches[0].pageY - event.touches[1].pageY;
|
546
|
+
var distance = Math.sqrt(dx * dx + dy * dy);
|
547
|
+
dollyEnd.set(0, distance);
|
548
|
+
dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));
|
549
|
+
dollyIn(dollyDelta.y);
|
550
|
+
dollyStart.copy(dollyEnd);
|
551
|
+
}
|
552
|
+
|
553
|
+
function handleTouchMoveDollyPan(event) {
|
554
|
+
if (scope.enableZoom) handleTouchMoveDolly(event);
|
555
|
+
if (scope.enablePan) handleTouchMovePan(event);
|
556
|
+
}
|
557
|
+
|
558
|
+
function handleTouchMoveDollyRotate(event) {
|
559
|
+
if (scope.enableZoom) handleTouchMoveDolly(event);
|
560
|
+
if (scope.enableRotate) handleTouchMoveRotate(event);
|
561
|
+
}
|
562
|
+
|
563
|
+
function
|
564
|
+
/*event*/
|
565
|
+
handleTouchEnd() {// no-op
|
566
|
+
} //
|
567
|
+
// event handlers - FSM: listen for events and reset state
|
568
|
+
//
|
569
|
+
|
570
|
+
|
571
|
+
function onMouseDown(event) {
|
572
|
+
if (scope.enabled === false) return; // Prevent the browser from scrolling.
|
573
|
+
|
574
|
+
event.preventDefault(); // Manually set the focus since calling preventDefault above
|
575
|
+
// prevents the browser from setting it automatically.
|
576
|
+
|
577
|
+
scope.domElement.focus ? scope.domElement.focus() : window.focus();
|
578
|
+
var mouseAction;
|
579
|
+
|
580
|
+
switch (event.button) {
|
581
|
+
case 0:
|
582
|
+
mouseAction = scope.mouseButtons.LEFT;
|
583
|
+
break;
|
584
|
+
|
585
|
+
case 1:
|
586
|
+
mouseAction = scope.mouseButtons.MIDDLE;
|
587
|
+
break;
|
588
|
+
|
589
|
+
case 2:
|
590
|
+
mouseAction = scope.mouseButtons.RIGHT;
|
591
|
+
break;
|
592
|
+
|
593
|
+
default:
|
594
|
+
mouseAction = -1;
|
595
|
+
}
|
596
|
+
|
597
|
+
switch (mouseAction) {
|
598
|
+
case _three.MOUSE.DOLLY:
|
599
|
+
if (scope.enableZoom === false) return;
|
600
|
+
handleMouseDownDolly(event);
|
601
|
+
state = STATE.DOLLY;
|
602
|
+
break;
|
603
|
+
|
604
|
+
case _three.MOUSE.ROTATE:
|
605
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
606
|
+
if (scope.enablePan === false) return;
|
607
|
+
handleMouseDownPan(event);
|
608
|
+
state = STATE.PAN;
|
609
|
+
} else {
|
610
|
+
if (scope.enableRotate === false) return;
|
611
|
+
handleMouseDownRotate(event);
|
612
|
+
state = STATE.ROTATE;
|
613
|
+
}
|
614
|
+
|
615
|
+
break;
|
616
|
+
|
617
|
+
case _three.MOUSE.PAN:
|
618
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
619
|
+
if (scope.enableRotate === false) return;
|
620
|
+
handleMouseDownRotate(event);
|
621
|
+
state = STATE.ROTATE;
|
622
|
+
} else {
|
623
|
+
if (scope.enablePan === false) return;
|
624
|
+
handleMouseDownPan(event);
|
625
|
+
state = STATE.PAN;
|
626
|
+
}
|
627
|
+
|
628
|
+
break;
|
629
|
+
|
630
|
+
default:
|
631
|
+
state = STATE.NONE;
|
632
|
+
}
|
633
|
+
|
634
|
+
if (state !== STATE.NONE) {
|
635
|
+
document.addEventListener('mousemove', onMouseMove, false);
|
636
|
+
document.addEventListener('mouseup', onMouseUp, false);
|
637
|
+
scope.dispatchEvent(startEvent);
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
function onMouseMove(event) {
|
642
|
+
if (scope.enabled === false) return;
|
643
|
+
event.preventDefault();
|
644
|
+
|
645
|
+
switch (state) {
|
646
|
+
case STATE.ROTATE:
|
647
|
+
if (scope.enableRotate === false) return;
|
648
|
+
handleMouseMoveRotate(event);
|
649
|
+
break;
|
650
|
+
|
651
|
+
case STATE.DOLLY:
|
652
|
+
if (scope.enableZoom === false) return;
|
653
|
+
handleMouseMoveDolly(event);
|
654
|
+
break;
|
655
|
+
|
656
|
+
case STATE.PAN:
|
657
|
+
if (scope.enablePan === false) return;
|
658
|
+
handleMouseMovePan(event);
|
659
|
+
break;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
|
663
|
+
function onMouseUp(event) {
|
664
|
+
if (scope.enabled === false) return;
|
665
|
+
handleMouseUp(event);
|
666
|
+
document.removeEventListener('mousemove', onMouseMove, false);
|
667
|
+
document.removeEventListener('mouseup', onMouseUp, false);
|
668
|
+
scope.dispatchEvent(endEvent);
|
669
|
+
state = STATE.NONE;
|
670
|
+
}
|
671
|
+
|
672
|
+
function onMouseWheel(event) {
|
673
|
+
if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE && state !== STATE.ROTATE) return;
|
674
|
+
event.preventDefault();
|
675
|
+
event.stopPropagation();
|
676
|
+
scope.dispatchEvent(startEvent);
|
677
|
+
handleMouseWheel(event);
|
678
|
+
scope.dispatchEvent(endEvent);
|
679
|
+
}
|
680
|
+
|
681
|
+
function onKeyDown(event) {
|
682
|
+
if (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;
|
683
|
+
handleKeyDown(event);
|
684
|
+
}
|
685
|
+
|
686
|
+
function onTouchStart(event) {
|
687
|
+
if (scope.enabled === false) return;
|
688
|
+
event.preventDefault();
|
689
|
+
|
690
|
+
switch (event.touches.length) {
|
691
|
+
case 1:
|
692
|
+
switch (scope.touches.ONE) {
|
693
|
+
case _three.TOUCH.ROTATE:
|
694
|
+
if (scope.enableRotate === false) return;
|
695
|
+
handleTouchStartRotate(event);
|
696
|
+
state = STATE.TOUCH_ROTATE;
|
697
|
+
break;
|
698
|
+
|
699
|
+
case _three.TOUCH.PAN:
|
700
|
+
if (scope.enablePan === false) return;
|
701
|
+
handleTouchStartPan(event);
|
702
|
+
state = STATE.TOUCH_PAN;
|
703
|
+
break;
|
704
|
+
|
705
|
+
default:
|
706
|
+
state = STATE.NONE;
|
707
|
+
}
|
708
|
+
|
709
|
+
break;
|
710
|
+
|
711
|
+
case 2:
|
712
|
+
switch (scope.touches.TWO) {
|
713
|
+
case _three.TOUCH.DOLLY_PAN:
|
714
|
+
if (scope.enableZoom === false && scope.enablePan === false) return;
|
715
|
+
handleTouchStartDollyPan(event);
|
716
|
+
state = STATE.TOUCH_DOLLY_PAN;
|
717
|
+
break;
|
718
|
+
|
719
|
+
case _three.TOUCH.DOLLY_ROTATE:
|
720
|
+
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
721
|
+
handleTouchStartDollyRotate(event);
|
722
|
+
state = STATE.TOUCH_DOLLY_ROTATE;
|
723
|
+
break;
|
724
|
+
|
725
|
+
default:
|
726
|
+
state = STATE.NONE;
|
727
|
+
}
|
728
|
+
|
729
|
+
break;
|
730
|
+
|
731
|
+
default:
|
732
|
+
state = STATE.NONE;
|
733
|
+
}
|
734
|
+
|
735
|
+
if (state !== STATE.NONE) {
|
736
|
+
scope.dispatchEvent(startEvent);
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
function onTouchMove(event) {
|
741
|
+
if (scope.enabled === false) return;
|
742
|
+
event.preventDefault();
|
743
|
+
event.stopPropagation();
|
744
|
+
|
745
|
+
switch (state) {
|
746
|
+
case STATE.TOUCH_ROTATE:
|
747
|
+
if (scope.enableRotate === false) return;
|
748
|
+
handleTouchMoveRotate(event);
|
749
|
+
scope.update();
|
750
|
+
break;
|
751
|
+
|
752
|
+
case STATE.TOUCH_PAN:
|
753
|
+
if (scope.enablePan === false) return;
|
754
|
+
handleTouchMovePan(event);
|
755
|
+
scope.update();
|
756
|
+
break;
|
757
|
+
|
758
|
+
case STATE.TOUCH_DOLLY_PAN:
|
759
|
+
if (scope.enableZoom === false && scope.enablePan === false) return;
|
760
|
+
handleTouchMoveDollyPan(event);
|
761
|
+
scope.update();
|
762
|
+
break;
|
763
|
+
|
764
|
+
case STATE.TOUCH_DOLLY_ROTATE:
|
765
|
+
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
766
|
+
handleTouchMoveDollyRotate(event);
|
767
|
+
scope.update();
|
768
|
+
break;
|
769
|
+
|
770
|
+
default:
|
771
|
+
state = STATE.NONE;
|
772
|
+
}
|
773
|
+
}
|
774
|
+
|
775
|
+
function onTouchEnd(event) {
|
776
|
+
if (scope.enabled === false) return;
|
777
|
+
handleTouchEnd(event);
|
778
|
+
scope.dispatchEvent(endEvent);
|
779
|
+
state = STATE.NONE;
|
780
|
+
}
|
781
|
+
|
782
|
+
function onContextMenu(event) {
|
783
|
+
if (scope.enabled === false) return;
|
784
|
+
event.preventDefault();
|
785
|
+
} //
|
786
|
+
|
787
|
+
|
788
|
+
scope.domElement.addEventListener('contextmenu', onContextMenu, false);
|
789
|
+
scope.domElement.addEventListener('mousedown', onMouseDown, false);
|
790
|
+
scope.domElement.addEventListener('wheel', onMouseWheel, false);
|
791
|
+
scope.domElement.addEventListener('touchstart', onTouchStart, false);
|
792
|
+
scope.domElement.addEventListener('touchend', onTouchEnd, false);
|
793
|
+
scope.domElement.addEventListener('touchmove', onTouchMove, false);
|
794
|
+
scope.domElement.addEventListener('keydown', onKeyDown, false); // make sure element can receive keys.
|
795
|
+
|
796
|
+
if (scope.domElement.tabIndex === -1) {
|
797
|
+
scope.domElement.tabIndex = 0;
|
798
|
+
} // force an update at start
|
799
|
+
|
800
|
+
|
801
|
+
this.object.lookAt(scope.target);
|
802
|
+
this.update();
|
803
|
+
this.saveState();
|
804
|
+
};
|
805
|
+
|
806
|
+
_exports.CameraControls = CameraControls;
|
807
|
+
CameraControls.prototype = Object.create(_three.EventDispatcher.prototype);
|
808
|
+
CameraControls.prototype.constructor = CameraControls; // OrbitControls maintains the "up" direction, camera.up (+Y by default).
|
809
|
+
//
|
810
|
+
// Orbit - left mouse / touch: one-finger move
|
811
|
+
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
|
812
|
+
// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
|
813
|
+
|
814
|
+
var OrbitControls = function OrbitControls(object, domElement) {
|
815
|
+
CameraControls.call(this, object, domElement);
|
816
|
+
this.mouseButtons.LEFT = _three.MOUSE.ROTATE;
|
817
|
+
this.mouseButtons.RIGHT = _three.MOUSE.PAN;
|
818
|
+
this.touches.ONE = _three.TOUCH.ROTATE;
|
819
|
+
this.touches.TWO = _three.TOUCH.DOLLY_PAN;
|
820
|
+
};
|
821
|
+
|
822
|
+
_exports.OrbitControls = OrbitControls;
|
823
|
+
OrbitControls.prototype = Object.create(_three.EventDispatcher.prototype);
|
824
|
+
OrbitControls.prototype.constructor = OrbitControls; // MapControls maintains the "up" direction, camera.up (+Y by default)
|
825
|
+
//
|
826
|
+
// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
|
827
|
+
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
|
828
|
+
// Pan - left mouse, or left right + ctrl/meta/shiftKey, or arrow keys / touch: one-finger move
|
829
|
+
|
830
|
+
var MapControls = function MapControls(object, domElement) {
|
831
|
+
CameraControls.call(this, object, domElement);
|
832
|
+
this.mouseButtons.LEFT = _three.MOUSE.PAN;
|
833
|
+
this.mouseButtons.RIGHT = _three.MOUSE.ROTATE;
|
834
|
+
this.touches.ONE = _three.TOUCH.PAN;
|
835
|
+
this.touches.TWO = _three.TOUCH.DOLLY_ROTATE;
|
836
|
+
};
|
837
|
+
|
838
|
+
_exports.MapControls = MapControls;
|
839
|
+
MapControls.prototype = Object.create(_three.EventDispatcher.prototype);
|
840
|
+
MapControls.prototype.constructor = MapControls; // TrackballControls allows the camera to rotate over the polls and does not maintain camera.up
|
841
|
+
//
|
842
|
+
// Orbit - left mouse / touch: one-finger move
|
843
|
+
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
|
844
|
+
// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
|
845
|
+
|
846
|
+
var TrackballControls = function TrackballControls(object, domElement) {
|
847
|
+
CameraControls.call(this, object, domElement);
|
848
|
+
this.trackball = true;
|
849
|
+
this.screenSpacePanning = true;
|
850
|
+
this.autoRotate = false;
|
851
|
+
this.mouseButtons.LEFT = _three.MOUSE.ROTATE;
|
852
|
+
this.mouseButtons.RIGHT = _three.MOUSE.PAN;
|
853
|
+
this.touches.ONE = _three.TOUCH.ROTATE;
|
854
|
+
this.touches.TWO = _three.TOUCH.DOLLY_PAN;
|
855
|
+
};
|
856
|
+
|
857
|
+
_exports.TrackballControls = TrackballControls;
|
858
|
+
TrackballControls.prototype = Object.create(_three.EventDispatcher.prototype);
|
859
|
+
TrackballControls.prototype.constructor = TrackballControls;
|
860
|
+
});
|