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,435 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three", "../utils/BufferGeometryUtils.js"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"), require("../utils/BufferGeometryUtils.js"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three, global.BufferGeometryUtils);
|
11
|
+
global.SimplifyModifier = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, BufferGeometryUtils) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.SimplifyModifier = void 0;
|
20
|
+
BufferGeometryUtils = _interopRequireWildcard(BufferGeometryUtils);
|
21
|
+
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27
|
+
|
28
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
29
|
+
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Simplification Geometry Modifier
|
34
|
+
* - based on code and technique
|
35
|
+
* - by Stan Melax in 1998
|
36
|
+
* - Progressive Mesh type Polygon Reduction Algorithm
|
37
|
+
* - http://www.melax.com/polychop/
|
38
|
+
*/
|
39
|
+
var _cb = new _three.Vector3(),
|
40
|
+
_ab = new _three.Vector3();
|
41
|
+
|
42
|
+
var SimplifyModifier = /*#__PURE__*/function () {
|
43
|
+
function SimplifyModifier() {
|
44
|
+
_classCallCheck(this, SimplifyModifier);
|
45
|
+
|
46
|
+
if (BufferGeometryUtils === undefined) {
|
47
|
+
throw 'THREE.SimplifyModifier relies on BufferGeometryUtils';
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
_createClass(SimplifyModifier, [{
|
52
|
+
key: "modify",
|
53
|
+
value: function modify(geometry, count) {
|
54
|
+
if (geometry.isGeometry === true) {
|
55
|
+
console.error('THREE.SimplifyModifier no longer supports Geometry. Use BufferGeometry instead.');
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
|
59
|
+
geometry = geometry.clone();
|
60
|
+
var attributes = geometry.attributes; // this modifier can only process indexed and non-indexed geomtries with a position attribute
|
61
|
+
|
62
|
+
for (var name in attributes) {
|
63
|
+
if (name !== 'position') geometry.deleteAttribute(name);
|
64
|
+
}
|
65
|
+
|
66
|
+
geometry = BufferGeometryUtils.mergeVertices(geometry); //
|
67
|
+
// put data of original geometry in different data structures
|
68
|
+
//
|
69
|
+
|
70
|
+
var vertices = [];
|
71
|
+
var faces = []; // add vertices
|
72
|
+
|
73
|
+
var positionAttribute = geometry.getAttribute('position');
|
74
|
+
|
75
|
+
for (var i = 0; i < positionAttribute.count; i++) {
|
76
|
+
var v = new _three.Vector3().fromBufferAttribute(positionAttribute, i);
|
77
|
+
var vertex = new Vertex(v);
|
78
|
+
vertices.push(vertex);
|
79
|
+
} // add faces
|
80
|
+
|
81
|
+
|
82
|
+
var index = geometry.getIndex();
|
83
|
+
|
84
|
+
if (index !== null) {
|
85
|
+
for (var _i = 0; _i < index.count; _i += 3) {
|
86
|
+
var a = index.getX(_i);
|
87
|
+
var b = index.getX(_i + 1);
|
88
|
+
var c = index.getX(_i + 2);
|
89
|
+
var triangle = new Triangle(vertices[a], vertices[b], vertices[c], a, b, c);
|
90
|
+
faces.push(triangle);
|
91
|
+
}
|
92
|
+
} else {
|
93
|
+
for (var _i2 = 0; _i2 < positionAttribute.count; _i2 += 3) {
|
94
|
+
var _a = _i2;
|
95
|
+
|
96
|
+
var _b = _i2 + 1;
|
97
|
+
|
98
|
+
var _c = _i2 + 2;
|
99
|
+
|
100
|
+
var _triangle = new Triangle(vertices[_a], vertices[_b], vertices[_c], _a, _b, _c);
|
101
|
+
|
102
|
+
faces.push(_triangle);
|
103
|
+
}
|
104
|
+
} // compute all edge collapse costs
|
105
|
+
|
106
|
+
|
107
|
+
for (var _i3 = 0, il = vertices.length; _i3 < il; _i3++) {
|
108
|
+
computeEdgeCostAtVertex(vertices[_i3]);
|
109
|
+
}
|
110
|
+
|
111
|
+
var nextVertex;
|
112
|
+
var z = count;
|
113
|
+
|
114
|
+
while (z--) {
|
115
|
+
nextVertex = minimumCostEdge(vertices);
|
116
|
+
|
117
|
+
if (!nextVertex) {
|
118
|
+
console.log('THREE.SimplifyModifier: No next vertex');
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
|
122
|
+
collapse(vertices, faces, nextVertex, nextVertex.collapseNeighbor);
|
123
|
+
} //
|
124
|
+
|
125
|
+
|
126
|
+
var simplifiedGeometry = new _three.BufferGeometry();
|
127
|
+
var position = [];
|
128
|
+
index = []; //
|
129
|
+
|
130
|
+
for (var _i4 = 0; _i4 < vertices.length; _i4++) {
|
131
|
+
var _vertex = vertices[_i4].position;
|
132
|
+
position.push(_vertex.x, _vertex.y, _vertex.z); // cache final index to GREATLY speed up faces reconstruction
|
133
|
+
|
134
|
+
vertices[_i4].id = _i4;
|
135
|
+
} //
|
136
|
+
|
137
|
+
|
138
|
+
for (var _i5 = 0; _i5 < faces.length; _i5++) {
|
139
|
+
var face = faces[_i5];
|
140
|
+
index.push(face.v1.id, face.v2.id, face.v3.id);
|
141
|
+
} //
|
142
|
+
|
143
|
+
|
144
|
+
simplifiedGeometry.setAttribute('position', new _three.Float32BufferAttribute(position, 3));
|
145
|
+
simplifiedGeometry.setIndex(index);
|
146
|
+
return simplifiedGeometry;
|
147
|
+
}
|
148
|
+
}]);
|
149
|
+
|
150
|
+
return SimplifyModifier;
|
151
|
+
}();
|
152
|
+
|
153
|
+
_exports.SimplifyModifier = SimplifyModifier;
|
154
|
+
|
155
|
+
function pushIfUnique(array, object) {
|
156
|
+
if (array.indexOf(object) === -1) array.push(object);
|
157
|
+
}
|
158
|
+
|
159
|
+
function removeFromArray(array, object) {
|
160
|
+
var k = array.indexOf(object);
|
161
|
+
if (k > -1) array.splice(k, 1);
|
162
|
+
}
|
163
|
+
|
164
|
+
function computeEdgeCollapseCost(u, v) {
|
165
|
+
// if we collapse edge uv by moving u to v then how
|
166
|
+
// much different will the model change, i.e. the "error".
|
167
|
+
var edgelength = v.position.distanceTo(u.position);
|
168
|
+
var curvature = 0;
|
169
|
+
var sideFaces = []; // find the "sides" triangles that are on the edge uv
|
170
|
+
|
171
|
+
for (var i = 0, il = u.faces.length; i < il; i++) {
|
172
|
+
var face = u.faces[i];
|
173
|
+
|
174
|
+
if (face.hasVertex(v)) {
|
175
|
+
sideFaces.push(face);
|
176
|
+
}
|
177
|
+
} // use the triangle facing most away from the sides
|
178
|
+
// to determine our curvature term
|
179
|
+
|
180
|
+
|
181
|
+
for (var _i6 = 0, _il = u.faces.length; _i6 < _il; _i6++) {
|
182
|
+
var minCurvature = 1;
|
183
|
+
var _face = u.faces[_i6];
|
184
|
+
|
185
|
+
for (var j = 0; j < sideFaces.length; j++) {
|
186
|
+
var sideFace = sideFaces[j]; // use dot product of face normals.
|
187
|
+
|
188
|
+
var dotProd = _face.normal.dot(sideFace.normal);
|
189
|
+
|
190
|
+
minCurvature = Math.min(minCurvature, (1.001 - dotProd) / 2);
|
191
|
+
}
|
192
|
+
|
193
|
+
curvature = Math.max(curvature, minCurvature);
|
194
|
+
} // crude approach in attempt to preserve borders
|
195
|
+
// though it seems not to be totally correct
|
196
|
+
|
197
|
+
|
198
|
+
var borders = 0;
|
199
|
+
|
200
|
+
if (sideFaces.length < 2) {
|
201
|
+
// we add some arbitrary cost for borders,
|
202
|
+
// borders += 10;
|
203
|
+
curvature = 1;
|
204
|
+
}
|
205
|
+
|
206
|
+
var amt = edgelength * curvature + borders;
|
207
|
+
return amt;
|
208
|
+
}
|
209
|
+
|
210
|
+
function computeEdgeCostAtVertex(v) {
|
211
|
+
// compute the edge collapse cost for all edges that start
|
212
|
+
// from vertex v. Since we are only interested in reducing
|
213
|
+
// the object by selecting the min cost edge at each step, we
|
214
|
+
// only cache the cost of the least cost edge at this vertex
|
215
|
+
// (in member variable collapse) as well as the value of the
|
216
|
+
// cost (in member variable collapseCost).
|
217
|
+
if (v.neighbors.length === 0) {
|
218
|
+
// collapse if no neighbors.
|
219
|
+
v.collapseNeighbor = null;
|
220
|
+
v.collapseCost = -0.01;
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
|
224
|
+
v.collapseCost = 100000;
|
225
|
+
v.collapseNeighbor = null; // search all neighboring edges for "least cost" edge
|
226
|
+
|
227
|
+
for (var i = 0; i < v.neighbors.length; i++) {
|
228
|
+
var collapseCost = computeEdgeCollapseCost(v, v.neighbors[i]);
|
229
|
+
|
230
|
+
if (!v.collapseNeighbor) {
|
231
|
+
v.collapseNeighbor = v.neighbors[i];
|
232
|
+
v.collapseCost = collapseCost;
|
233
|
+
v.minCost = collapseCost;
|
234
|
+
v.totalCost = 0;
|
235
|
+
v.costCount = 0;
|
236
|
+
}
|
237
|
+
|
238
|
+
v.costCount++;
|
239
|
+
v.totalCost += collapseCost;
|
240
|
+
|
241
|
+
if (collapseCost < v.minCost) {
|
242
|
+
v.collapseNeighbor = v.neighbors[i];
|
243
|
+
v.minCost = collapseCost;
|
244
|
+
}
|
245
|
+
} // we average the cost of collapsing at this vertex
|
246
|
+
|
247
|
+
|
248
|
+
v.collapseCost = v.totalCost / v.costCount; // v.collapseCost = v.minCost;
|
249
|
+
}
|
250
|
+
|
251
|
+
function removeVertex(v, vertices) {
|
252
|
+
console.assert(v.faces.length === 0);
|
253
|
+
|
254
|
+
while (v.neighbors.length) {
|
255
|
+
var n = v.neighbors.pop();
|
256
|
+
removeFromArray(n.neighbors, v);
|
257
|
+
}
|
258
|
+
|
259
|
+
removeFromArray(vertices, v);
|
260
|
+
}
|
261
|
+
|
262
|
+
function removeFace(f, faces) {
|
263
|
+
removeFromArray(faces, f);
|
264
|
+
if (f.v1) removeFromArray(f.v1.faces, f);
|
265
|
+
if (f.v2) removeFromArray(f.v2.faces, f);
|
266
|
+
if (f.v3) removeFromArray(f.v3.faces, f); // TODO optimize this!
|
267
|
+
|
268
|
+
var vs = [f.v1, f.v2, f.v3];
|
269
|
+
|
270
|
+
for (var i = 0; i < 3; i++) {
|
271
|
+
var v1 = vs[i];
|
272
|
+
var v2 = vs[(i + 1) % 3];
|
273
|
+
if (!v1 || !v2) continue;
|
274
|
+
v1.removeIfNonNeighbor(v2);
|
275
|
+
v2.removeIfNonNeighbor(v1);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
function collapse(vertices, faces, u, v) {
|
280
|
+
// u and v are pointers to vertices of an edge
|
281
|
+
// Collapse the edge uv by moving vertex u onto v
|
282
|
+
if (!v) {
|
283
|
+
// u is a vertex all by itself so just delete it..
|
284
|
+
removeVertex(u, vertices);
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
|
288
|
+
var tmpVertices = [];
|
289
|
+
|
290
|
+
for (var i = 0; i < u.neighbors.length; i++) {
|
291
|
+
tmpVertices.push(u.neighbors[i]);
|
292
|
+
} // delete triangles on edge uv:
|
293
|
+
|
294
|
+
|
295
|
+
for (var _i7 = u.faces.length - 1; _i7 >= 0; _i7--) {
|
296
|
+
if (u.faces[_i7].hasVertex(v)) {
|
297
|
+
removeFace(u.faces[_i7], faces);
|
298
|
+
}
|
299
|
+
} // update remaining triangles to have v instead of u
|
300
|
+
|
301
|
+
|
302
|
+
for (var _i8 = u.faces.length - 1; _i8 >= 0; _i8--) {
|
303
|
+
u.faces[_i8].replaceVertex(u, v);
|
304
|
+
}
|
305
|
+
|
306
|
+
removeVertex(u, vertices); // recompute the edge collapse costs in neighborhood
|
307
|
+
|
308
|
+
for (var _i9 = 0; _i9 < tmpVertices.length; _i9++) {
|
309
|
+
computeEdgeCostAtVertex(tmpVertices[_i9]);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
function minimumCostEdge(vertices) {
|
314
|
+
// O(n * n) approach. TODO optimize this
|
315
|
+
var least = vertices[0];
|
316
|
+
|
317
|
+
for (var i = 0; i < vertices.length; i++) {
|
318
|
+
if (vertices[i].collapseCost < least.collapseCost) {
|
319
|
+
least = vertices[i];
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
return least;
|
324
|
+
} // we use a triangle class to represent structure of face slightly differently
|
325
|
+
|
326
|
+
|
327
|
+
var Triangle = /*#__PURE__*/function () {
|
328
|
+
function Triangle(v1, v2, v3, a, b, c) {
|
329
|
+
_classCallCheck(this, Triangle);
|
330
|
+
|
331
|
+
this.a = a;
|
332
|
+
this.b = b;
|
333
|
+
this.c = c;
|
334
|
+
this.v1 = v1;
|
335
|
+
this.v2 = v2;
|
336
|
+
this.v3 = v3;
|
337
|
+
this.normal = new _three.Vector3();
|
338
|
+
this.computeNormal();
|
339
|
+
v1.faces.push(this);
|
340
|
+
v1.addUniqueNeighbor(v2);
|
341
|
+
v1.addUniqueNeighbor(v3);
|
342
|
+
v2.faces.push(this);
|
343
|
+
v2.addUniqueNeighbor(v1);
|
344
|
+
v2.addUniqueNeighbor(v3);
|
345
|
+
v3.faces.push(this);
|
346
|
+
v3.addUniqueNeighbor(v1);
|
347
|
+
v3.addUniqueNeighbor(v2);
|
348
|
+
}
|
349
|
+
|
350
|
+
_createClass(Triangle, [{
|
351
|
+
key: "computeNormal",
|
352
|
+
value: function computeNormal() {
|
353
|
+
var vA = this.v1.position;
|
354
|
+
var vB = this.v2.position;
|
355
|
+
var vC = this.v3.position;
|
356
|
+
|
357
|
+
_cb.subVectors(vC, vB);
|
358
|
+
|
359
|
+
_ab.subVectors(vA, vB);
|
360
|
+
|
361
|
+
_cb.cross(_ab).normalize();
|
362
|
+
|
363
|
+
this.normal.copy(_cb);
|
364
|
+
}
|
365
|
+
}, {
|
366
|
+
key: "hasVertex",
|
367
|
+
value: function hasVertex(v) {
|
368
|
+
return v === this.v1 || v === this.v2 || v === this.v3;
|
369
|
+
}
|
370
|
+
}, {
|
371
|
+
key: "replaceVertex",
|
372
|
+
value: function replaceVertex(oldv, newv) {
|
373
|
+
if (oldv === this.v1) this.v1 = newv;else if (oldv === this.v2) this.v2 = newv;else if (oldv === this.v3) this.v3 = newv;
|
374
|
+
removeFromArray(oldv.faces, this);
|
375
|
+
newv.faces.push(this);
|
376
|
+
oldv.removeIfNonNeighbor(this.v1);
|
377
|
+
this.v1.removeIfNonNeighbor(oldv);
|
378
|
+
oldv.removeIfNonNeighbor(this.v2);
|
379
|
+
this.v2.removeIfNonNeighbor(oldv);
|
380
|
+
oldv.removeIfNonNeighbor(this.v3);
|
381
|
+
this.v3.removeIfNonNeighbor(oldv);
|
382
|
+
this.v1.addUniqueNeighbor(this.v2);
|
383
|
+
this.v1.addUniqueNeighbor(this.v3);
|
384
|
+
this.v2.addUniqueNeighbor(this.v1);
|
385
|
+
this.v2.addUniqueNeighbor(this.v3);
|
386
|
+
this.v3.addUniqueNeighbor(this.v1);
|
387
|
+
this.v3.addUniqueNeighbor(this.v2);
|
388
|
+
this.computeNormal();
|
389
|
+
}
|
390
|
+
}]);
|
391
|
+
|
392
|
+
return Triangle;
|
393
|
+
}();
|
394
|
+
|
395
|
+
var Vertex = /*#__PURE__*/function () {
|
396
|
+
function Vertex(v) {
|
397
|
+
_classCallCheck(this, Vertex);
|
398
|
+
|
399
|
+
this.position = v;
|
400
|
+
this.id = -1; // external use position in vertices list (for e.g. face generation)
|
401
|
+
|
402
|
+
this.faces = []; // faces vertex is connected
|
403
|
+
|
404
|
+
this.neighbors = []; // neighbouring vertices aka "adjacentVertices"
|
405
|
+
// these will be computed in computeEdgeCostAtVertex()
|
406
|
+
|
407
|
+
this.collapseCost = 0; // cost of collapsing this vertex, the less the better. aka objdist
|
408
|
+
|
409
|
+
this.collapseNeighbor = null; // best candinate for collapsing
|
410
|
+
}
|
411
|
+
|
412
|
+
_createClass(Vertex, [{
|
413
|
+
key: "addUniqueNeighbor",
|
414
|
+
value: function addUniqueNeighbor(vertex) {
|
415
|
+
pushIfUnique(this.neighbors, vertex);
|
416
|
+
}
|
417
|
+
}, {
|
418
|
+
key: "removeIfNonNeighbor",
|
419
|
+
value: function removeIfNonNeighbor(n) {
|
420
|
+
var neighbors = this.neighbors;
|
421
|
+
var faces = this.faces;
|
422
|
+
var offset = neighbors.indexOf(n);
|
423
|
+
if (offset === -1) return;
|
424
|
+
|
425
|
+
for (var i = 0; i < faces.length; i++) {
|
426
|
+
if (faces[i].hasVertex(n)) return;
|
427
|
+
}
|
428
|
+
|
429
|
+
neighbors.splice(offset, 1);
|
430
|
+
}
|
431
|
+
}]);
|
432
|
+
|
433
|
+
return Vertex;
|
434
|
+
}();
|
435
|
+
});
|
@@ -0,0 +1,264 @@
|
|
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.TessellateModifier = 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.TessellateModifier = void 0;
|
20
|
+
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22
|
+
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
24
|
+
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Break faces with edges longer than maxEdgeLength
|
29
|
+
*/
|
30
|
+
var TessellateModifier = /*#__PURE__*/function () {
|
31
|
+
function TessellateModifier() {
|
32
|
+
var maxEdgeLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.1;
|
33
|
+
var maxIterations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
|
34
|
+
|
35
|
+
_classCallCheck(this, TessellateModifier);
|
36
|
+
|
37
|
+
this.maxEdgeLength = maxEdgeLength;
|
38
|
+
this.maxIterations = maxIterations;
|
39
|
+
}
|
40
|
+
|
41
|
+
_createClass(TessellateModifier, [{
|
42
|
+
key: "modify",
|
43
|
+
value: function modify(geometry) {
|
44
|
+
if (geometry.isGeometry === true) {
|
45
|
+
console.error('THREE.TessellateModifier no longer supports Geometry. Use BufferGeometry instead.');
|
46
|
+
return geometry;
|
47
|
+
}
|
48
|
+
|
49
|
+
if (geometry.index !== null) {
|
50
|
+
geometry = geometry.toNonIndexed();
|
51
|
+
} //
|
52
|
+
|
53
|
+
|
54
|
+
var maxIterations = this.maxIterations;
|
55
|
+
var maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength;
|
56
|
+
var va = new _three.Vector3();
|
57
|
+
var vb = new _three.Vector3();
|
58
|
+
var vc = new _three.Vector3();
|
59
|
+
var vm = new _three.Vector3();
|
60
|
+
var vs = [va, vb, vc, vm];
|
61
|
+
var na = new _three.Vector3();
|
62
|
+
var nb = new _three.Vector3();
|
63
|
+
var nc = new _three.Vector3();
|
64
|
+
var nm = new _three.Vector3();
|
65
|
+
var ns = [na, nb, nc, nm];
|
66
|
+
var ca = new _three.Color();
|
67
|
+
var cb = new _three.Color();
|
68
|
+
var cc = new _three.Color();
|
69
|
+
var cm = new _three.Color();
|
70
|
+
var cs = [ca, cb, cc, cm];
|
71
|
+
var ua = new _three.Vector2();
|
72
|
+
var ub = new _three.Vector2();
|
73
|
+
var uc = new _three.Vector2();
|
74
|
+
var um = new _three.Vector2();
|
75
|
+
var us = [ua, ub, uc, um];
|
76
|
+
var u2a = new _three.Vector2();
|
77
|
+
var u2b = new _three.Vector2();
|
78
|
+
var u2c = new _three.Vector2();
|
79
|
+
var u2m = new _three.Vector2();
|
80
|
+
var u2s = [u2a, u2b, u2c, u2m];
|
81
|
+
var attributes = geometry.attributes;
|
82
|
+
var hasNormals = attributes.normal !== undefined;
|
83
|
+
var hasColors = attributes.color !== undefined;
|
84
|
+
var hasUVs = attributes.uv !== undefined;
|
85
|
+
var hasUV2s = attributes.uv2 !== undefined;
|
86
|
+
var positions = attributes.position.array;
|
87
|
+
var normals = hasNormals ? attributes.normal.array : null;
|
88
|
+
var colors = hasColors ? attributes.color.array : null;
|
89
|
+
var uvs = hasUVs ? attributes.uv.array : null;
|
90
|
+
var uv2s = hasUV2s ? attributes.uv2.array : null;
|
91
|
+
var positions2 = positions;
|
92
|
+
var normals2 = normals;
|
93
|
+
var colors2 = colors;
|
94
|
+
var uvs2 = uvs;
|
95
|
+
var uv2s2 = uv2s;
|
96
|
+
var iteration = 0;
|
97
|
+
var tessellating = true;
|
98
|
+
|
99
|
+
function addTriangle(a, b, c) {
|
100
|
+
var v1 = vs[a];
|
101
|
+
var v2 = vs[b];
|
102
|
+
var v3 = vs[c];
|
103
|
+
positions2.push(v1.x, v1.y, v1.z);
|
104
|
+
positions2.push(v2.x, v2.y, v2.z);
|
105
|
+
positions2.push(v3.x, v3.y, v3.z);
|
106
|
+
|
107
|
+
if (hasNormals) {
|
108
|
+
var n1 = ns[a];
|
109
|
+
var n2 = ns[b];
|
110
|
+
var n3 = ns[c];
|
111
|
+
normals2.push(n1.x, n1.y, n1.z);
|
112
|
+
normals2.push(n2.x, n2.y, n2.z);
|
113
|
+
normals2.push(n3.x, n3.y, n3.z);
|
114
|
+
}
|
115
|
+
|
116
|
+
if (hasColors) {
|
117
|
+
var c1 = cs[a];
|
118
|
+
var c2 = cs[b];
|
119
|
+
var c3 = cs[c];
|
120
|
+
colors2.push(c1.x, c1.y, c1.z);
|
121
|
+
colors2.push(c2.x, c2.y, c2.z);
|
122
|
+
colors2.push(c3.x, c3.y, c3.z);
|
123
|
+
}
|
124
|
+
|
125
|
+
if (hasUVs) {
|
126
|
+
var u1 = us[a];
|
127
|
+
var u2 = us[b];
|
128
|
+
var u3 = us[c];
|
129
|
+
uvs2.push(u1.x, u1.y);
|
130
|
+
uvs2.push(u2.x, u2.y);
|
131
|
+
uvs2.push(u3.x, u3.y);
|
132
|
+
}
|
133
|
+
|
134
|
+
if (hasUV2s) {
|
135
|
+
var u21 = u2s[a];
|
136
|
+
var u22 = u2s[b];
|
137
|
+
var u23 = u2s[c];
|
138
|
+
uv2s2.push(u21.x, u21.y);
|
139
|
+
uv2s2.push(u22.x, u22.y);
|
140
|
+
uv2s2.push(u23.x, u23.y);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
while (tessellating && iteration < maxIterations) {
|
145
|
+
iteration++;
|
146
|
+
tessellating = false;
|
147
|
+
positions = positions2;
|
148
|
+
positions2 = [];
|
149
|
+
|
150
|
+
if (hasNormals) {
|
151
|
+
normals = normals2;
|
152
|
+
normals2 = [];
|
153
|
+
}
|
154
|
+
|
155
|
+
if (hasColors) {
|
156
|
+
colors = colors2;
|
157
|
+
colors2 = [];
|
158
|
+
}
|
159
|
+
|
160
|
+
if (hasUVs) {
|
161
|
+
uvs = uvs2;
|
162
|
+
uvs2 = [];
|
163
|
+
}
|
164
|
+
|
165
|
+
if (hasUV2s) {
|
166
|
+
uv2s = uv2s2;
|
167
|
+
uv2s2 = [];
|
168
|
+
}
|
169
|
+
|
170
|
+
for (var i = 0, i2 = 0, il = positions.length; i < il; i += 9, i2 += 6) {
|
171
|
+
va.fromArray(positions, i + 0);
|
172
|
+
vb.fromArray(positions, i + 3);
|
173
|
+
vc.fromArray(positions, i + 6);
|
174
|
+
|
175
|
+
if (hasNormals) {
|
176
|
+
na.fromArray(normals, i + 0);
|
177
|
+
nb.fromArray(normals, i + 3);
|
178
|
+
nc.fromArray(normals, i + 6);
|
179
|
+
}
|
180
|
+
|
181
|
+
if (hasColors) {
|
182
|
+
ca.fromArray(colors, i + 0);
|
183
|
+
cb.fromArray(colors, i + 3);
|
184
|
+
cc.fromArray(colors, i + 6);
|
185
|
+
}
|
186
|
+
|
187
|
+
if (hasUVs) {
|
188
|
+
ua.fromArray(uvs, i2 + 0);
|
189
|
+
ub.fromArray(uvs, i2 + 2);
|
190
|
+
uc.fromArray(uvs, i2 + 4);
|
191
|
+
}
|
192
|
+
|
193
|
+
if (hasUV2s) {
|
194
|
+
u2a.fromArray(uv2s, i2 + 0);
|
195
|
+
u2b.fromArray(uv2s, i2 + 2);
|
196
|
+
u2c.fromArray(uv2s, i2 + 4);
|
197
|
+
}
|
198
|
+
|
199
|
+
var dab = va.distanceToSquared(vb);
|
200
|
+
var dbc = vb.distanceToSquared(vc);
|
201
|
+
var dac = va.distanceToSquared(vc);
|
202
|
+
|
203
|
+
if (dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared) {
|
204
|
+
tessellating = true;
|
205
|
+
|
206
|
+
if (dab >= dbc && dab >= dac) {
|
207
|
+
vm.lerpVectors(va, vb, 0.5);
|
208
|
+
if (hasNormals) nm.lerpVectors(na, nb, 0.5);
|
209
|
+
if (hasColors) cm.lerpColors(ca, cb, 0.5);
|
210
|
+
if (hasUVs) um.lerpVectors(ua, ub, 0.5);
|
211
|
+
if (hasUV2s) u2m.lerpVectors(u2a, u2b, 0.5);
|
212
|
+
addTriangle(0, 3, 2);
|
213
|
+
addTriangle(3, 1, 2);
|
214
|
+
} else if (dbc >= dab && dbc >= dac) {
|
215
|
+
vm.lerpVectors(vb, vc, 0.5);
|
216
|
+
if (hasNormals) nm.lerpVectors(nb, nc, 0.5);
|
217
|
+
if (hasColors) cm.lerpColors(cb, cc, 0.5);
|
218
|
+
if (hasUVs) um.lerpVectors(ub, uc, 0.5);
|
219
|
+
if (hasUV2s) u2m.lerpVectors(u2b, u2c, 0.5);
|
220
|
+
addTriangle(0, 1, 3);
|
221
|
+
addTriangle(3, 2, 0);
|
222
|
+
} else {
|
223
|
+
vm.lerpVectors(va, vc, 0.5);
|
224
|
+
if (hasNormals) nm.lerpVectors(na, nc, 0.5);
|
225
|
+
if (hasColors) cm.lerpColors(ca, cc, 0.5);
|
226
|
+
if (hasUVs) um.lerpVectors(ua, uc, 0.5);
|
227
|
+
if (hasUV2s) u2m.lerpVectors(u2a, u2c, 0.5);
|
228
|
+
addTriangle(0, 1, 3);
|
229
|
+
addTriangle(3, 1, 2);
|
230
|
+
}
|
231
|
+
} else {
|
232
|
+
addTriangle(0, 1, 2);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
var geometry2 = new _three.BufferGeometry();
|
238
|
+
geometry2.setAttribute('position', new _three.Float32BufferAttribute(positions2, 3));
|
239
|
+
|
240
|
+
if (hasNormals) {
|
241
|
+
geometry2.setAttribute('normal', new _three.Float32BufferAttribute(normals2, 3));
|
242
|
+
}
|
243
|
+
|
244
|
+
if (hasColors) {
|
245
|
+
geometry2.setAttribute('color', new _three.Float32BufferAttribute(colors2, 3));
|
246
|
+
}
|
247
|
+
|
248
|
+
if (hasUVs) {
|
249
|
+
geometry2.setAttribute('uv', new _three.Float32BufferAttribute(uvs2, 2));
|
250
|
+
}
|
251
|
+
|
252
|
+
if (hasUV2s) {
|
253
|
+
geometry2.setAttribute('uv2', new _three.Float32BufferAttribute(uv2s2, 2));
|
254
|
+
}
|
255
|
+
|
256
|
+
return geometry2;
|
257
|
+
}
|
258
|
+
}]);
|
259
|
+
|
260
|
+
return TessellateModifier;
|
261
|
+
}();
|
262
|
+
|
263
|
+
_exports.TessellateModifier = TessellateModifier;
|
264
|
+
});
|