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,1230 @@
|
|
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.DMLoader = 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.Rhino3dmLoader = void 0;
|
20
|
+
|
21
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
22
|
+
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
24
|
+
|
25
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
26
|
+
|
27
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
28
|
+
|
29
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
30
|
+
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
32
|
+
|
33
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34
|
+
|
35
|
+
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); } }
|
36
|
+
|
37
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
38
|
+
|
39
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
40
|
+
|
41
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
42
|
+
|
43
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
44
|
+
|
45
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
46
|
+
|
47
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
48
|
+
|
49
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
50
|
+
|
51
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
52
|
+
|
53
|
+
var _taskCache = new WeakMap();
|
54
|
+
|
55
|
+
var Rhino3dmLoader = /*#__PURE__*/function (_Loader) {
|
56
|
+
_inherits(Rhino3dmLoader, _Loader);
|
57
|
+
|
58
|
+
var _super = _createSuper(Rhino3dmLoader);
|
59
|
+
|
60
|
+
function Rhino3dmLoader(manager) {
|
61
|
+
var _this;
|
62
|
+
|
63
|
+
_classCallCheck(this, Rhino3dmLoader);
|
64
|
+
|
65
|
+
_this = _super.call(this, manager);
|
66
|
+
_this.libraryPath = '';
|
67
|
+
_this.libraryPending = null;
|
68
|
+
_this.libraryBinary = null;
|
69
|
+
_this.libraryConfig = {};
|
70
|
+
_this.url = '';
|
71
|
+
_this.workerLimit = 4;
|
72
|
+
_this.workerPool = [];
|
73
|
+
_this.workerNextTaskID = 1;
|
74
|
+
_this.workerSourceURL = '';
|
75
|
+
_this.workerConfig = {};
|
76
|
+
_this.materials = [];
|
77
|
+
_this.warnings = [];
|
78
|
+
return _this;
|
79
|
+
}
|
80
|
+
|
81
|
+
_createClass(Rhino3dmLoader, [{
|
82
|
+
key: "setLibraryPath",
|
83
|
+
value: function setLibraryPath(path) {
|
84
|
+
this.libraryPath = path;
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
key: "setWorkerLimit",
|
89
|
+
value: function setWorkerLimit(workerLimit) {
|
90
|
+
this.workerLimit = workerLimit;
|
91
|
+
return this;
|
92
|
+
}
|
93
|
+
}, {
|
94
|
+
key: "load",
|
95
|
+
value: function load(url, onLoad, onProgress, onError) {
|
96
|
+
var _this2 = this;
|
97
|
+
|
98
|
+
var loader = new _three.FileLoader(this.manager);
|
99
|
+
loader.setPath(this.path);
|
100
|
+
loader.setResponseType('arraybuffer');
|
101
|
+
loader.setRequestHeader(this.requestHeader);
|
102
|
+
this.url = url;
|
103
|
+
loader.load(url, function (buffer) {
|
104
|
+
// Check for an existing task using this buffer. A transferred buffer cannot be transferred
|
105
|
+
// again from this thread.
|
106
|
+
if (_taskCache.has(buffer)) {
|
107
|
+
var cachedTask = _taskCache.get(buffer);
|
108
|
+
|
109
|
+
return cachedTask.promise.then(onLoad).catch(onError);
|
110
|
+
}
|
111
|
+
|
112
|
+
_this2.decodeObjects(buffer, url).then(function (result) {
|
113
|
+
result.userData.warnings = _this2.warnings;
|
114
|
+
onLoad(result);
|
115
|
+
}).catch(function (e) {
|
116
|
+
return onError(e);
|
117
|
+
});
|
118
|
+
}, onProgress, onError);
|
119
|
+
}
|
120
|
+
}, {
|
121
|
+
key: "debug",
|
122
|
+
value: function debug() {
|
123
|
+
console.log('Task load: ', this.workerPool.map(function (worker) {
|
124
|
+
return worker._taskLoad;
|
125
|
+
}));
|
126
|
+
}
|
127
|
+
}, {
|
128
|
+
key: "decodeObjects",
|
129
|
+
value: function decodeObjects(buffer, url) {
|
130
|
+
var _this3 = this;
|
131
|
+
|
132
|
+
var worker;
|
133
|
+
var taskID;
|
134
|
+
var taskCost = buffer.byteLength;
|
135
|
+
|
136
|
+
var objectPending = this._getWorker(taskCost).then(function (_worker) {
|
137
|
+
worker = _worker;
|
138
|
+
taskID = _this3.workerNextTaskID++;
|
139
|
+
return new Promise(function (resolve, reject) {
|
140
|
+
worker._callbacks[taskID] = {
|
141
|
+
resolve: resolve,
|
142
|
+
reject: reject
|
143
|
+
};
|
144
|
+
worker.postMessage({
|
145
|
+
type: 'decode',
|
146
|
+
id: taskID,
|
147
|
+
buffer: buffer
|
148
|
+
}, [buffer]); // this.debug();
|
149
|
+
});
|
150
|
+
}).then(function (message) {
|
151
|
+
return _this3._createGeometry(message.data);
|
152
|
+
}).catch(function (e) {
|
153
|
+
throw e;
|
154
|
+
}); // Remove task from the task list.
|
155
|
+
// Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)
|
156
|
+
|
157
|
+
|
158
|
+
objectPending.catch(function () {
|
159
|
+
return true;
|
160
|
+
}).then(function () {
|
161
|
+
if (worker && taskID) {
|
162
|
+
_this3._releaseTask(worker, taskID); //this.debug();
|
163
|
+
|
164
|
+
}
|
165
|
+
}); // Cache the task result.
|
166
|
+
|
167
|
+
_taskCache.set(buffer, {
|
168
|
+
url: url,
|
169
|
+
promise: objectPending
|
170
|
+
});
|
171
|
+
|
172
|
+
return objectPending;
|
173
|
+
}
|
174
|
+
}, {
|
175
|
+
key: "parse",
|
176
|
+
value: function parse(data, onLoad, onError) {
|
177
|
+
var _this4 = this;
|
178
|
+
|
179
|
+
this.decodeObjects(data, '').then(function (result) {
|
180
|
+
result.userData.warnings = _this4.warnings;
|
181
|
+
onLoad(result);
|
182
|
+
}).catch(function (e) {
|
183
|
+
return onError(e);
|
184
|
+
});
|
185
|
+
}
|
186
|
+
}, {
|
187
|
+
key: "_compareMaterials",
|
188
|
+
value: function _compareMaterials(material) {
|
189
|
+
var mat = {};
|
190
|
+
mat.name = material.name;
|
191
|
+
mat.color = {};
|
192
|
+
mat.color.r = material.color.r;
|
193
|
+
mat.color.g = material.color.g;
|
194
|
+
mat.color.b = material.color.b;
|
195
|
+
mat.type = material.type;
|
196
|
+
|
197
|
+
for (var i = 0; i < this.materials.length; i++) {
|
198
|
+
var m = this.materials[i];
|
199
|
+
var _mat = {};
|
200
|
+
_mat.name = m.name;
|
201
|
+
_mat.color = {};
|
202
|
+
_mat.color.r = m.color.r;
|
203
|
+
_mat.color.g = m.color.g;
|
204
|
+
_mat.color.b = m.color.b;
|
205
|
+
_mat.type = m.type;
|
206
|
+
|
207
|
+
if (JSON.stringify(mat) === JSON.stringify(_mat)) {
|
208
|
+
return m;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
this.materials.push(material);
|
213
|
+
return material;
|
214
|
+
}
|
215
|
+
}, {
|
216
|
+
key: "_createMaterial",
|
217
|
+
value: function _createMaterial(material) {
|
218
|
+
if (material === undefined) {
|
219
|
+
return new _three.MeshStandardMaterial({
|
220
|
+
color: new _three.Color(1, 1, 1),
|
221
|
+
metalness: 0.8,
|
222
|
+
name: 'default',
|
223
|
+
side: 2
|
224
|
+
});
|
225
|
+
}
|
226
|
+
|
227
|
+
var _diffuseColor = material.diffuseColor;
|
228
|
+
var diffusecolor = new _three.Color(_diffuseColor.r / 255.0, _diffuseColor.g / 255.0, _diffuseColor.b / 255.0);
|
229
|
+
|
230
|
+
if (_diffuseColor.r === 0 && _diffuseColor.g === 0 && _diffuseColor.b === 0) {
|
231
|
+
diffusecolor.r = 1;
|
232
|
+
diffusecolor.g = 1;
|
233
|
+
diffusecolor.b = 1;
|
234
|
+
} // console.log( material );
|
235
|
+
|
236
|
+
|
237
|
+
var mat = new _three.MeshStandardMaterial({
|
238
|
+
color: diffusecolor,
|
239
|
+
name: material.name,
|
240
|
+
side: 2,
|
241
|
+
transparent: material.transparency > 0 ? true : false,
|
242
|
+
opacity: 1.0 - material.transparency
|
243
|
+
});
|
244
|
+
var textureLoader = new _three.TextureLoader();
|
245
|
+
|
246
|
+
for (var i = 0; i < material.textures.length; i++) {
|
247
|
+
var texture = material.textures[i];
|
248
|
+
|
249
|
+
if (texture.image !== null) {
|
250
|
+
var map = textureLoader.load(texture.image);
|
251
|
+
|
252
|
+
switch (texture.type) {
|
253
|
+
case 'Diffuse':
|
254
|
+
mat.map = map;
|
255
|
+
break;
|
256
|
+
|
257
|
+
case 'Bump':
|
258
|
+
mat.bumpMap = map;
|
259
|
+
break;
|
260
|
+
|
261
|
+
case 'Transparency':
|
262
|
+
mat.alphaMap = map;
|
263
|
+
mat.transparent = true;
|
264
|
+
break;
|
265
|
+
|
266
|
+
case 'Emap':
|
267
|
+
mat.envMap = map;
|
268
|
+
break;
|
269
|
+
}
|
270
|
+
|
271
|
+
map.wrapS = texture.wrapU === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
|
272
|
+
map.wrapT = texture.wrapV === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
|
273
|
+
map.repeat.set(texture.repeat[0], texture.repeat[1]);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
return mat;
|
278
|
+
}
|
279
|
+
}, {
|
280
|
+
key: "_createGeometry",
|
281
|
+
value: function _createGeometry(data) {
|
282
|
+
// console.log(data);
|
283
|
+
var object = new _three.Object3D();
|
284
|
+
var instanceDefinitionObjects = [];
|
285
|
+
var instanceDefinitions = [];
|
286
|
+
var instanceReferences = [];
|
287
|
+
object.userData['layers'] = data.layers;
|
288
|
+
object.userData['groups'] = data.groups;
|
289
|
+
object.userData['settings'] = data.settings;
|
290
|
+
object.userData['objectType'] = 'File3dm';
|
291
|
+
object.userData['materials'] = null;
|
292
|
+
object.name = this.url;
|
293
|
+
var objects = data.objects;
|
294
|
+
var materials = data.materials;
|
295
|
+
|
296
|
+
for (var i = 0; i < objects.length; i++) {
|
297
|
+
var obj = objects[i];
|
298
|
+
var attributes = obj.attributes;
|
299
|
+
|
300
|
+
switch (obj.objectType) {
|
301
|
+
case 'InstanceDefinition':
|
302
|
+
instanceDefinitions.push(obj);
|
303
|
+
break;
|
304
|
+
|
305
|
+
case 'InstanceReference':
|
306
|
+
instanceReferences.push(obj);
|
307
|
+
break;
|
308
|
+
|
309
|
+
default:
|
310
|
+
var _object = void 0;
|
311
|
+
|
312
|
+
if (attributes.materialIndex >= 0) {
|
313
|
+
var rMaterial = materials[attributes.materialIndex];
|
314
|
+
|
315
|
+
var material = this._createMaterial(rMaterial);
|
316
|
+
|
317
|
+
material = this._compareMaterials(material);
|
318
|
+
_object = this._createObject(obj, material);
|
319
|
+
} else {
|
320
|
+
var _material2 = this._createMaterial();
|
321
|
+
|
322
|
+
_object = this._createObject(obj, _material2);
|
323
|
+
}
|
324
|
+
|
325
|
+
if (_object === undefined) {
|
326
|
+
continue;
|
327
|
+
}
|
328
|
+
|
329
|
+
var layer = data.layers[attributes.layerIndex];
|
330
|
+
_object.visible = layer ? data.layers[attributes.layerIndex].visible : true;
|
331
|
+
|
332
|
+
if (attributes.isInstanceDefinitionObject) {
|
333
|
+
instanceDefinitionObjects.push(_object);
|
334
|
+
} else {
|
335
|
+
object.add(_object);
|
336
|
+
}
|
337
|
+
|
338
|
+
break;
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
for (var _i = 0; _i < instanceDefinitions.length; _i++) {
|
343
|
+
var iDef = instanceDefinitions[_i];
|
344
|
+
objects = [];
|
345
|
+
|
346
|
+
for (var j = 0; j < iDef.attributes.objectIds.length; j++) {
|
347
|
+
var objId = iDef.attributes.objectIds[j];
|
348
|
+
|
349
|
+
for (var p = 0; p < instanceDefinitionObjects.length; p++) {
|
350
|
+
var idoId = instanceDefinitionObjects[p].userData.attributes.id;
|
351
|
+
|
352
|
+
if (objId === idoId) {
|
353
|
+
objects.push(instanceDefinitionObjects[p]);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
} // Currently clones geometry and does not take advantage of instancing
|
357
|
+
|
358
|
+
|
359
|
+
for (var _j = 0; _j < instanceReferences.length; _j++) {
|
360
|
+
var iRef = instanceReferences[_j];
|
361
|
+
|
362
|
+
if (iRef.geometry.parentIdefId === iDef.attributes.id) {
|
363
|
+
var iRefObject = new _three.Object3D();
|
364
|
+
var xf = iRef.geometry.xform.array;
|
365
|
+
var matrix = new _three.Matrix4();
|
366
|
+
matrix.set(xf[0], xf[1], xf[2], xf[3], xf[4], xf[5], xf[6], xf[7], xf[8], xf[9], xf[10], xf[11], xf[12], xf[13], xf[14], xf[15]);
|
367
|
+
iRefObject.applyMatrix4(matrix);
|
368
|
+
|
369
|
+
for (var _p = 0; _p < objects.length; _p++) {
|
370
|
+
iRefObject.add(objects[_p].clone(true));
|
371
|
+
}
|
372
|
+
|
373
|
+
object.add(iRefObject);
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
378
|
+
object.userData['materials'] = this.materials;
|
379
|
+
return object;
|
380
|
+
}
|
381
|
+
}, {
|
382
|
+
key: "_createObject",
|
383
|
+
value: function _createObject(obj, mat) {
|
384
|
+
var loader = new _three.BufferGeometryLoader();
|
385
|
+
var attributes = obj.attributes;
|
386
|
+
|
387
|
+
var geometry, material, _color, color;
|
388
|
+
|
389
|
+
switch (obj.objectType) {
|
390
|
+
case 'Point':
|
391
|
+
case 'PointSet':
|
392
|
+
geometry = loader.parse(obj.geometry);
|
393
|
+
|
394
|
+
if (geometry.attributes.hasOwnProperty('color')) {
|
395
|
+
material = new _three.PointsMaterial({
|
396
|
+
vertexColors: true,
|
397
|
+
sizeAttenuation: false,
|
398
|
+
size: 2
|
399
|
+
});
|
400
|
+
} else {
|
401
|
+
_color = attributes.drawColor;
|
402
|
+
color = new _three.Color(_color.r / 255.0, _color.g / 255.0, _color.b / 255.0);
|
403
|
+
material = new _three.PointsMaterial({
|
404
|
+
color: color,
|
405
|
+
sizeAttenuation: false,
|
406
|
+
size: 2
|
407
|
+
});
|
408
|
+
}
|
409
|
+
|
410
|
+
material = this._compareMaterials(material);
|
411
|
+
var points = new _three.Points(geometry, material);
|
412
|
+
points.userData['attributes'] = attributes;
|
413
|
+
points.userData['objectType'] = obj.objectType;
|
414
|
+
|
415
|
+
if (attributes.name) {
|
416
|
+
points.name = attributes.name;
|
417
|
+
}
|
418
|
+
|
419
|
+
return points;
|
420
|
+
|
421
|
+
case 'Mesh':
|
422
|
+
case 'Extrusion':
|
423
|
+
case 'SubD':
|
424
|
+
case 'Brep':
|
425
|
+
if (obj.geometry === null) return;
|
426
|
+
geometry = loader.parse(obj.geometry);
|
427
|
+
|
428
|
+
if (geometry.attributes.hasOwnProperty('color')) {
|
429
|
+
mat.vertexColors = true;
|
430
|
+
}
|
431
|
+
|
432
|
+
if (mat === null) {
|
433
|
+
mat = this._createMaterial();
|
434
|
+
mat = this._compareMaterials(mat);
|
435
|
+
}
|
436
|
+
|
437
|
+
var mesh = new _three.Mesh(geometry, mat);
|
438
|
+
mesh.castShadow = attributes.castsShadows;
|
439
|
+
mesh.receiveShadow = attributes.receivesShadows;
|
440
|
+
mesh.userData['attributes'] = attributes;
|
441
|
+
mesh.userData['objectType'] = obj.objectType;
|
442
|
+
|
443
|
+
if (attributes.name) {
|
444
|
+
mesh.name = attributes.name;
|
445
|
+
}
|
446
|
+
|
447
|
+
return mesh;
|
448
|
+
|
449
|
+
case 'Curve':
|
450
|
+
geometry = loader.parse(obj.geometry);
|
451
|
+
_color = attributes.drawColor;
|
452
|
+
color = new _three.Color(_color.r / 255.0, _color.g / 255.0, _color.b / 255.0);
|
453
|
+
material = new _three.LineBasicMaterial({
|
454
|
+
color: color
|
455
|
+
});
|
456
|
+
material = this._compareMaterials(material);
|
457
|
+
var lines = new _three.Line(geometry, material);
|
458
|
+
lines.userData['attributes'] = attributes;
|
459
|
+
lines.userData['objectType'] = obj.objectType;
|
460
|
+
|
461
|
+
if (attributes.name) {
|
462
|
+
lines.name = attributes.name;
|
463
|
+
}
|
464
|
+
|
465
|
+
return lines;
|
466
|
+
|
467
|
+
case 'TextDot':
|
468
|
+
geometry = obj.geometry;
|
469
|
+
var ctx = document.createElement('canvas').getContext('2d');
|
470
|
+
var font = "".concat(geometry.fontHeight, "px ").concat(geometry.fontFace);
|
471
|
+
ctx.font = font;
|
472
|
+
var width = ctx.measureText(geometry.text).width + 10;
|
473
|
+
var height = geometry.fontHeight + 10;
|
474
|
+
var r = window.devicePixelRatio;
|
475
|
+
ctx.canvas.width = width * r;
|
476
|
+
ctx.canvas.height = height * r;
|
477
|
+
ctx.canvas.style.width = width + 'px';
|
478
|
+
ctx.canvas.style.height = height + 'px';
|
479
|
+
ctx.setTransform(r, 0, 0, r, 0, 0);
|
480
|
+
ctx.font = font;
|
481
|
+
ctx.textBaseline = 'middle';
|
482
|
+
ctx.textAlign = 'center';
|
483
|
+
color = attributes.drawColor;
|
484
|
+
ctx.fillStyle = "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(color.a, ")");
|
485
|
+
ctx.fillRect(0, 0, width, height);
|
486
|
+
ctx.fillStyle = 'white';
|
487
|
+
ctx.fillText(geometry.text, width / 2, height / 2);
|
488
|
+
var texture = new _three.CanvasTexture(ctx.canvas);
|
489
|
+
texture.minFilter = _three.LinearFilter;
|
490
|
+
texture.wrapS = _three.ClampToEdgeWrapping;
|
491
|
+
texture.wrapT = _three.ClampToEdgeWrapping;
|
492
|
+
material = new _three.SpriteMaterial({
|
493
|
+
map: texture,
|
494
|
+
depthTest: false
|
495
|
+
});
|
496
|
+
var sprite = new _three.Sprite(material);
|
497
|
+
sprite.position.set(geometry.point[0], geometry.point[1], geometry.point[2]);
|
498
|
+
sprite.scale.set(width / 10, height / 10, 1.0);
|
499
|
+
sprite.userData['attributes'] = attributes;
|
500
|
+
sprite.userData['objectType'] = obj.objectType;
|
501
|
+
|
502
|
+
if (attributes.name) {
|
503
|
+
sprite.name = attributes.name;
|
504
|
+
}
|
505
|
+
|
506
|
+
return sprite;
|
507
|
+
|
508
|
+
case 'Light':
|
509
|
+
geometry = obj.geometry;
|
510
|
+
var light;
|
511
|
+
|
512
|
+
switch (geometry.lightStyle.name) {
|
513
|
+
case 'LightStyle_WorldPoint':
|
514
|
+
light = new _three.PointLight();
|
515
|
+
light.castShadow = attributes.castsShadows;
|
516
|
+
light.position.set(geometry.location[0], geometry.location[1], geometry.location[2]);
|
517
|
+
light.shadow.normalBias = 0.1;
|
518
|
+
break;
|
519
|
+
|
520
|
+
case 'LightStyle_WorldSpot':
|
521
|
+
light = new _three.SpotLight();
|
522
|
+
light.castShadow = attributes.castsShadows;
|
523
|
+
light.position.set(geometry.location[0], geometry.location[1], geometry.location[2]);
|
524
|
+
light.target.position.set(geometry.direction[0], geometry.direction[1], geometry.direction[2]);
|
525
|
+
light.angle = geometry.spotAngleRadians;
|
526
|
+
light.shadow.normalBias = 0.1;
|
527
|
+
break;
|
528
|
+
|
529
|
+
case 'LightStyle_WorldRectangular':
|
530
|
+
light = new _three.RectAreaLight();
|
531
|
+
|
532
|
+
var _width = Math.abs(geometry.width[2]);
|
533
|
+
|
534
|
+
var _height = Math.abs(geometry.length[0]);
|
535
|
+
|
536
|
+
light.position.set(geometry.location[0] - _height / 2, geometry.location[1], geometry.location[2] - _width / 2);
|
537
|
+
light.height = _height;
|
538
|
+
light.width = _width;
|
539
|
+
light.lookAt(new _three.Vector3(geometry.direction[0], geometry.direction[1], geometry.direction[2]));
|
540
|
+
break;
|
541
|
+
|
542
|
+
case 'LightStyle_WorldDirectional':
|
543
|
+
light = new _three.DirectionalLight();
|
544
|
+
light.castShadow = attributes.castsShadows;
|
545
|
+
light.position.set(geometry.location[0], geometry.location[1], geometry.location[2]);
|
546
|
+
light.target.position.set(geometry.direction[0], geometry.direction[1], geometry.direction[2]);
|
547
|
+
light.shadow.normalBias = 0.1;
|
548
|
+
break;
|
549
|
+
|
550
|
+
case 'LightStyle_WorldLinear':
|
551
|
+
// not conversion exists, warning has already been printed to the console
|
552
|
+
break;
|
553
|
+
|
554
|
+
default:
|
555
|
+
break;
|
556
|
+
}
|
557
|
+
|
558
|
+
if (light) {
|
559
|
+
light.intensity = geometry.intensity;
|
560
|
+
_color = geometry.diffuse;
|
561
|
+
color = new _three.Color(_color.r / 255.0, _color.g / 255.0, _color.b / 255.0);
|
562
|
+
light.color = color;
|
563
|
+
light.userData['attributes'] = attributes;
|
564
|
+
light.userData['objectType'] = obj.objectType;
|
565
|
+
}
|
566
|
+
|
567
|
+
return light;
|
568
|
+
}
|
569
|
+
}
|
570
|
+
}, {
|
571
|
+
key: "_initLibrary",
|
572
|
+
value: function _initLibrary() {
|
573
|
+
var _this5 = this;
|
574
|
+
|
575
|
+
if (!this.libraryPending) {
|
576
|
+
// Load rhino3dm wrapper.
|
577
|
+
var jsLoader = new _three.FileLoader(this.manager);
|
578
|
+
jsLoader.setPath(this.libraryPath);
|
579
|
+
var jsContent = new Promise(function (resolve, reject) {
|
580
|
+
jsLoader.load('rhino3dm.js', resolve, undefined, reject);
|
581
|
+
}); // Load rhino3dm WASM binary.
|
582
|
+
|
583
|
+
var binaryLoader = new _three.FileLoader(this.manager);
|
584
|
+
binaryLoader.setPath(this.libraryPath);
|
585
|
+
binaryLoader.setResponseType('arraybuffer');
|
586
|
+
var binaryContent = new Promise(function (resolve, reject) {
|
587
|
+
binaryLoader.load('rhino3dm.wasm', resolve, undefined, reject);
|
588
|
+
});
|
589
|
+
this.libraryPending = Promise.all([jsContent, binaryContent]).then(function (_ref) {
|
590
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
591
|
+
jsContent = _ref2[0],
|
592
|
+
binaryContent = _ref2[1];
|
593
|
+
|
594
|
+
//this.libraryBinary = binaryContent;
|
595
|
+
_this5.libraryConfig.wasmBinary = binaryContent;
|
596
|
+
var fn = Rhino3dmWorker.toString();
|
597
|
+
var body = ['/* rhino3dm.js */', jsContent, '/* worker */', fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))].join('\n');
|
598
|
+
_this5.workerSourceURL = URL.createObjectURL(new Blob([body]));
|
599
|
+
});
|
600
|
+
}
|
601
|
+
|
602
|
+
return this.libraryPending;
|
603
|
+
}
|
604
|
+
}, {
|
605
|
+
key: "_getWorker",
|
606
|
+
value: function _getWorker(taskCost) {
|
607
|
+
var _this6 = this;
|
608
|
+
|
609
|
+
return this._initLibrary().then(function () {
|
610
|
+
if (_this6.workerPool.length < _this6.workerLimit) {
|
611
|
+
var _worker2 = new Worker(_this6.workerSourceURL);
|
612
|
+
|
613
|
+
_worker2._callbacks = {};
|
614
|
+
_worker2._taskCosts = {};
|
615
|
+
_worker2._taskLoad = 0;
|
616
|
+
|
617
|
+
_worker2.postMessage({
|
618
|
+
type: 'init',
|
619
|
+
libraryConfig: _this6.libraryConfig
|
620
|
+
});
|
621
|
+
|
622
|
+
_worker2.onmessage = function (e) {
|
623
|
+
var message = e.data;
|
624
|
+
|
625
|
+
switch (message.type) {
|
626
|
+
case 'warning':
|
627
|
+
_this6.warnings.push(message.data);
|
628
|
+
|
629
|
+
console.warn(message.data);
|
630
|
+
break;
|
631
|
+
|
632
|
+
case 'decode':
|
633
|
+
_worker2._callbacks[message.id].resolve(message);
|
634
|
+
|
635
|
+
break;
|
636
|
+
|
637
|
+
case 'error':
|
638
|
+
_worker2._callbacks[message.id].reject(message);
|
639
|
+
|
640
|
+
break;
|
641
|
+
|
642
|
+
default:
|
643
|
+
console.error('THREE.Rhino3dmLoader: Unexpected message, "' + message.type + '"');
|
644
|
+
}
|
645
|
+
};
|
646
|
+
|
647
|
+
_this6.workerPool.push(_worker2);
|
648
|
+
} else {
|
649
|
+
_this6.workerPool.sort(function (a, b) {
|
650
|
+
return a._taskLoad > b._taskLoad ? -1 : 1;
|
651
|
+
});
|
652
|
+
}
|
653
|
+
|
654
|
+
var worker = _this6.workerPool[_this6.workerPool.length - 1];
|
655
|
+
worker._taskLoad += taskCost;
|
656
|
+
return worker;
|
657
|
+
});
|
658
|
+
}
|
659
|
+
}, {
|
660
|
+
key: "_releaseTask",
|
661
|
+
value: function _releaseTask(worker, taskID) {
|
662
|
+
worker._taskLoad -= worker._taskCosts[taskID];
|
663
|
+
delete worker._callbacks[taskID];
|
664
|
+
delete worker._taskCosts[taskID];
|
665
|
+
}
|
666
|
+
}, {
|
667
|
+
key: "dispose",
|
668
|
+
value: function dispose() {
|
669
|
+
for (var i = 0; i < this.workerPool.length; ++i) {
|
670
|
+
this.workerPool[i].terminate();
|
671
|
+
}
|
672
|
+
|
673
|
+
this.workerPool.length = 0;
|
674
|
+
return this;
|
675
|
+
}
|
676
|
+
}]);
|
677
|
+
|
678
|
+
return Rhino3dmLoader;
|
679
|
+
}(_three.Loader);
|
680
|
+
/* WEB WORKER */
|
681
|
+
|
682
|
+
|
683
|
+
_exports.Rhino3dmLoader = Rhino3dmLoader;
|
684
|
+
|
685
|
+
function Rhino3dmWorker() {
|
686
|
+
var libraryPending;
|
687
|
+
var libraryConfig;
|
688
|
+
var rhino;
|
689
|
+
var taskID;
|
690
|
+
|
691
|
+
onmessage = function onmessage(e) {
|
692
|
+
var message = e.data;
|
693
|
+
|
694
|
+
switch (message.type) {
|
695
|
+
case 'init':
|
696
|
+
// console.log(message)
|
697
|
+
libraryConfig = message.libraryConfig;
|
698
|
+
var wasmBinary = libraryConfig.wasmBinary;
|
699
|
+
var RhinoModule;
|
700
|
+
libraryPending = new Promise(function (resolve) {
|
701
|
+
/* Like Basis Loader */
|
702
|
+
RhinoModule = {
|
703
|
+
wasmBinary: wasmBinary,
|
704
|
+
onRuntimeInitialized: resolve
|
705
|
+
};
|
706
|
+
rhino3dm(RhinoModule); // eslint-disable-line no-undef
|
707
|
+
}).then(function () {
|
708
|
+
rhino = RhinoModule;
|
709
|
+
});
|
710
|
+
break;
|
711
|
+
|
712
|
+
case 'decode':
|
713
|
+
taskID = message.id;
|
714
|
+
var buffer = message.buffer;
|
715
|
+
libraryPending.then(function () {
|
716
|
+
try {
|
717
|
+
var data = decodeObjects(rhino, buffer);
|
718
|
+
self.postMessage({
|
719
|
+
type: 'decode',
|
720
|
+
id: message.id,
|
721
|
+
data: data
|
722
|
+
});
|
723
|
+
} catch (error) {
|
724
|
+
self.postMessage({
|
725
|
+
type: 'error',
|
726
|
+
id: message.id,
|
727
|
+
error: error
|
728
|
+
});
|
729
|
+
}
|
730
|
+
});
|
731
|
+
break;
|
732
|
+
}
|
733
|
+
};
|
734
|
+
|
735
|
+
function decodeObjects(rhino, buffer) {
|
736
|
+
var arr = new Uint8Array(buffer);
|
737
|
+
var doc = rhino.File3dm.fromByteArray(arr);
|
738
|
+
var objects = [];
|
739
|
+
var materials = [];
|
740
|
+
var layers = [];
|
741
|
+
var views = [];
|
742
|
+
var namedViews = [];
|
743
|
+
var groups = [];
|
744
|
+
var strings = []; //Handle objects
|
745
|
+
|
746
|
+
var objs = doc.objects();
|
747
|
+
var cnt = objs.count;
|
748
|
+
|
749
|
+
for (var i = 0; i < cnt; i++) {
|
750
|
+
var _object = objs.get(i);
|
751
|
+
|
752
|
+
var object = extractObjectData(_object, doc);
|
753
|
+
|
754
|
+
_object.delete();
|
755
|
+
|
756
|
+
if (object) {
|
757
|
+
objects.push(object);
|
758
|
+
}
|
759
|
+
} // Handle instance definitions
|
760
|
+
// console.log( `Instance Definitions Count: ${doc.instanceDefinitions().count()}` );
|
761
|
+
|
762
|
+
|
763
|
+
for (var _i2 = 0; _i2 < doc.instanceDefinitions().count(); _i2++) {
|
764
|
+
var idef = doc.instanceDefinitions().get(_i2);
|
765
|
+
var idefAttributes = extractProperties(idef);
|
766
|
+
idefAttributes.objectIds = idef.getObjectIds();
|
767
|
+
objects.push({
|
768
|
+
geometry: null,
|
769
|
+
attributes: idefAttributes,
|
770
|
+
objectType: 'InstanceDefinition'
|
771
|
+
});
|
772
|
+
} // Handle materials
|
773
|
+
|
774
|
+
|
775
|
+
var textureTypes = [// rhino.TextureType.Bitmap,
|
776
|
+
rhino.TextureType.Diffuse, rhino.TextureType.Bump, rhino.TextureType.Transparency, rhino.TextureType.Opacity, rhino.TextureType.Emap];
|
777
|
+
var pbrTextureTypes = [rhino.TextureType.PBR_BaseColor, rhino.TextureType.PBR_Subsurface, rhino.TextureType.PBR_SubsurfaceScattering, rhino.TextureType.PBR_SubsurfaceScatteringRadius, rhino.TextureType.PBR_Metallic, rhino.TextureType.PBR_Specular, rhino.TextureType.PBR_SpecularTint, rhino.TextureType.PBR_Roughness, rhino.TextureType.PBR_Anisotropic, rhino.TextureType.PBR_Anisotropic_Rotation, rhino.TextureType.PBR_Sheen, rhino.TextureType.PBR_SheenTint, rhino.TextureType.PBR_Clearcoat, rhino.TextureType.PBR_ClearcoatBump, rhino.TextureType.PBR_ClearcoatRoughness, rhino.TextureType.PBR_OpacityIor, rhino.TextureType.PBR_OpacityRoughness, rhino.TextureType.PBR_Emission, rhino.TextureType.PBR_AmbientOcclusion, rhino.TextureType.PBR_Displacement];
|
778
|
+
|
779
|
+
for (var _i3 = 0; _i3 < doc.materials().count(); _i3++) {
|
780
|
+
var _material = doc.materials().get(_i3);
|
781
|
+
|
782
|
+
var _pbrMaterial = _material.physicallyBased();
|
783
|
+
|
784
|
+
var material = extractProperties(_material);
|
785
|
+
var textures = [];
|
786
|
+
|
787
|
+
for (var j = 0; j < textureTypes.length; j++) {
|
788
|
+
var _texture = _material.getTexture(textureTypes[j]);
|
789
|
+
|
790
|
+
if (_texture) {
|
791
|
+
var textureType = textureTypes[j].constructor.name;
|
792
|
+
textureType = textureType.substring(12, textureType.length);
|
793
|
+
var texture = {
|
794
|
+
type: textureType
|
795
|
+
};
|
796
|
+
var image = doc.getEmbeddedFileAsBase64(_texture.fileName);
|
797
|
+
texture.wrapU = _texture.wrapU;
|
798
|
+
texture.wrapV = _texture.wrapV;
|
799
|
+
texture.wrapW = _texture.wrapW;
|
800
|
+
|
801
|
+
var uvw = _texture.uvwTransform.toFloatArray(true);
|
802
|
+
|
803
|
+
texture.repeat = [uvw[0], uvw[5]];
|
804
|
+
|
805
|
+
if (image) {
|
806
|
+
texture.image = 'data:image/png;base64,' + image;
|
807
|
+
} else {
|
808
|
+
self.postMessage({
|
809
|
+
type: 'warning',
|
810
|
+
id: taskID,
|
811
|
+
data: {
|
812
|
+
message: "THREE.3DMLoader: Image for ".concat(textureType, " texture not embedded in file."),
|
813
|
+
type: 'missing resource'
|
814
|
+
}
|
815
|
+
});
|
816
|
+
texture.image = null;
|
817
|
+
}
|
818
|
+
|
819
|
+
textures.push(texture);
|
820
|
+
|
821
|
+
_texture.delete();
|
822
|
+
}
|
823
|
+
}
|
824
|
+
|
825
|
+
material.textures = textures;
|
826
|
+
|
827
|
+
if (_pbrMaterial.supported) {
|
828
|
+
for (var _j2 = 0; _j2 < pbrTextureTypes.length; _j2++) {
|
829
|
+
var _texture2 = _material.getTexture(pbrTextureTypes[_j2]);
|
830
|
+
|
831
|
+
if (_texture2) {
|
832
|
+
var _image = doc.getEmbeddedFileAsBase64(_texture2.fileName);
|
833
|
+
|
834
|
+
var _textureType = pbrTextureTypes[_j2].constructor.name;
|
835
|
+
_textureType = _textureType.substring(12, _textureType.length);
|
836
|
+
var _texture3 = {
|
837
|
+
type: _textureType,
|
838
|
+
image: 'data:image/png;base64,' + _image
|
839
|
+
};
|
840
|
+
textures.push(_texture3);
|
841
|
+
|
842
|
+
_texture2.delete();
|
843
|
+
}
|
844
|
+
}
|
845
|
+
|
846
|
+
var pbMaterialProperties = extractProperties(_material.physicallyBased());
|
847
|
+
material = Object.assign(pbMaterialProperties, material);
|
848
|
+
}
|
849
|
+
|
850
|
+
materials.push(material);
|
851
|
+
|
852
|
+
_material.delete();
|
853
|
+
|
854
|
+
_pbrMaterial.delete();
|
855
|
+
} // Handle layers
|
856
|
+
|
857
|
+
|
858
|
+
for (var _i4 = 0; _i4 < doc.layers().count(); _i4++) {
|
859
|
+
var _layer = doc.layers().get(_i4);
|
860
|
+
|
861
|
+
var layer = extractProperties(_layer);
|
862
|
+
layers.push(layer);
|
863
|
+
|
864
|
+
_layer.delete();
|
865
|
+
} // Handle views
|
866
|
+
|
867
|
+
|
868
|
+
for (var _i5 = 0; _i5 < doc.views().count(); _i5++) {
|
869
|
+
var _view = doc.views().get(_i5);
|
870
|
+
|
871
|
+
var view = extractProperties(_view);
|
872
|
+
views.push(view);
|
873
|
+
|
874
|
+
_view.delete();
|
875
|
+
} // Handle named views
|
876
|
+
|
877
|
+
|
878
|
+
for (var _i6 = 0; _i6 < doc.namedViews().count(); _i6++) {
|
879
|
+
var _namedView = doc.namedViews().get(_i6);
|
880
|
+
|
881
|
+
var namedView = extractProperties(_namedView);
|
882
|
+
namedViews.push(namedView);
|
883
|
+
|
884
|
+
_namedView.delete();
|
885
|
+
} // Handle groups
|
886
|
+
|
887
|
+
|
888
|
+
for (var _i7 = 0; _i7 < doc.groups().count(); _i7++) {
|
889
|
+
var _group = doc.groups().get(_i7);
|
890
|
+
|
891
|
+
var group = extractProperties(_group);
|
892
|
+
groups.push(group);
|
893
|
+
|
894
|
+
_group.delete();
|
895
|
+
} // Handle settings
|
896
|
+
|
897
|
+
|
898
|
+
var settings = extractProperties(doc.settings()); //TODO: Handle other document stuff like dimstyles, instance definitions, bitmaps etc.
|
899
|
+
// Handle dimstyles
|
900
|
+
// console.log( `Dimstyle Count: ${doc.dimstyles().count()}` );
|
901
|
+
// Handle bitmaps
|
902
|
+
// console.log( `Bitmap Count: ${doc.bitmaps().count()}` );
|
903
|
+
// Handle strings
|
904
|
+
// console.log( `Document Strings Count: ${doc.strings().count()}` );
|
905
|
+
// Note: doc.strings().documentUserTextCount() counts any doc.strings defined in a section
|
906
|
+
//console.log( `Document User Text Count: ${doc.strings().documentUserTextCount()}` );
|
907
|
+
|
908
|
+
var strings_count = doc.strings().count();
|
909
|
+
|
910
|
+
for (var _i8 = 0; _i8 < strings_count; _i8++) {
|
911
|
+
strings.push(doc.strings().get(_i8));
|
912
|
+
}
|
913
|
+
|
914
|
+
doc.delete();
|
915
|
+
return {
|
916
|
+
objects: objects,
|
917
|
+
materials: materials,
|
918
|
+
layers: layers,
|
919
|
+
views: views,
|
920
|
+
namedViews: namedViews,
|
921
|
+
groups: groups,
|
922
|
+
strings: strings,
|
923
|
+
settings: settings
|
924
|
+
};
|
925
|
+
}
|
926
|
+
|
927
|
+
function extractObjectData(object, doc) {
|
928
|
+
var _geometry = object.geometry();
|
929
|
+
|
930
|
+
var _attributes = object.attributes();
|
931
|
+
|
932
|
+
var objectType = _geometry.objectType;
|
933
|
+
var geometry, attributes, position, data, mesh; // skip instance definition objects
|
934
|
+
//if( _attributes.isInstanceDefinitionObject ) { continue; }
|
935
|
+
// TODO: handle other geometry types
|
936
|
+
|
937
|
+
switch (objectType) {
|
938
|
+
case rhino.ObjectType.Curve:
|
939
|
+
var pts = curveToPoints(_geometry, 100);
|
940
|
+
position = {};
|
941
|
+
attributes = {};
|
942
|
+
data = {};
|
943
|
+
position.itemSize = 3;
|
944
|
+
position.type = 'Float32Array';
|
945
|
+
position.array = [];
|
946
|
+
|
947
|
+
for (var j = 0; j < pts.length; j++) {
|
948
|
+
position.array.push(pts[j][0]);
|
949
|
+
position.array.push(pts[j][1]);
|
950
|
+
position.array.push(pts[j][2]);
|
951
|
+
}
|
952
|
+
|
953
|
+
attributes.position = position;
|
954
|
+
data.attributes = attributes;
|
955
|
+
geometry = {
|
956
|
+
data: data
|
957
|
+
};
|
958
|
+
break;
|
959
|
+
|
960
|
+
case rhino.ObjectType.Point:
|
961
|
+
var pt = _geometry.location;
|
962
|
+
position = {};
|
963
|
+
var color = {};
|
964
|
+
attributes = {};
|
965
|
+
data = {};
|
966
|
+
position.itemSize = 3;
|
967
|
+
position.type = 'Float32Array';
|
968
|
+
position.array = [pt[0], pt[1], pt[2]];
|
969
|
+
|
970
|
+
var _color = _attributes.drawColor(doc);
|
971
|
+
|
972
|
+
color.itemSize = 3;
|
973
|
+
color.type = 'Float32Array';
|
974
|
+
color.array = [_color.r / 255.0, _color.g / 255.0, _color.b / 255.0];
|
975
|
+
attributes.position = position;
|
976
|
+
attributes.color = color;
|
977
|
+
data.attributes = attributes;
|
978
|
+
geometry = {
|
979
|
+
data: data
|
980
|
+
};
|
981
|
+
break;
|
982
|
+
|
983
|
+
case rhino.ObjectType.PointSet:
|
984
|
+
case rhino.ObjectType.Mesh:
|
985
|
+
geometry = _geometry.toThreejsJSON();
|
986
|
+
break;
|
987
|
+
|
988
|
+
case rhino.ObjectType.Brep:
|
989
|
+
var faces = _geometry.faces();
|
990
|
+
|
991
|
+
mesh = new rhino.Mesh();
|
992
|
+
|
993
|
+
for (var faceIndex = 0; faceIndex < faces.count; faceIndex++) {
|
994
|
+
var face = faces.get(faceIndex);
|
995
|
+
|
996
|
+
var _mesh = face.getMesh(rhino.MeshType.Any);
|
997
|
+
|
998
|
+
if (_mesh) {
|
999
|
+
mesh.append(_mesh);
|
1000
|
+
|
1001
|
+
_mesh.delete();
|
1002
|
+
}
|
1003
|
+
|
1004
|
+
face.delete();
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
if (mesh.faces().count > 0) {
|
1008
|
+
mesh.compact();
|
1009
|
+
geometry = mesh.toThreejsJSON();
|
1010
|
+
faces.delete();
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
mesh.delete();
|
1014
|
+
break;
|
1015
|
+
|
1016
|
+
case rhino.ObjectType.Extrusion:
|
1017
|
+
mesh = _geometry.getMesh(rhino.MeshType.Any);
|
1018
|
+
|
1019
|
+
if (mesh) {
|
1020
|
+
geometry = mesh.toThreejsJSON();
|
1021
|
+
mesh.delete();
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
break;
|
1025
|
+
|
1026
|
+
case rhino.ObjectType.TextDot:
|
1027
|
+
geometry = extractProperties(_geometry);
|
1028
|
+
break;
|
1029
|
+
|
1030
|
+
case rhino.ObjectType.Light:
|
1031
|
+
geometry = extractProperties(_geometry);
|
1032
|
+
|
1033
|
+
if (geometry.lightStyle.name === 'LightStyle_WorldLinear') {
|
1034
|
+
self.postMessage({
|
1035
|
+
type: 'warning',
|
1036
|
+
id: taskID,
|
1037
|
+
data: {
|
1038
|
+
message: "THREE.3DMLoader: No conversion exists for ".concat(objectType.constructor.name, " ").concat(geometry.lightStyle.name),
|
1039
|
+
type: 'no conversion',
|
1040
|
+
guid: _attributes.id
|
1041
|
+
}
|
1042
|
+
});
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
break;
|
1046
|
+
|
1047
|
+
case rhino.ObjectType.InstanceReference:
|
1048
|
+
geometry = extractProperties(_geometry);
|
1049
|
+
geometry.xform = extractProperties(_geometry.xform);
|
1050
|
+
geometry.xform.array = _geometry.xform.toFloatArray(true);
|
1051
|
+
break;
|
1052
|
+
|
1053
|
+
case rhino.ObjectType.SubD:
|
1054
|
+
// TODO: precalculate resulting vertices and faces and warn on excessive results
|
1055
|
+
_geometry.subdivide(3);
|
1056
|
+
|
1057
|
+
mesh = rhino.Mesh.createFromSubDControlNet(_geometry);
|
1058
|
+
|
1059
|
+
if (mesh) {
|
1060
|
+
geometry = mesh.toThreejsJSON();
|
1061
|
+
mesh.delete();
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
break;
|
1065
|
+
|
1066
|
+
/*
|
1067
|
+
case rhino.ObjectType.Annotation:
|
1068
|
+
case rhino.ObjectType.Hatch:
|
1069
|
+
case rhino.ObjectType.ClipPlane:
|
1070
|
+
*/
|
1071
|
+
|
1072
|
+
default:
|
1073
|
+
self.postMessage({
|
1074
|
+
type: 'warning',
|
1075
|
+
id: taskID,
|
1076
|
+
data: {
|
1077
|
+
message: "THREE.3DMLoader: Conversion not implemented for ".concat(objectType.constructor.name),
|
1078
|
+
type: 'not implemented',
|
1079
|
+
guid: _attributes.id
|
1080
|
+
}
|
1081
|
+
});
|
1082
|
+
break;
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
if (geometry) {
|
1086
|
+
attributes = extractProperties(_attributes);
|
1087
|
+
attributes.geometry = extractProperties(_geometry);
|
1088
|
+
|
1089
|
+
if (_attributes.groupCount > 0) {
|
1090
|
+
attributes.groupIds = _attributes.getGroupList();
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
if (_attributes.userStringCount > 0) {
|
1094
|
+
attributes.userStrings = _attributes.getUserStrings();
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
if (_geometry.userStringCount > 0) {
|
1098
|
+
attributes.geometry.userStrings = _geometry.getUserStrings();
|
1099
|
+
}
|
1100
|
+
|
1101
|
+
attributes.drawColor = _attributes.drawColor(doc);
|
1102
|
+
objectType = objectType.constructor.name;
|
1103
|
+
objectType = objectType.substring(11, objectType.length);
|
1104
|
+
return {
|
1105
|
+
geometry: geometry,
|
1106
|
+
attributes: attributes,
|
1107
|
+
objectType: objectType
|
1108
|
+
};
|
1109
|
+
} else {
|
1110
|
+
self.postMessage({
|
1111
|
+
type: 'warning',
|
1112
|
+
id: taskID,
|
1113
|
+
data: {
|
1114
|
+
message: "THREE.3DMLoader: ".concat(objectType.constructor.name, " has no associated mesh geometry."),
|
1115
|
+
type: 'missing mesh',
|
1116
|
+
guid: _attributes.id
|
1117
|
+
}
|
1118
|
+
});
|
1119
|
+
}
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
function extractProperties(object) {
|
1123
|
+
var result = {};
|
1124
|
+
|
1125
|
+
for (var property in object) {
|
1126
|
+
var value = object[property];
|
1127
|
+
|
1128
|
+
if (typeof value !== 'function') {
|
1129
|
+
if (typeof value === 'object' && value !== null && value.hasOwnProperty('constructor')) {
|
1130
|
+
result[property] = {
|
1131
|
+
name: value.constructor.name,
|
1132
|
+
value: value.value
|
1133
|
+
};
|
1134
|
+
} else {
|
1135
|
+
result[property] = value;
|
1136
|
+
}
|
1137
|
+
} else {// these are functions that could be called to extract more data.
|
1138
|
+
//console.log( `${property}: ${object[ property ].constructor.name}` );
|
1139
|
+
}
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
return result;
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
function curveToPoints(curve, pointLimit) {
|
1146
|
+
var pointCount = pointLimit;
|
1147
|
+
var rc = [];
|
1148
|
+
var ts = [];
|
1149
|
+
|
1150
|
+
if (curve instanceof rhino.LineCurve) {
|
1151
|
+
return [curve.pointAtStart, curve.pointAtEnd];
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
if (curve instanceof rhino.PolylineCurve) {
|
1155
|
+
pointCount = curve.pointCount;
|
1156
|
+
|
1157
|
+
for (var i = 0; i < pointCount; i++) {
|
1158
|
+
rc.push(curve.point(i));
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
return rc;
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
if (curve instanceof rhino.PolyCurve) {
|
1165
|
+
var segmentCount = curve.segmentCount;
|
1166
|
+
|
1167
|
+
for (var _i9 = 0; _i9 < segmentCount; _i9++) {
|
1168
|
+
var segment = curve.segmentCurve(_i9);
|
1169
|
+
var segmentArray = curveToPoints(segment, pointCount);
|
1170
|
+
rc = rc.concat(segmentArray);
|
1171
|
+
segment.delete();
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
return rc;
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
if (curve instanceof rhino.ArcCurve) {
|
1178
|
+
pointCount = Math.floor(curve.angleDegrees / 5);
|
1179
|
+
pointCount = pointCount < 2 ? 2 : pointCount; // alternative to this hardcoded version: https://stackoverflow.com/a/18499923/2179399
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
if (curve instanceof rhino.NurbsCurve && curve.degree === 1) {
|
1183
|
+
var pLine = curve.tryGetPolyline();
|
1184
|
+
|
1185
|
+
for (var _i10 = 0; _i10 < pLine.count; _i10++) {
|
1186
|
+
rc.push(pLine.get(_i10));
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
pLine.delete();
|
1190
|
+
return rc;
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
var domain = curve.domain;
|
1194
|
+
var divisions = pointCount - 1.0;
|
1195
|
+
|
1196
|
+
for (var j = 0; j < pointCount; j++) {
|
1197
|
+
var t = domain[0] + j / divisions * (domain[1] - domain[0]);
|
1198
|
+
|
1199
|
+
if (t === domain[0] || t === domain[1]) {
|
1200
|
+
ts.push(t);
|
1201
|
+
continue;
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
var tan = curve.tangentAt(t);
|
1205
|
+
var prevTan = curve.tangentAt(ts.slice(-1)[0]); // Duplicated from THREE.Vector3
|
1206
|
+
// How to pass imports to worker?
|
1207
|
+
|
1208
|
+
var tS = tan[0] * tan[0] + tan[1] * tan[1] + tan[2] * tan[2];
|
1209
|
+
var ptS = prevTan[0] * prevTan[0] + prevTan[1] * prevTan[1] + prevTan[2] * prevTan[2];
|
1210
|
+
var denominator = Math.sqrt(tS * ptS);
|
1211
|
+
var angle = void 0;
|
1212
|
+
|
1213
|
+
if (denominator === 0) {
|
1214
|
+
angle = Math.PI / 2;
|
1215
|
+
} else {
|
1216
|
+
var theta = (tan.x * prevTan.x + tan.y * prevTan.y + tan.z * prevTan.z) / denominator;
|
1217
|
+
angle = Math.acos(Math.max(-1, Math.min(1, theta)));
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
if (angle < 0.1) continue;
|
1221
|
+
ts.push(t);
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
rc = ts.map(function (t) {
|
1225
|
+
return curve.pointAt(t);
|
1226
|
+
});
|
1227
|
+
return rc;
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
});
|