three-stdlib 2.25.0 → 2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- package/controls/OrbitControls.d.ts +1 -0
- package/index.cjs +116465 -611
- package/index.js +116101 -263
- package/package.json +17 -4
- package/_polyfill/CapsuleGeometry.cjs +0 -22
- package/_polyfill/CapsuleGeometry.js +0 -22
- package/_polyfill/CompressedArrayTexture.cjs +0 -12
- package/_polyfill/CompressedArrayTexture.js +0 -12
- package/_polyfill/Data3DTexture.cjs +0 -17
- package/_polyfill/Data3DTexture.js +0 -17
- package/animation/AnimationClipCreator.cjs +0 -56
- package/animation/AnimationClipCreator.js +0 -56
- package/animation/CCDIKSolver.cjs +0 -269
- package/animation/CCDIKSolver.js +0 -269
- package/animation/MMDAnimationHelper.cjs +0 -688
- package/animation/MMDAnimationHelper.js +0 -688
- package/animation/MMDPhysics.cjs +0 -830
- package/animation/MMDPhysics.js +0 -830
- package/cameras/CinematicCamera.cjs +0 -131
- package/cameras/CinematicCamera.js +0 -131
- package/controls/ArcballControls.cjs +0 -2033
- package/controls/ArcballControls.js +0 -2033
- package/controls/DeviceOrientationControls.cjs +0 -85
- package/controls/DeviceOrientationControls.js +0 -85
- package/controls/DragControls.cjs +0 -182
- package/controls/DragControls.js +0 -182
- package/controls/FirstPersonControls.cjs +0 -229
- package/controls/FirstPersonControls.js +0 -229
- package/controls/FlyControls.cjs +0 -248
- package/controls/FlyControls.js +0 -248
- package/controls/OrbitControls.cjs +0 -791
- package/controls/OrbitControls.js +0 -791
- package/controls/PointerLockControls.cjs +0 -103
- package/controls/PointerLockControls.js +0 -103
- package/controls/TrackballControls.cjs +0 -502
- package/controls/TrackballControls.js +0 -502
- package/controls/TransformControls.cjs +0 -1089
- package/controls/TransformControls.js +0 -1089
- package/controls/experimental/CameraControls.cjs +0 -736
- package/controls/experimental/CameraControls.js +0 -736
- package/csm/CSM.cjs +0 -244
- package/csm/CSM.js +0 -244
- package/csm/CSMFrustum.cjs +0 -75
- package/csm/CSMFrustum.js +0 -75
- package/csm/CSMHelper.cjs +0 -114
- package/csm/CSMHelper.js +0 -114
- package/csm/CSMShader.cjs +0 -261
- package/csm/CSMShader.js +0 -261
- package/curves/CurveExtras.cjs +0 -214
- package/curves/CurveExtras.js +0 -214
- package/curves/NURBSCurve.cjs +0 -35
- package/curves/NURBSCurve.js +0 -35
- package/curves/NURBSSurface.cjs +0 -28
- package/curves/NURBSSurface.js +0 -28
- package/curves/NURBSUtils.cjs +0 -226
- package/curves/NURBSUtils.js +0 -226
- package/deprecated/Geometry.cjs +0 -971
- package/deprecated/Geometry.js +0 -971
- package/effects/AnaglyphEffect.cjs +0 -102
- package/effects/AnaglyphEffect.js +0 -102
- package/effects/AsciiEffect.cjs +0 -155
- package/effects/AsciiEffect.js +0 -155
- package/effects/OutlineEffect.cjs +0 -275
- package/effects/OutlineEffect.js +0 -275
- package/effects/ParallaxBarrierEffect.cjs +0 -65
- package/effects/ParallaxBarrierEffect.js +0 -65
- package/effects/PeppersGhostEffect.cjs +0 -88
- package/effects/PeppersGhostEffect.js +0 -88
- package/effects/StereoEffect.cjs +0 -35
- package/effects/StereoEffect.js +0 -35
- package/environments/RoomEnvironment.cjs +0 -95
- package/environments/RoomEnvironment.js +0 -78
- package/exporters/ColladaExporter.cjs +0 -331
- package/exporters/ColladaExporter.js +0 -331
- package/exporters/DRACOExporter.cjs +0 -141
- package/exporters/DRACOExporter.js +0 -141
- package/exporters/GLTFExporter.cjs +0 -1909
- package/exporters/GLTFExporter.js +0 -1909
- package/exporters/MMDExporter.cjs +0 -131
- package/exporters/MMDExporter.js +0 -131
- package/exporters/OBJExporter.cjs +0 -181
- package/exporters/OBJExporter.js +0 -181
- package/exporters/PLYExporter.cjs +0 -280
- package/exporters/PLYExporter.js +0 -280
- package/exporters/STLExporter.cjs +0 -146
- package/exporters/STLExporter.js +0 -146
- package/exporters/USDZExporter.cjs +0 -340
- package/exporters/USDZExporter.js +0 -340
- package/geometries/BoxLineGeometry.cjs +0 -45
- package/geometries/BoxLineGeometry.js +0 -45
- package/geometries/ConvexGeometry.cjs +0 -26
- package/geometries/ConvexGeometry.js +0 -26
- package/geometries/DecalGeometry.cjs +0 -184
- package/geometries/DecalGeometry.js +0 -184
- package/geometries/LightningStrike.cjs +0 -553
- package/geometries/LightningStrike.js +0 -553
- package/geometries/ParametricGeometries.cjs +0 -130
- package/geometries/ParametricGeometries.js +0 -130
- package/geometries/ParametricGeometry.cjs +0 -63
- package/geometries/ParametricGeometry.js +0 -63
- package/geometries/RoundedBoxGeometry.cjs +0 -91
- package/geometries/RoundedBoxGeometry.js +0 -91
- package/geometries/TeapotGeometry.cjs +0 -1563
- package/geometries/TeapotGeometry.js +0 -1563
- package/geometries/TextGeometry.cjs +0 -27
- package/geometries/TextGeometry.js +0 -27
- package/helpers/LightProbeHelper.cjs +0 -73
- package/helpers/LightProbeHelper.js +0 -73
- package/helpers/PositionalAudioHelper.cjs +0 -68
- package/helpers/PositionalAudioHelper.js +0 -68
- package/helpers/RectAreaLightHelper.cjs +0 -44
- package/helpers/RectAreaLightHelper.js +0 -44
- package/helpers/VertexNormalsHelper.cjs +0 -47
- package/helpers/VertexNormalsHelper.js +0 -47
- package/helpers/VertexTangentsHelper.cjs +0 -43
- package/helpers/VertexTangentsHelper.js +0 -43
- package/interactive/HTMLMesh.cjs +0 -325
- package/interactive/HTMLMesh.js +0 -325
- package/interactive/InteractiveGroup.cjs +0 -68
- package/interactive/InteractiveGroup.js +0 -68
- package/interactive/SelectionBox.cjs +0 -134
- package/interactive/SelectionBox.js +0 -134
- package/interactive/SelectionHelper.cjs +0 -51
- package/interactive/SelectionHelper.js +0 -51
- package/libs/MeshoptDecoder.cjs +0 -221
- package/libs/MeshoptDecoder.js +0 -221
- package/libs/MotionControllers.cjs +0 -325
- package/libs/MotionControllers.js +0 -325
- package/lights/LightProbeGenerator.cjs +0 -145
- package/lights/LightProbeGenerator.js +0 -145
- package/lights/RectAreaLightUniformsLib.cjs +0 -32846
- package/lights/RectAreaLightUniformsLib.js +0 -32846
- package/lines/Line2.cjs +0 -13
- package/lines/Line2.js +0 -13
- package/lines/LineGeometry.cjs +0 -44
- package/lines/LineGeometry.js +0 -44
- package/lines/LineMaterial.cjs +0 -547
- package/lines/LineMaterial.js +0 -547
- package/lines/LineSegments2.cjs +0 -203
- package/lines/LineSegments2.js +0 -203
- package/lines/LineSegmentsGeometry.cjs +0 -124
- package/lines/LineSegmentsGeometry.js +0 -124
- package/lines/Wireframe.cjs +0 -32
- package/lines/Wireframe.js +0 -32
- package/lines/WireframeGeometry2.cjs +0 -13
- package/lines/WireframeGeometry2.js +0 -13
- package/loaders/3DMLoader.cjs +0 -803
- package/loaders/3DMLoader.js +0 -803
- package/loaders/3MFLoader.cjs +0 -854
- package/loaders/3MFLoader.js +0 -854
- package/loaders/AMFLoader.cjs +0 -284
- package/loaders/AMFLoader.js +0 -284
- package/loaders/AssimpLoader.cjs +0 -1434
- package/loaders/AssimpLoader.js +0 -1434
- package/loaders/BVHLoader.cjs +0 -207
- package/loaders/BVHLoader.js +0 -207
- package/loaders/BasisTextureLoader.cjs +0 -489
- package/loaders/BasisTextureLoader.js +0 -489
- package/loaders/ColladaLoader.cjs +0 -2405
- package/loaders/ColladaLoader.js +0 -2405
- package/loaders/DDSLoader.cjs +0 -148
- package/loaders/DDSLoader.js +0 -148
- package/loaders/DRACOLoader.cjs +0 -341
- package/loaders/DRACOLoader.js +0 -341
- package/loaders/EXRLoader.cjs +0 -1356
- package/loaders/EXRLoader.js +0 -1356
- package/loaders/FBXLoader.cjs +0 -2457
- package/loaders/FBXLoader.js +0 -2457
- package/loaders/FontLoader.cjs +0 -123
- package/loaders/FontLoader.js +0 -123
- package/loaders/GCodeLoader.cjs +0 -141
- package/loaders/GCodeLoader.js +0 -141
- package/loaders/GLTFLoader.cjs +0 -2504
- package/loaders/GLTFLoader.js +0 -2504
- package/loaders/HDRCubeTextureLoader.cjs +0 -75
- package/loaders/HDRCubeTextureLoader.js +0 -75
- package/loaders/KMZLoader.cjs +0 -75
- package/loaders/KMZLoader.js +0 -75
- package/loaders/KTX2Loader.cjs +0 -480
- package/loaders/KTX2Loader.js +0 -480
- package/loaders/KTXLoader.cjs +0 -93
- package/loaders/KTXLoader.js +0 -93
- package/loaders/LDrawLoader.cjs +0 -1424
- package/loaders/LDrawLoader.js +0 -1424
- package/loaders/LUT3dlLoader.cjs +0 -103
- package/loaders/LUT3dlLoader.js +0 -103
- package/loaders/LUTCubeLoader.cjs +0 -107
- package/loaders/LUTCubeLoader.js +0 -107
- package/loaders/LWOLoader.cjs +0 -645
- package/loaders/LWOLoader.js +0 -645
- package/loaders/LottieLoader.cjs +0 -47
- package/loaders/LottieLoader.js +0 -47
- package/loaders/MD2Loader.cjs +0 -359
- package/loaders/MD2Loader.js +0 -359
- package/loaders/MDDLoader.cjs +0 -58
- package/loaders/MDDLoader.js +0 -58
- package/loaders/MMDLoader.cjs +0 -1121
- package/loaders/MMDLoader.js +0 -1121
- package/loaders/MTLLoader.cjs +0 -304
- package/loaders/MTLLoader.js +0 -304
- package/loaders/NRRDLoader.cjs +0 -401
- package/loaders/NRRDLoader.js +0 -401
- package/loaders/OBJLoader.cjs +0 -487
- package/loaders/OBJLoader.js +0 -487
- package/loaders/PCDLoader.cjs +0 -248
- package/loaders/PCDLoader.js +0 -248
- package/loaders/PDBLoader.cjs +0 -247
- package/loaders/PDBLoader.js +0 -247
- package/loaders/PLYLoader.cjs +0 -317
- package/loaders/PLYLoader.js +0 -317
- package/loaders/PRWMLoader.cjs +0 -160
- package/loaders/PRWMLoader.js +0 -160
- package/loaders/PVRLoader.cjs +0 -131
- package/loaders/PVRLoader.js +0 -131
- package/loaders/RGBELoader.cjs +0 -252
- package/loaders/RGBELoader.js +0 -252
- package/loaders/RGBMLoader.cjs +0 -1004
- package/loaders/RGBMLoader.js +0 -1004
- package/loaders/STLLoader.cjs +0 -190
- package/loaders/STLLoader.js +0 -190
- package/loaders/SVGLoader.cjs +0 -1712
- package/loaders/SVGLoader.js +0 -1712
- package/loaders/TDSLoader.cjs +0 -650
- package/loaders/TDSLoader.js +0 -650
- package/loaders/TGALoader.cjs +0 -285
- package/loaders/TGALoader.js +0 -285
- package/loaders/TTFLoader.cjs +0 -131
- package/loaders/TTFLoader.js +0 -131
- package/loaders/TiltLoader.cjs +0 -375
- package/loaders/TiltLoader.js +0 -375
- package/loaders/VOXLoader.cjs +0 -432
- package/loaders/VOXLoader.js +0 -432
- package/loaders/VRMLLoader.cjs +0 -2105
- package/loaders/VRMLLoader.js +0 -2105
- package/loaders/VRMLoader.cjs +0 -38
- package/loaders/VRMLoader.js +0 -38
- package/loaders/VTKLoader.cjs +0 -648
- package/loaders/VTKLoader.js +0 -648
- package/loaders/XLoader.cjs +0 -1258
- package/loaders/XLoader.js +0 -1258
- package/loaders/XYZLoader.cjs +0 -60
- package/loaders/XYZLoader.js +0 -60
- package/loaders/lwo/IFFParser.cjs +0 -743
- package/loaders/lwo/IFFParser.js +0 -743
- package/loaders/lwo/LWO2Parser.cjs +0 -312
- package/loaders/lwo/LWO2Parser.js +0 -312
- package/loaders/lwo/LWO3Parser.cjs +0 -282
- package/loaders/lwo/LWO3Parser.js +0 -282
- package/math/Capsule.cjs +0 -98
- package/math/Capsule.js +0 -98
- package/math/ColorConverter.cjs +0 -42
- package/math/ColorConverter.js +0 -42
- package/math/ConvexHull.cjs +0 -596
- package/math/ConvexHull.js +0 -596
- package/math/ImprovedNoise.cjs +0 -304
- package/math/ImprovedNoise.js +0 -304
- package/math/Lut.cjs +0 -137
- package/math/Lut.js +0 -137
- package/math/MeshSurfaceSampler.cjs +0 -103
- package/math/MeshSurfaceSampler.js +0 -103
- package/math/OBB.cjs +0 -242
- package/math/OBB.js +0 -242
- package/math/Octree.cjs +0 -273
- package/math/Octree.js +0 -273
- package/math/SimplexNoise.cjs +0 -440
- package/math/SimplexNoise.js +0 -440
- package/misc/ConvexObjectBreaker.cjs +0 -292
- package/misc/ConvexObjectBreaker.js +0 -292
- package/misc/GPUComputationRenderer.cjs +0 -205
- package/misc/GPUComputationRenderer.js +0 -205
- package/misc/Gyroscope.cjs +0 -33
- package/misc/Gyroscope.js +0 -33
- package/misc/MD2Character.cjs +0 -167
- package/misc/MD2Character.js +0 -167
- package/misc/MD2CharacterComplex.cjs +0 -332
- package/misc/MD2CharacterComplex.js +0 -332
- package/misc/MorphAnimMesh.cjs +0 -40
- package/misc/MorphAnimMesh.js +0 -40
- package/misc/MorphBlendMesh.cjs +0 -179
- package/misc/MorphBlendMesh.js +0 -179
- package/misc/ProgressiveLightmap.cjs +0 -186
- package/misc/ProgressiveLightmap.js +0 -186
- package/misc/RollerCoaster.cjs +0 -353
- package/misc/RollerCoaster.js +0 -353
- package/misc/Timer.cjs +0 -101
- package/misc/Timer.js +0 -101
- package/misc/TubePainter.cjs +0 -123
- package/misc/TubePainter.js +0 -123
- package/misc/Volume.cjs +0 -305
- package/misc/Volume.js +0 -305
- package/misc/VolumeSlice.cjs +0 -114
- package/misc/VolumeSlice.js +0 -114
- package/misc/WebGL.cjs +0 -74
- package/misc/WebGL.js +0 -74
- package/modifiers/CurveModifier.cjs +0 -232
- package/modifiers/CurveModifier.js +0 -232
- package/modifiers/EdgeSplitModifier.cjs +0 -167
- package/modifiers/EdgeSplitModifier.js +0 -168
- package/modifiers/SimplifyModifier.cjs +0 -301
- package/modifiers/SimplifyModifier.js +0 -301
- package/modifiers/TessellateModifier.cjs +0 -214
- package/modifiers/TessellateModifier.js +0 -214
- package/objects/GroundProjectedEnv.cjs +0 -134
- package/objects/GroundProjectedEnv.js +0 -134
- package/objects/Lensflare.cjs +0 -291
- package/objects/Lensflare.js +0 -291
- package/objects/LightningStorm.cjs +0 -110
- package/objects/LightningStorm.js +0 -110
- package/objects/MarchingCubes.cjs +0 -4809
- package/objects/MarchingCubes.js +0 -4809
- package/objects/Reflector.cjs +0 -202
- package/objects/Reflector.js +0 -202
- package/objects/ReflectorForSSRPass.cjs +0 -260
- package/objects/ReflectorForSSRPass.js +0 -260
- package/objects/ReflectorRTT.cjs +0 -10
- package/objects/ReflectorRTT.js +0 -10
- package/objects/Refractor.cjs +0 -215
- package/objects/Refractor.js +0 -215
- package/objects/ShadowMesh.cjs +0 -45
- package/objects/ShadowMesh.js +0 -45
- package/objects/Sky.cjs +0 -200
- package/objects/Sky.js +0 -200
- package/objects/Water.cjs +0 -242
- package/objects/Water.js +0 -242
- package/objects/Water2.cjs +0 -256
- package/objects/Water2.js +0 -256
- package/physics/AmmoPhysics.cjs +0 -166
- package/physics/AmmoPhysics.js +0 -166
- package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
- package/postprocessing/AdaptiveToneMappingPass.js +0 -218
- package/postprocessing/AfterimagePass.cjs +0 -68
- package/postprocessing/AfterimagePass.js +0 -68
- package/postprocessing/BloomPass.cjs +0 -109
- package/postprocessing/BloomPass.js +0 -109
- package/postprocessing/BokehPass.cjs +0 -90
- package/postprocessing/BokehPass.js +0 -90
- package/postprocessing/ClearPass.cjs +0 -36
- package/postprocessing/ClearPass.js +0 -36
- package/postprocessing/CubeTexturePass.cjs +0 -53
- package/postprocessing/CubeTexturePass.js +0 -53
- package/postprocessing/DotScreenPass.cjs +0 -49
- package/postprocessing/DotScreenPass.js +0 -49
- package/postprocessing/EffectComposer.cjs +0 -157
- package/postprocessing/EffectComposer.js +0 -157
- package/postprocessing/FilmPass.cjs +0 -51
- package/postprocessing/FilmPass.js +0 -51
- package/postprocessing/GlitchPass.cjs +0 -84
- package/postprocessing/GlitchPass.js +0 -84
- package/postprocessing/HalftonePass.cjs +0 -53
- package/postprocessing/HalftonePass.js +0 -53
- package/postprocessing/LUTPass.cjs +0 -142
- package/postprocessing/LUTPass.js +0 -142
- package/postprocessing/MaskPass.cjs +0 -69
- package/postprocessing/MaskPass.js +0 -69
- package/postprocessing/OutlinePass.cjs +0 -479
- package/postprocessing/OutlinePass.js +0 -479
- package/postprocessing/Pass.cjs +0 -48
- package/postprocessing/Pass.js +0 -48
- package/postprocessing/RenderPass.cjs +0 -59
- package/postprocessing/RenderPass.js +0 -59
- package/postprocessing/RenderPixelatedPass.cjs +0 -199
- package/postprocessing/RenderPixelatedPass.js +0 -199
- package/postprocessing/SAOPass.cjs +0 -288
- package/postprocessing/SAOPass.js +0 -288
- package/postprocessing/SMAAPass.cjs +0 -112
- package/postprocessing/SMAAPass.js +0 -112
- package/postprocessing/SSAARenderPass.cjs +0 -189
- package/postprocessing/SSAARenderPass.js +0 -189
- package/postprocessing/SSAOPass.cjs +0 -272
- package/postprocessing/SSAOPass.js +0 -272
- package/postprocessing/SSRPass.cjs +0 -411
- package/postprocessing/SSRPass.js +0 -411
- package/postprocessing/SavePass.cjs +0 -38
- package/postprocessing/SavePass.js +0 -38
- package/postprocessing/ShaderPass.cjs +0 -49
- package/postprocessing/ShaderPass.js +0 -49
- package/postprocessing/TAARenderPass.cjs +0 -174
- package/postprocessing/TAARenderPass.js +0 -174
- package/postprocessing/TexturePass.cjs +0 -42
- package/postprocessing/TexturePass.js +0 -42
- package/postprocessing/UnrealBloomPass.cjs +0 -277
- package/postprocessing/UnrealBloomPass.js +0 -277
- package/postprocessing/WaterPass.cjs +0 -72
- package/postprocessing/WaterPass.js +0 -72
- package/renderers/CSS2DRenderer.cjs +0 -122
- package/renderers/CSS2DRenderer.js +0 -122
- package/renderers/CSS3DRenderer.cjs +0 -167
- package/renderers/CSS3DRenderer.js +0 -167
- package/renderers/Projector.cjs +0 -499
- package/renderers/Projector.js +0 -499
- package/renderers/SVGRenderer.cjs +0 -311
- package/renderers/SVGRenderer.js +0 -311
- package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
- package/shaders/ACESFilmicToneMappingShader.js +0 -55
- package/shaders/AfterimageShader.cjs +0 -32
- package/shaders/AfterimageShader.js +0 -32
- package/shaders/BasicShader.cjs +0 -12
- package/shaders/BasicShader.js +0 -12
- package/shaders/BleachBypassShader.cjs +0 -35
- package/shaders/BleachBypassShader.js +0 -35
- package/shaders/BlendShader.cjs +0 -30
- package/shaders/BlendShader.js +0 -30
- package/shaders/BokehShader.cjs +0 -109
- package/shaders/BokehShader.js +0 -109
- package/shaders/BokehShader2.cjs +0 -269
- package/shaders/BokehShader2.js +0 -269
- package/shaders/BrightnessContrastShader.cjs +0 -32
- package/shaders/BrightnessContrastShader.js +0 -32
- package/shaders/ColorCorrectionShader.cjs +0 -30
- package/shaders/ColorCorrectionShader.js +0 -30
- package/shaders/ColorifyShader.cjs +0 -28
- package/shaders/ColorifyShader.js +0 -28
- package/shaders/ConvolutionShader.cjs +0 -55
- package/shaders/ConvolutionShader.js +0 -55
- package/shaders/CopyShader.cjs +0 -25
- package/shaders/CopyShader.js +0 -25
- package/shaders/DOFMipMapShader.cjs +0 -32
- package/shaders/DOFMipMapShader.js +0 -32
- package/shaders/DepthLimitedBlurShader.cjs +0 -114
- package/shaders/DepthLimitedBlurShader.js +0 -114
- package/shaders/DigitalGlitch.cjs +0 -85
- package/shaders/DigitalGlitch.js +0 -85
- package/shaders/DotScreenShader.cjs +0 -39
- package/shaders/DotScreenShader.js +0 -39
- package/shaders/FXAAShader.cjs +0 -1098
- package/shaders/FXAAShader.js +0 -1098
- package/shaders/FilmShader.cjs +0 -53
- package/shaders/FilmShader.js +0 -53
- package/shaders/FocusShader.cjs +0 -55
- package/shaders/FocusShader.js +0 -55
- package/shaders/FreiChenShader.cjs +0 -64
- package/shaders/FreiChenShader.js +0 -64
- package/shaders/FresnelShader.cjs +0 -47
- package/shaders/FresnelShader.js +0 -47
- package/shaders/GammaCorrectionShader.cjs +0 -23
- package/shaders/GammaCorrectionShader.js +0 -23
- package/shaders/GodRaysShader.cjs +0 -183
- package/shaders/GodRaysShader.js +0 -183
- package/shaders/HalftoneShader.cjs +0 -228
- package/shaders/HalftoneShader.js +0 -228
- package/shaders/HorizontalBlurShader.cjs +0 -49
- package/shaders/HorizontalBlurShader.js +0 -49
- package/shaders/HorizontalTiltShiftShader.cjs +0 -37
- package/shaders/HorizontalTiltShiftShader.js +0 -37
- package/shaders/HueSaturationShader.cjs +0 -43
- package/shaders/HueSaturationShader.js +0 -43
- package/shaders/KaleidoShader.cjs +0 -34
- package/shaders/KaleidoShader.js +0 -34
- package/shaders/LuminosityHighPassShader.cjs +0 -37
- package/shaders/LuminosityHighPassShader.js +0 -37
- package/shaders/LuminosityShader.cjs +0 -25
- package/shaders/LuminosityShader.js +0 -25
- package/shaders/MirrorShader.cjs +0 -35
- package/shaders/MirrorShader.js +0 -35
- package/shaders/NormalMapShader.cjs +0 -31
- package/shaders/NormalMapShader.js +0 -31
- package/shaders/ParallaxShader.cjs +0 -133
- package/shaders/ParallaxShader.js +0 -133
- package/shaders/PixelShader.cjs +0 -28
- package/shaders/PixelShader.js +0 -28
- package/shaders/RGBShiftShader.cjs +0 -30
- package/shaders/RGBShiftShader.js +0 -30
- package/shaders/SAOShader.cjs +0 -144
- package/shaders/SAOShader.js +0 -144
- package/shaders/SMAAShader.cjs +0 -358
- package/shaders/SMAAShader.js +0 -358
- package/shaders/SSAOShader.cjs +0 -182
- package/shaders/SSAOShader.js +0 -182
- package/shaders/SSRShader.cjs +0 -342
- package/shaders/SSRShader.js +0 -342
- package/shaders/SepiaShader.cjs +0 -29
- package/shaders/SepiaShader.js +0 -29
- package/shaders/SobelOperatorShader.cjs +0 -54
- package/shaders/SobelOperatorShader.js +0 -54
- package/shaders/SubsurfaceScatteringShader.cjs +0 -98
- package/shaders/SubsurfaceScatteringShader.js +0 -98
- package/shaders/TechnicolorShader.cjs +0 -24
- package/shaders/TechnicolorShader.js +0 -24
- package/shaders/ToneMapShader.cjs +0 -51
- package/shaders/ToneMapShader.js +0 -51
- package/shaders/ToonShader.cjs +0 -188
- package/shaders/ToonShader.js +0 -188
- package/shaders/TriangleBlurShader.cjs +0 -37
- package/shaders/TriangleBlurShader.js +0 -37
- package/shaders/UnpackDepthRGBAShader.cjs +0 -26
- package/shaders/UnpackDepthRGBAShader.js +0 -26
- package/shaders/VerticalBlurShader.cjs +0 -50
- package/shaders/VerticalBlurShader.js +0 -50
- package/shaders/VerticalTiltShiftShader.cjs +0 -37
- package/shaders/VerticalTiltShiftShader.js +0 -37
- package/shaders/VignetteShader.cjs +0 -38
- package/shaders/VignetteShader.js +0 -38
- package/shaders/VolumeShader.cjs +0 -225
- package/shaders/VolumeShader.js +0 -225
- package/shaders/WaterRefractionShader.cjs +0 -59
- package/shaders/WaterRefractionShader.js +0 -59
- package/shaders/types.cjs +0 -1
- package/shaders/types.js +0 -1
- package/textures/FlakesTexture.cjs +0 -30
- package/textures/FlakesTexture.js +0 -30
- package/types/helpers.cjs +0 -4
- package/types/helpers.js +0 -4
- package/utils/BufferGeometryUtils.cjs +0 -636
- package/utils/BufferGeometryUtils.js +0 -636
- package/utils/GeometryCompressionUtils.cjs +0 -573
- package/utils/GeometryCompressionUtils.js +0 -573
- package/utils/GeometryUtils.cjs +0 -109
- package/utils/GeometryUtils.js +0 -109
- package/utils/RoughnessMipmapper.cjs +0 -223
- package/utils/RoughnessMipmapper.js +0 -223
- package/utils/SceneUtils.cjs +0 -36
- package/utils/SceneUtils.js +0 -36
- package/utils/ShadowMapViewer.cjs +0 -111
- package/utils/ShadowMapViewer.js +0 -111
- package/utils/SkeletonUtils.cjs +0 -211
- package/utils/SkeletonUtils.js +0 -211
- package/utils/UVsDebug.cjs +0 -80
- package/utils/UVsDebug.js +0 -80
- package/utils/WorkerPool.cjs +0 -62
- package/utils/WorkerPool.js +0 -62
- package/webxr/ARButton.cjs +0 -119
- package/webxr/ARButton.js +0 -119
- package/webxr/OculusHandModel.cjs +0 -82
- package/webxr/OculusHandModel.js +0 -82
- package/webxr/OculusHandPointerModel.cjs +0 -241
- package/webxr/OculusHandPointerModel.js +0 -224
- package/webxr/Text2D.cjs +0 -48
- package/webxr/Text2D.js +0 -31
- package/webxr/VRButton.cjs +0 -111
- package/webxr/VRButton.js +0 -111
- package/webxr/XRControllerModelFactory.cjs +0 -174
- package/webxr/XRControllerModelFactory.js +0 -174
- package/webxr/XREstimatedLight.cjs +0 -126
- package/webxr/XREstimatedLight.js +0 -126
- package/webxr/XRHandMeshModel.cjs +0 -82
- package/webxr/XRHandMeshModel.js +0 -82
- package/webxr/XRHandModelFactory.cjs +0 -61
- package/webxr/XRHandModelFactory.js +0 -61
- package/webxr/XRHandPrimitiveModel.cjs +0 -68
- package/webxr/XRHandPrimitiveModel.js +0 -68
@@ -1,331 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4
|
-
var __publicField = (obj, key, value) => {
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
6
|
-
return value;
|
7
|
-
};
|
8
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
9
|
-
const THREE = require("three");
|
10
|
-
class ColladaExporter {
|
11
|
-
constructor() {
|
12
|
-
__publicField(this, "options");
|
13
|
-
__publicField(this, "geometryInfo");
|
14
|
-
__publicField(this, "materialMap");
|
15
|
-
__publicField(this, "imageMap");
|
16
|
-
__publicField(this, "textures");
|
17
|
-
__publicField(this, "libraryImages");
|
18
|
-
__publicField(this, "libraryGeometries");
|
19
|
-
__publicField(this, "libraryEffects");
|
20
|
-
__publicField(this, "libraryMaterials");
|
21
|
-
__publicField(this, "canvas");
|
22
|
-
__publicField(this, "ctx");
|
23
|
-
__publicField(this, "transMat");
|
24
|
-
__publicField(this, "getFuncs", ["getX", "getY", "getZ", "getW"]);
|
25
|
-
this.options = {
|
26
|
-
version: "1.4.1",
|
27
|
-
author: null,
|
28
|
-
textureDirectory: "",
|
29
|
-
upAxis: "Y_UP",
|
30
|
-
unitName: null,
|
31
|
-
unitMeter: null
|
32
|
-
};
|
33
|
-
this.geometryInfo = /* @__PURE__ */ new WeakMap();
|
34
|
-
this.materialMap = /* @__PURE__ */ new WeakMap();
|
35
|
-
this.imageMap = /* @__PURE__ */ new WeakMap();
|
36
|
-
this.textures = [];
|
37
|
-
this.libraryImages = [];
|
38
|
-
this.libraryGeometries = [];
|
39
|
-
this.libraryEffects = [];
|
40
|
-
this.libraryMaterials = [];
|
41
|
-
this.canvas = null;
|
42
|
-
this.ctx = null;
|
43
|
-
this.transMat = null;
|
44
|
-
}
|
45
|
-
parse(object, onDone, options = {}) {
|
46
|
-
this.options = { ...this.options, ...options };
|
47
|
-
if (this.options.upAxis.match(/^[XYZ]_UP$/) === null) {
|
48
|
-
console.error("ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.");
|
49
|
-
return null;
|
50
|
-
}
|
51
|
-
if (this.options.unitName !== null && this.options.unitMeter === null) {
|
52
|
-
console.error("ColladaExporter: unitMeter needs to be specified if unitName is specified.");
|
53
|
-
return null;
|
54
|
-
}
|
55
|
-
if (this.options.unitMeter !== null && this.options.unitName === null) {
|
56
|
-
console.error("ColladaExporter: unitName needs to be specified if unitMeter is specified.");
|
57
|
-
return null;
|
58
|
-
}
|
59
|
-
if (this.options.textureDirectory !== "") {
|
60
|
-
this.options.textureDirectory = `${this.options.textureDirectory}/`.replace(/\\/g, "/").replace(/\/+/g, "/");
|
61
|
-
}
|
62
|
-
if (this.options.version !== "1.4.1" && this.options.version !== "1.5.0") {
|
63
|
-
console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`);
|
64
|
-
return null;
|
65
|
-
}
|
66
|
-
const libraryVisualScenes = this.processObject(object);
|
67
|
-
const specLink = this.options.version === "1.4.1" ? "http://www.collada.org/2005/11/COLLADASchema" : "https://www.khronos.org/collada/";
|
68
|
-
let dae = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>${`<COLLADA xmlns="${specLink}" version="${this.options.version}">`}<asset><contributor><authoring_tool>three.js Collada Exporter</authoring_tool>${this.options.author !== null ? `<author>${this.options.author}</author>` : ""}</contributor>${`<created>${(/* @__PURE__ */ new Date()).toISOString()}</created>`}${`<modified>${(/* @__PURE__ */ new Date()).toISOString()}</modified>`}<up_axis>Y_UP</up_axis></asset>`;
|
69
|
-
dae += `<library_images>${this.libraryImages.join("")}</library_images>`;
|
70
|
-
dae += `<library_effects>${this.libraryEffects.join("")}</library_effects>`;
|
71
|
-
dae += `<library_materials>${this.libraryMaterials.join("")}</library_materials>`;
|
72
|
-
dae += `<library_geometries>${this.libraryGeometries.join("")}</library_geometries>`;
|
73
|
-
dae += `<library_visual_scenes><visual_scene id="Scene" name="scene">${libraryVisualScenes}</visual_scene></library_visual_scenes>`;
|
74
|
-
dae += '<scene><instance_visual_scene url="#Scene"/></scene>';
|
75
|
-
dae += "</COLLADA>";
|
76
|
-
const res = {
|
77
|
-
data: this.format(dae),
|
78
|
-
textures: this.textures
|
79
|
-
};
|
80
|
-
if (typeof onDone === "function") {
|
81
|
-
requestAnimationFrame(() => onDone(res));
|
82
|
-
}
|
83
|
-
return res;
|
84
|
-
}
|
85
|
-
// Convert the urdf xml into a well-formatted, indented format
|
86
|
-
format(urdf) {
|
87
|
-
var _a, _b;
|
88
|
-
const IS_END_TAG = /^<\//;
|
89
|
-
const IS_SELF_CLOSING = /(\?>$)|(\/>$)/;
|
90
|
-
const HAS_TEXT = /<[^>]+>[^<]*<\/[^<]+>/;
|
91
|
-
const pad = (ch, num) => num > 0 ? ch + pad(ch, num - 1) : "";
|
92
|
-
let tagnum = 0;
|
93
|
-
return (_b = (_a = urdf.match(/(<[^>]+>[^<]+<\/[^<]+>)|(<[^>]+>)/g)) == null ? void 0 : _a.map((tag) => {
|
94
|
-
if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && IS_END_TAG.test(tag)) {
|
95
|
-
tagnum--;
|
96
|
-
}
|
97
|
-
const res = `${pad(" ", tagnum)}${tag}`;
|
98
|
-
if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && !IS_END_TAG.test(tag)) {
|
99
|
-
tagnum++;
|
100
|
-
}
|
101
|
-
return res;
|
102
|
-
}).join("\n")) != null ? _b : "";
|
103
|
-
}
|
104
|
-
// Convert an image into a png format for saving
|
105
|
-
base64ToBuffer(str) {
|
106
|
-
const b = atob(str);
|
107
|
-
const buf = new Uint8Array(b.length);
|
108
|
-
for (let i = 0, l = buf.length; i < l; i++) {
|
109
|
-
buf[i] = b.charCodeAt(i);
|
110
|
-
}
|
111
|
-
return buf;
|
112
|
-
}
|
113
|
-
imageToData(image, ext) {
|
114
|
-
var _a;
|
115
|
-
this.canvas = this.canvas || document.createElement("canvas");
|
116
|
-
this.ctx = this.ctx || this.canvas.getContext("2d");
|
117
|
-
this.canvas.width = image.width instanceof SVGAnimatedLength ? 0 : image.width;
|
118
|
-
this.canvas.height = image.height instanceof SVGAnimatedLength ? 0 : image.height;
|
119
|
-
(_a = this.ctx) == null ? void 0 : _a.drawImage(image, 0, 0);
|
120
|
-
const base64data = this.canvas.toDataURL(`image/${ext}`, 1).replace(/^data:image\/(png|jpg);base64,/, "");
|
121
|
-
return this.base64ToBuffer(base64data);
|
122
|
-
}
|
123
|
-
// gets the attribute array. Generate a new array if the attribute is interleaved
|
124
|
-
attrBufferToArray(attr) {
|
125
|
-
if (attr instanceof THREE.InterleavedBufferAttribute && attr.isInterleavedBufferAttribute) {
|
126
|
-
const TypedArrayConstructor = attr.array.constructor;
|
127
|
-
const arr = new TypedArrayConstructor(attr.count * attr.itemSize);
|
128
|
-
const size = attr.itemSize;
|
129
|
-
for (let i = 0, l = attr.count; i < l; i++) {
|
130
|
-
for (let j = 0; j < size; j++) {
|
131
|
-
arr[i * size + j] = attr[this.getFuncs[j]](i);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
return arr;
|
135
|
-
} else {
|
136
|
-
return attr.array;
|
137
|
-
}
|
138
|
-
}
|
139
|
-
// Returns an array of the same type starting at the `st` index,
|
140
|
-
// and `ct` length
|
141
|
-
subArray(arr, st, ct) {
|
142
|
-
if (Array.isArray(arr)) {
|
143
|
-
return arr.slice(st, st + ct);
|
144
|
-
} else {
|
145
|
-
const TypedArrayConstructor = arr.constructor;
|
146
|
-
return new TypedArrayConstructor(arr.buffer, st * arr.BYTES_PER_ELEMENT, ct);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
// Returns the string for a geometry's attribute
|
150
|
-
getAttribute(attr, name, params, type) {
|
151
|
-
const array = this.attrBufferToArray(attr);
|
152
|
-
const res = Array.isArray(array) ? `${`<source id="${name}"><float_array id="${name}-array" count="${array.length}">` + array.join(" ")}</float_array><technique_common>${`<accessor source="#${name}-array" count="${Math.floor(
|
153
|
-
array.length / attr.itemSize
|
154
|
-
)}" stride="${attr.itemSize}">`}${params.map((n) => `<param name="${n}" type="${type}" />`).join("")}</accessor></technique_common></source>` : "";
|
155
|
-
return res;
|
156
|
-
}
|
157
|
-
// Returns the string for a node's transform information
|
158
|
-
getTransform(o) {
|
159
|
-
o.updateMatrix();
|
160
|
-
this.transMat = this.transMat || new THREE.Matrix4();
|
161
|
-
this.transMat.copy(o.matrix);
|
162
|
-
this.transMat.transpose();
|
163
|
-
return `<matrix>${this.transMat.toArray().join(" ")}</matrix>`;
|
164
|
-
}
|
165
|
-
// Process the given piece of geometry into the geometry library
|
166
|
-
// Returns the mesh id
|
167
|
-
processGeometry(g) {
|
168
|
-
let info = this.geometryInfo.get(g);
|
169
|
-
if (!info) {
|
170
|
-
const bufferGeometry = g;
|
171
|
-
if (!bufferGeometry.isBufferGeometry) {
|
172
|
-
throw new Error("THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.");
|
173
|
-
}
|
174
|
-
const meshid = `Mesh${this.libraryGeometries.length + 1}`;
|
175
|
-
const indexCount = bufferGeometry.index ? bufferGeometry.index.count * bufferGeometry.index.itemSize : bufferGeometry.attributes.position.count;
|
176
|
-
const groups = bufferGeometry.groups != null && bufferGeometry.groups.length !== 0 ? bufferGeometry.groups : [{ start: 0, count: indexCount, materialIndex: 0 }];
|
177
|
-
const gname = g.name ? ` name="${g.name}"` : "";
|
178
|
-
let gnode = `<geometry id="${meshid}"${gname}><mesh>`;
|
179
|
-
const posName = `${meshid}-position`;
|
180
|
-
const vertName = `${meshid}-vertices`;
|
181
|
-
gnode += this.getAttribute(bufferGeometry.attributes.position, posName, ["X", "Y", "Z"], "float");
|
182
|
-
gnode += `<vertices id="${vertName}"><input semantic="POSITION" source="#${posName}" /></vertices>`;
|
183
|
-
let triangleInputs = `<input semantic="VERTEX" source="#${vertName}" offset="0" />`;
|
184
|
-
if ("normal" in bufferGeometry.attributes) {
|
185
|
-
const normName = `${meshid}-normal`;
|
186
|
-
gnode += this.getAttribute(bufferGeometry.attributes.normal, normName, ["X", "Y", "Z"], "float");
|
187
|
-
triangleInputs += `<input semantic="NORMAL" source="#${normName}" offset="0" />`;
|
188
|
-
}
|
189
|
-
if ("uv" in bufferGeometry.attributes) {
|
190
|
-
const uvName = `${meshid}-texcoord`;
|
191
|
-
gnode += this.getAttribute(bufferGeometry.attributes.uv, uvName, ["S", "T"], "float");
|
192
|
-
triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="0" />`;
|
193
|
-
}
|
194
|
-
if ("uv2" in bufferGeometry.attributes) {
|
195
|
-
const uvName = `${meshid}-texcoord2`;
|
196
|
-
gnode += this.getAttribute(bufferGeometry.attributes.uv2, uvName, ["S", "T"], "float");
|
197
|
-
triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="1" />`;
|
198
|
-
}
|
199
|
-
if ("color" in bufferGeometry.attributes) {
|
200
|
-
const colName = `${meshid}-color`;
|
201
|
-
gnode += this.getAttribute(bufferGeometry.attributes.color, colName, ["X", "Y", "Z"], "uint8");
|
202
|
-
triangleInputs += `<input semantic="COLOR" source="#${colName}" offset="0" />`;
|
203
|
-
}
|
204
|
-
let indexArray = null;
|
205
|
-
if (bufferGeometry.index) {
|
206
|
-
indexArray = this.attrBufferToArray(bufferGeometry.index);
|
207
|
-
} else {
|
208
|
-
indexArray = new Array(indexCount);
|
209
|
-
for (let i = 0, l = indexArray.length; i < l && Array.isArray(indexArray); i++)
|
210
|
-
indexArray[i] = i;
|
211
|
-
}
|
212
|
-
for (let i = 0, l = groups.length; i < l; i++) {
|
213
|
-
const group = groups[i];
|
214
|
-
const subarr = this.subArray(indexArray, group.start, group.count);
|
215
|
-
const polycount = subarr.length / 3;
|
216
|
-
gnode += `<triangles material="MESH_MATERIAL_${group.materialIndex}" count="${polycount}">`;
|
217
|
-
gnode += triangleInputs;
|
218
|
-
gnode += `<p>${subarr.join(" ")}</p>`;
|
219
|
-
gnode += "</triangles>";
|
220
|
-
}
|
221
|
-
gnode += "</mesh></geometry>";
|
222
|
-
this.libraryGeometries.push(gnode);
|
223
|
-
info = { meshid, bufferGeometry };
|
224
|
-
this.geometryInfo.set(g, info);
|
225
|
-
}
|
226
|
-
return info;
|
227
|
-
}
|
228
|
-
// Process the given texture into the image library
|
229
|
-
// Returns the image library
|
230
|
-
processTexture(tex) {
|
231
|
-
let texid = this.imageMap.get(tex);
|
232
|
-
if (texid == null) {
|
233
|
-
texid = `image-${this.libraryImages.length + 1}`;
|
234
|
-
const ext = "png";
|
235
|
-
const name = tex.name || texid;
|
236
|
-
let imageNode = `<image id="${texid}" name="${name}">`;
|
237
|
-
if (this.options.version === "1.5.0") {
|
238
|
-
imageNode += `<init_from><ref>${this.options.textureDirectory}${name}.${ext}</ref></init_from>`;
|
239
|
-
} else {
|
240
|
-
imageNode += `<init_from>${this.options.textureDirectory}${name}.${ext}</init_from>`;
|
241
|
-
}
|
242
|
-
imageNode += "</image>";
|
243
|
-
this.libraryImages.push(imageNode);
|
244
|
-
this.imageMap.set(tex, texid);
|
245
|
-
this.textures.push({
|
246
|
-
directory: this.options.textureDirectory,
|
247
|
-
name,
|
248
|
-
ext,
|
249
|
-
data: this.imageToData(tex.image, ext),
|
250
|
-
original: tex
|
251
|
-
});
|
252
|
-
}
|
253
|
-
return texid;
|
254
|
-
}
|
255
|
-
// Process the given material into the material and effect libraries
|
256
|
-
// Returns the material id
|
257
|
-
processMaterial(m) {
|
258
|
-
let matid = this.materialMap.get(m);
|
259
|
-
if (matid == null) {
|
260
|
-
matid = `Mat${this.libraryEffects.length + 1}`;
|
261
|
-
let type = "phong";
|
262
|
-
if (m instanceof THREE.MeshLambertMaterial) {
|
263
|
-
type = "lambert";
|
264
|
-
} else if (m instanceof THREE.MeshBasicMaterial) {
|
265
|
-
type = "constant";
|
266
|
-
if (m.map !== null) {
|
267
|
-
console.warn("ColladaExporter: Texture maps not supported with MeshBasicMaterial.");
|
268
|
-
}
|
269
|
-
}
|
270
|
-
if (m instanceof THREE.MeshPhongMaterial) {
|
271
|
-
const emissive = m.emissive ? m.emissive : new THREE.Color(0, 0, 0);
|
272
|
-
const diffuse = m.color ? m.color : new THREE.Color(0, 0, 0);
|
273
|
-
const specular = m.specular ? m.specular : new THREE.Color(1, 1, 1);
|
274
|
-
const shininess = m.shininess || 0;
|
275
|
-
const reflectivity = m.reflectivity || 0;
|
276
|
-
let transparencyNode = "";
|
277
|
-
if (m.transparent) {
|
278
|
-
transparencyNode += `<transparent>${m.map ? '<texture texture="diffuse-sampler"></texture>' : "<float>1</float>"}</transparent>`;
|
279
|
-
if (m.opacity < 1) {
|
280
|
-
transparencyNode += `<transparency><float>${m.opacity}</float></transparency>`;
|
281
|
-
}
|
282
|
-
}
|
283
|
-
const techniqueNode = `${`<technique sid="common"><${type}>`}<emission>${m.emissiveMap ? '<texture texture="emissive-sampler" texcoord="TEXCOORD" />' : `<color sid="emission">${emissive.r} ${emissive.g} ${emissive.b} 1</color>`}</emission>${type !== "constant" ? `<diffuse>${m.map ? '<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' : `<color sid="diffuse">${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color>`}</diffuse>` : ""}${type !== "constant" ? `<bump>${m.normalMap ? '<texture texture="bump-sampler" texcoord="TEXCOORD" />' : ""}</bump>` : ""}${type === "phong" ? `${`<specular><color sid="specular">${specular.r} ${specular.g} ${specular.b} 1</color></specular>`}<shininess>${m.specularMap ? '<texture texture="specular-sampler" texcoord="TEXCOORD" />' : `<float sid="shininess">${shininess}</float>`}</shininess>` : ""}${`<reflective><color>${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color></reflective>`}${`<reflectivity><float>${reflectivity}</float></reflectivity>`}${transparencyNode}${`</${type}></technique>`}`;
|
284
|
-
const effectnode = `${`<effect id="${matid}-effect">`}<profile_COMMON>${m.map ? `<newparam sid="diffuse-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
285
|
-
m.map
|
286
|
-
)}</init_from>`}</surface></newparam><newparam sid="diffuse-sampler"><sampler2D><source>diffuse-surface</source></sampler2D></newparam>` : ""}${m.specularMap ? `<newparam sid="specular-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
287
|
-
m.specularMap
|
288
|
-
)}</init_from>`}</surface></newparam><newparam sid="specular-sampler"><sampler2D><source>specular-surface</source></sampler2D></newparam>` : ""}${m.emissiveMap ? `<newparam sid="emissive-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
289
|
-
m.emissiveMap
|
290
|
-
)}</init_from>`}</surface></newparam><newparam sid="emissive-sampler"><sampler2D><source>emissive-surface</source></sampler2D></newparam>` : ""}${m.normalMap ? `<newparam sid="bump-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
291
|
-
m.normalMap
|
292
|
-
)}</init_from>`}</surface></newparam><newparam sid="bump-sampler"><sampler2D><source>bump-surface</source></sampler2D></newparam>` : ""}${techniqueNode}${m.side === THREE.DoubleSide ? '<extra><technique profile="THREEJS"><double_sided sid="double_sided" type="int">1</double_sided></technique></extra>' : ""}</profile_COMMON></effect>`;
|
293
|
-
const materialName = m.name ? ` name="${m.name}"` : "";
|
294
|
-
const materialNode = `<material id="${matid}"${materialName}><instance_effect url="#${matid}-effect" /></material>`;
|
295
|
-
this.libraryMaterials.push(materialNode);
|
296
|
-
this.libraryEffects.push(effectnode);
|
297
|
-
this.materialMap.set(m, matid);
|
298
|
-
}
|
299
|
-
}
|
300
|
-
return matid;
|
301
|
-
}
|
302
|
-
// Recursively process the object into a scene
|
303
|
-
processObject(o) {
|
304
|
-
let node = `<node name="${o.name}">`;
|
305
|
-
node += this.getTransform(o);
|
306
|
-
const a = new THREE.Mesh();
|
307
|
-
a.geometry;
|
308
|
-
if (o instanceof THREE.Mesh && o.isMesh && o.geometry !== null) {
|
309
|
-
const geomInfo = this.processGeometry(o.geometry);
|
310
|
-
const meshid = geomInfo.meshid;
|
311
|
-
const geometry = geomInfo.bufferGeometry;
|
312
|
-
let matids = null;
|
313
|
-
let matidsArray;
|
314
|
-
const mat = o.material || new THREE.MeshBasicMaterial();
|
315
|
-
const materials = Array.isArray(mat) ? mat : [mat];
|
316
|
-
if (geometry.groups.length > materials.length) {
|
317
|
-
matidsArray = new Array(geometry.groups.length);
|
318
|
-
} else {
|
319
|
-
matidsArray = new Array(materials.length);
|
320
|
-
}
|
321
|
-
matids = matidsArray.fill(null).map((_, i) => this.processMaterial(materials[i % materials.length]));
|
322
|
-
node += `${`<instance_geometry url="#${meshid}">` + (matids != null ? `<bind_material><technique_common>${matids.map(
|
323
|
-
(id, i) => `${`<instance_material symbol="MESH_MATERIAL_${i}" target="#${id}" >`}<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXCOORD" input_set="0" /></instance_material>`
|
324
|
-
).join("")}</technique_common></bind_material>` : "")}</instance_geometry>`;
|
325
|
-
}
|
326
|
-
o.children.forEach((c) => node += this.processObject(c));
|
327
|
-
node += "</node>";
|
328
|
-
return node;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
exports.ColladaExporter = ColladaExporter;
|
@@ -1,331 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
-
var __publicField = (obj, key, value) => {
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
-
return value;
|
6
|
-
};
|
7
|
-
import { InterleavedBufferAttribute, Matrix4, MeshLambertMaterial, MeshBasicMaterial, MeshPhongMaterial, Color, DoubleSide, Mesh } from "three";
|
8
|
-
class ColladaExporter {
|
9
|
-
constructor() {
|
10
|
-
__publicField(this, "options");
|
11
|
-
__publicField(this, "geometryInfo");
|
12
|
-
__publicField(this, "materialMap");
|
13
|
-
__publicField(this, "imageMap");
|
14
|
-
__publicField(this, "textures");
|
15
|
-
__publicField(this, "libraryImages");
|
16
|
-
__publicField(this, "libraryGeometries");
|
17
|
-
__publicField(this, "libraryEffects");
|
18
|
-
__publicField(this, "libraryMaterials");
|
19
|
-
__publicField(this, "canvas");
|
20
|
-
__publicField(this, "ctx");
|
21
|
-
__publicField(this, "transMat");
|
22
|
-
__publicField(this, "getFuncs", ["getX", "getY", "getZ", "getW"]);
|
23
|
-
this.options = {
|
24
|
-
version: "1.4.1",
|
25
|
-
author: null,
|
26
|
-
textureDirectory: "",
|
27
|
-
upAxis: "Y_UP",
|
28
|
-
unitName: null,
|
29
|
-
unitMeter: null
|
30
|
-
};
|
31
|
-
this.geometryInfo = /* @__PURE__ */ new WeakMap();
|
32
|
-
this.materialMap = /* @__PURE__ */ new WeakMap();
|
33
|
-
this.imageMap = /* @__PURE__ */ new WeakMap();
|
34
|
-
this.textures = [];
|
35
|
-
this.libraryImages = [];
|
36
|
-
this.libraryGeometries = [];
|
37
|
-
this.libraryEffects = [];
|
38
|
-
this.libraryMaterials = [];
|
39
|
-
this.canvas = null;
|
40
|
-
this.ctx = null;
|
41
|
-
this.transMat = null;
|
42
|
-
}
|
43
|
-
parse(object, onDone, options = {}) {
|
44
|
-
this.options = { ...this.options, ...options };
|
45
|
-
if (this.options.upAxis.match(/^[XYZ]_UP$/) === null) {
|
46
|
-
console.error("ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.");
|
47
|
-
return null;
|
48
|
-
}
|
49
|
-
if (this.options.unitName !== null && this.options.unitMeter === null) {
|
50
|
-
console.error("ColladaExporter: unitMeter needs to be specified if unitName is specified.");
|
51
|
-
return null;
|
52
|
-
}
|
53
|
-
if (this.options.unitMeter !== null && this.options.unitName === null) {
|
54
|
-
console.error("ColladaExporter: unitName needs to be specified if unitMeter is specified.");
|
55
|
-
return null;
|
56
|
-
}
|
57
|
-
if (this.options.textureDirectory !== "") {
|
58
|
-
this.options.textureDirectory = `${this.options.textureDirectory}/`.replace(/\\/g, "/").replace(/\/+/g, "/");
|
59
|
-
}
|
60
|
-
if (this.options.version !== "1.4.1" && this.options.version !== "1.5.0") {
|
61
|
-
console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`);
|
62
|
-
return null;
|
63
|
-
}
|
64
|
-
const libraryVisualScenes = this.processObject(object);
|
65
|
-
const specLink = this.options.version === "1.4.1" ? "http://www.collada.org/2005/11/COLLADASchema" : "https://www.khronos.org/collada/";
|
66
|
-
let dae = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>${`<COLLADA xmlns="${specLink}" version="${this.options.version}">`}<asset><contributor><authoring_tool>three.js Collada Exporter</authoring_tool>${this.options.author !== null ? `<author>${this.options.author}</author>` : ""}</contributor>${`<created>${(/* @__PURE__ */ new Date()).toISOString()}</created>`}${`<modified>${(/* @__PURE__ */ new Date()).toISOString()}</modified>`}<up_axis>Y_UP</up_axis></asset>`;
|
67
|
-
dae += `<library_images>${this.libraryImages.join("")}</library_images>`;
|
68
|
-
dae += `<library_effects>${this.libraryEffects.join("")}</library_effects>`;
|
69
|
-
dae += `<library_materials>${this.libraryMaterials.join("")}</library_materials>`;
|
70
|
-
dae += `<library_geometries>${this.libraryGeometries.join("")}</library_geometries>`;
|
71
|
-
dae += `<library_visual_scenes><visual_scene id="Scene" name="scene">${libraryVisualScenes}</visual_scene></library_visual_scenes>`;
|
72
|
-
dae += '<scene><instance_visual_scene url="#Scene"/></scene>';
|
73
|
-
dae += "</COLLADA>";
|
74
|
-
const res = {
|
75
|
-
data: this.format(dae),
|
76
|
-
textures: this.textures
|
77
|
-
};
|
78
|
-
if (typeof onDone === "function") {
|
79
|
-
requestAnimationFrame(() => onDone(res));
|
80
|
-
}
|
81
|
-
return res;
|
82
|
-
}
|
83
|
-
// Convert the urdf xml into a well-formatted, indented format
|
84
|
-
format(urdf) {
|
85
|
-
var _a, _b;
|
86
|
-
const IS_END_TAG = /^<\//;
|
87
|
-
const IS_SELF_CLOSING = /(\?>$)|(\/>$)/;
|
88
|
-
const HAS_TEXT = /<[^>]+>[^<]*<\/[^<]+>/;
|
89
|
-
const pad = (ch, num) => num > 0 ? ch + pad(ch, num - 1) : "";
|
90
|
-
let tagnum = 0;
|
91
|
-
return (_b = (_a = urdf.match(/(<[^>]+>[^<]+<\/[^<]+>)|(<[^>]+>)/g)) == null ? void 0 : _a.map((tag) => {
|
92
|
-
if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && IS_END_TAG.test(tag)) {
|
93
|
-
tagnum--;
|
94
|
-
}
|
95
|
-
const res = `${pad(" ", tagnum)}${tag}`;
|
96
|
-
if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && !IS_END_TAG.test(tag)) {
|
97
|
-
tagnum++;
|
98
|
-
}
|
99
|
-
return res;
|
100
|
-
}).join("\n")) != null ? _b : "";
|
101
|
-
}
|
102
|
-
// Convert an image into a png format for saving
|
103
|
-
base64ToBuffer(str) {
|
104
|
-
const b = atob(str);
|
105
|
-
const buf = new Uint8Array(b.length);
|
106
|
-
for (let i = 0, l = buf.length; i < l; i++) {
|
107
|
-
buf[i] = b.charCodeAt(i);
|
108
|
-
}
|
109
|
-
return buf;
|
110
|
-
}
|
111
|
-
imageToData(image, ext) {
|
112
|
-
var _a;
|
113
|
-
this.canvas = this.canvas || document.createElement("canvas");
|
114
|
-
this.ctx = this.ctx || this.canvas.getContext("2d");
|
115
|
-
this.canvas.width = image.width instanceof SVGAnimatedLength ? 0 : image.width;
|
116
|
-
this.canvas.height = image.height instanceof SVGAnimatedLength ? 0 : image.height;
|
117
|
-
(_a = this.ctx) == null ? void 0 : _a.drawImage(image, 0, 0);
|
118
|
-
const base64data = this.canvas.toDataURL(`image/${ext}`, 1).replace(/^data:image\/(png|jpg);base64,/, "");
|
119
|
-
return this.base64ToBuffer(base64data);
|
120
|
-
}
|
121
|
-
// gets the attribute array. Generate a new array if the attribute is interleaved
|
122
|
-
attrBufferToArray(attr) {
|
123
|
-
if (attr instanceof InterleavedBufferAttribute && attr.isInterleavedBufferAttribute) {
|
124
|
-
const TypedArrayConstructor = attr.array.constructor;
|
125
|
-
const arr = new TypedArrayConstructor(attr.count * attr.itemSize);
|
126
|
-
const size = attr.itemSize;
|
127
|
-
for (let i = 0, l = attr.count; i < l; i++) {
|
128
|
-
for (let j = 0; j < size; j++) {
|
129
|
-
arr[i * size + j] = attr[this.getFuncs[j]](i);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
return arr;
|
133
|
-
} else {
|
134
|
-
return attr.array;
|
135
|
-
}
|
136
|
-
}
|
137
|
-
// Returns an array of the same type starting at the `st` index,
|
138
|
-
// and `ct` length
|
139
|
-
subArray(arr, st, ct) {
|
140
|
-
if (Array.isArray(arr)) {
|
141
|
-
return arr.slice(st, st + ct);
|
142
|
-
} else {
|
143
|
-
const TypedArrayConstructor = arr.constructor;
|
144
|
-
return new TypedArrayConstructor(arr.buffer, st * arr.BYTES_PER_ELEMENT, ct);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
// Returns the string for a geometry's attribute
|
148
|
-
getAttribute(attr, name, params, type) {
|
149
|
-
const array = this.attrBufferToArray(attr);
|
150
|
-
const res = Array.isArray(array) ? `${`<source id="${name}"><float_array id="${name}-array" count="${array.length}">` + array.join(" ")}</float_array><technique_common>${`<accessor source="#${name}-array" count="${Math.floor(
|
151
|
-
array.length / attr.itemSize
|
152
|
-
)}" stride="${attr.itemSize}">`}${params.map((n) => `<param name="${n}" type="${type}" />`).join("")}</accessor></technique_common></source>` : "";
|
153
|
-
return res;
|
154
|
-
}
|
155
|
-
// Returns the string for a node's transform information
|
156
|
-
getTransform(o) {
|
157
|
-
o.updateMatrix();
|
158
|
-
this.transMat = this.transMat || new Matrix4();
|
159
|
-
this.transMat.copy(o.matrix);
|
160
|
-
this.transMat.transpose();
|
161
|
-
return `<matrix>${this.transMat.toArray().join(" ")}</matrix>`;
|
162
|
-
}
|
163
|
-
// Process the given piece of geometry into the geometry library
|
164
|
-
// Returns the mesh id
|
165
|
-
processGeometry(g) {
|
166
|
-
let info = this.geometryInfo.get(g);
|
167
|
-
if (!info) {
|
168
|
-
const bufferGeometry = g;
|
169
|
-
if (!bufferGeometry.isBufferGeometry) {
|
170
|
-
throw new Error("THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.");
|
171
|
-
}
|
172
|
-
const meshid = `Mesh${this.libraryGeometries.length + 1}`;
|
173
|
-
const indexCount = bufferGeometry.index ? bufferGeometry.index.count * bufferGeometry.index.itemSize : bufferGeometry.attributes.position.count;
|
174
|
-
const groups = bufferGeometry.groups != null && bufferGeometry.groups.length !== 0 ? bufferGeometry.groups : [{ start: 0, count: indexCount, materialIndex: 0 }];
|
175
|
-
const gname = g.name ? ` name="${g.name}"` : "";
|
176
|
-
let gnode = `<geometry id="${meshid}"${gname}><mesh>`;
|
177
|
-
const posName = `${meshid}-position`;
|
178
|
-
const vertName = `${meshid}-vertices`;
|
179
|
-
gnode += this.getAttribute(bufferGeometry.attributes.position, posName, ["X", "Y", "Z"], "float");
|
180
|
-
gnode += `<vertices id="${vertName}"><input semantic="POSITION" source="#${posName}" /></vertices>`;
|
181
|
-
let triangleInputs = `<input semantic="VERTEX" source="#${vertName}" offset="0" />`;
|
182
|
-
if ("normal" in bufferGeometry.attributes) {
|
183
|
-
const normName = `${meshid}-normal`;
|
184
|
-
gnode += this.getAttribute(bufferGeometry.attributes.normal, normName, ["X", "Y", "Z"], "float");
|
185
|
-
triangleInputs += `<input semantic="NORMAL" source="#${normName}" offset="0" />`;
|
186
|
-
}
|
187
|
-
if ("uv" in bufferGeometry.attributes) {
|
188
|
-
const uvName = `${meshid}-texcoord`;
|
189
|
-
gnode += this.getAttribute(bufferGeometry.attributes.uv, uvName, ["S", "T"], "float");
|
190
|
-
triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="0" />`;
|
191
|
-
}
|
192
|
-
if ("uv2" in bufferGeometry.attributes) {
|
193
|
-
const uvName = `${meshid}-texcoord2`;
|
194
|
-
gnode += this.getAttribute(bufferGeometry.attributes.uv2, uvName, ["S", "T"], "float");
|
195
|
-
triangleInputs += `<input semantic="TEXCOORD" source="#${uvName}" offset="0" set="1" />`;
|
196
|
-
}
|
197
|
-
if ("color" in bufferGeometry.attributes) {
|
198
|
-
const colName = `${meshid}-color`;
|
199
|
-
gnode += this.getAttribute(bufferGeometry.attributes.color, colName, ["X", "Y", "Z"], "uint8");
|
200
|
-
triangleInputs += `<input semantic="COLOR" source="#${colName}" offset="0" />`;
|
201
|
-
}
|
202
|
-
let indexArray = null;
|
203
|
-
if (bufferGeometry.index) {
|
204
|
-
indexArray = this.attrBufferToArray(bufferGeometry.index);
|
205
|
-
} else {
|
206
|
-
indexArray = new Array(indexCount);
|
207
|
-
for (let i = 0, l = indexArray.length; i < l && Array.isArray(indexArray); i++)
|
208
|
-
indexArray[i] = i;
|
209
|
-
}
|
210
|
-
for (let i = 0, l = groups.length; i < l; i++) {
|
211
|
-
const group = groups[i];
|
212
|
-
const subarr = this.subArray(indexArray, group.start, group.count);
|
213
|
-
const polycount = subarr.length / 3;
|
214
|
-
gnode += `<triangles material="MESH_MATERIAL_${group.materialIndex}" count="${polycount}">`;
|
215
|
-
gnode += triangleInputs;
|
216
|
-
gnode += `<p>${subarr.join(" ")}</p>`;
|
217
|
-
gnode += "</triangles>";
|
218
|
-
}
|
219
|
-
gnode += "</mesh></geometry>";
|
220
|
-
this.libraryGeometries.push(gnode);
|
221
|
-
info = { meshid, bufferGeometry };
|
222
|
-
this.geometryInfo.set(g, info);
|
223
|
-
}
|
224
|
-
return info;
|
225
|
-
}
|
226
|
-
// Process the given texture into the image library
|
227
|
-
// Returns the image library
|
228
|
-
processTexture(tex) {
|
229
|
-
let texid = this.imageMap.get(tex);
|
230
|
-
if (texid == null) {
|
231
|
-
texid = `image-${this.libraryImages.length + 1}`;
|
232
|
-
const ext = "png";
|
233
|
-
const name = tex.name || texid;
|
234
|
-
let imageNode = `<image id="${texid}" name="${name}">`;
|
235
|
-
if (this.options.version === "1.5.0") {
|
236
|
-
imageNode += `<init_from><ref>${this.options.textureDirectory}${name}.${ext}</ref></init_from>`;
|
237
|
-
} else {
|
238
|
-
imageNode += `<init_from>${this.options.textureDirectory}${name}.${ext}</init_from>`;
|
239
|
-
}
|
240
|
-
imageNode += "</image>";
|
241
|
-
this.libraryImages.push(imageNode);
|
242
|
-
this.imageMap.set(tex, texid);
|
243
|
-
this.textures.push({
|
244
|
-
directory: this.options.textureDirectory,
|
245
|
-
name,
|
246
|
-
ext,
|
247
|
-
data: this.imageToData(tex.image, ext),
|
248
|
-
original: tex
|
249
|
-
});
|
250
|
-
}
|
251
|
-
return texid;
|
252
|
-
}
|
253
|
-
// Process the given material into the material and effect libraries
|
254
|
-
// Returns the material id
|
255
|
-
processMaterial(m) {
|
256
|
-
let matid = this.materialMap.get(m);
|
257
|
-
if (matid == null) {
|
258
|
-
matid = `Mat${this.libraryEffects.length + 1}`;
|
259
|
-
let type = "phong";
|
260
|
-
if (m instanceof MeshLambertMaterial) {
|
261
|
-
type = "lambert";
|
262
|
-
} else if (m instanceof MeshBasicMaterial) {
|
263
|
-
type = "constant";
|
264
|
-
if (m.map !== null) {
|
265
|
-
console.warn("ColladaExporter: Texture maps not supported with MeshBasicMaterial.");
|
266
|
-
}
|
267
|
-
}
|
268
|
-
if (m instanceof MeshPhongMaterial) {
|
269
|
-
const emissive = m.emissive ? m.emissive : new Color(0, 0, 0);
|
270
|
-
const diffuse = m.color ? m.color : new Color(0, 0, 0);
|
271
|
-
const specular = m.specular ? m.specular : new Color(1, 1, 1);
|
272
|
-
const shininess = m.shininess || 0;
|
273
|
-
const reflectivity = m.reflectivity || 0;
|
274
|
-
let transparencyNode = "";
|
275
|
-
if (m.transparent) {
|
276
|
-
transparencyNode += `<transparent>${m.map ? '<texture texture="diffuse-sampler"></texture>' : "<float>1</float>"}</transparent>`;
|
277
|
-
if (m.opacity < 1) {
|
278
|
-
transparencyNode += `<transparency><float>${m.opacity}</float></transparency>`;
|
279
|
-
}
|
280
|
-
}
|
281
|
-
const techniqueNode = `${`<technique sid="common"><${type}>`}<emission>${m.emissiveMap ? '<texture texture="emissive-sampler" texcoord="TEXCOORD" />' : `<color sid="emission">${emissive.r} ${emissive.g} ${emissive.b} 1</color>`}</emission>${type !== "constant" ? `<diffuse>${m.map ? '<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' : `<color sid="diffuse">${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color>`}</diffuse>` : ""}${type !== "constant" ? `<bump>${m.normalMap ? '<texture texture="bump-sampler" texcoord="TEXCOORD" />' : ""}</bump>` : ""}${type === "phong" ? `${`<specular><color sid="specular">${specular.r} ${specular.g} ${specular.b} 1</color></specular>`}<shininess>${m.specularMap ? '<texture texture="specular-sampler" texcoord="TEXCOORD" />' : `<float sid="shininess">${shininess}</float>`}</shininess>` : ""}${`<reflective><color>${diffuse.r} ${diffuse.g} ${diffuse.b} 1</color></reflective>`}${`<reflectivity><float>${reflectivity}</float></reflectivity>`}${transparencyNode}${`</${type}></technique>`}`;
|
282
|
-
const effectnode = `${`<effect id="${matid}-effect">`}<profile_COMMON>${m.map ? `<newparam sid="diffuse-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
283
|
-
m.map
|
284
|
-
)}</init_from>`}</surface></newparam><newparam sid="diffuse-sampler"><sampler2D><source>diffuse-surface</source></sampler2D></newparam>` : ""}${m.specularMap ? `<newparam sid="specular-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
285
|
-
m.specularMap
|
286
|
-
)}</init_from>`}</surface></newparam><newparam sid="specular-sampler"><sampler2D><source>specular-surface</source></sampler2D></newparam>` : ""}${m.emissiveMap ? `<newparam sid="emissive-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
287
|
-
m.emissiveMap
|
288
|
-
)}</init_from>`}</surface></newparam><newparam sid="emissive-sampler"><sampler2D><source>emissive-surface</source></sampler2D></newparam>` : ""}${m.normalMap ? `<newparam sid="bump-surface"><surface type="2D">${`<init_from>${this.processTexture(
|
289
|
-
m.normalMap
|
290
|
-
)}</init_from>`}</surface></newparam><newparam sid="bump-sampler"><sampler2D><source>bump-surface</source></sampler2D></newparam>` : ""}${techniqueNode}${m.side === DoubleSide ? '<extra><technique profile="THREEJS"><double_sided sid="double_sided" type="int">1</double_sided></technique></extra>' : ""}</profile_COMMON></effect>`;
|
291
|
-
const materialName = m.name ? ` name="${m.name}"` : "";
|
292
|
-
const materialNode = `<material id="${matid}"${materialName}><instance_effect url="#${matid}-effect" /></material>`;
|
293
|
-
this.libraryMaterials.push(materialNode);
|
294
|
-
this.libraryEffects.push(effectnode);
|
295
|
-
this.materialMap.set(m, matid);
|
296
|
-
}
|
297
|
-
}
|
298
|
-
return matid;
|
299
|
-
}
|
300
|
-
// Recursively process the object into a scene
|
301
|
-
processObject(o) {
|
302
|
-
let node = `<node name="${o.name}">`;
|
303
|
-
node += this.getTransform(o);
|
304
|
-
const a = new Mesh();
|
305
|
-
a.geometry;
|
306
|
-
if (o instanceof Mesh && o.isMesh && o.geometry !== null) {
|
307
|
-
const geomInfo = this.processGeometry(o.geometry);
|
308
|
-
const meshid = geomInfo.meshid;
|
309
|
-
const geometry = geomInfo.bufferGeometry;
|
310
|
-
let matids = null;
|
311
|
-
let matidsArray;
|
312
|
-
const mat = o.material || new MeshBasicMaterial();
|
313
|
-
const materials = Array.isArray(mat) ? mat : [mat];
|
314
|
-
if (geometry.groups.length > materials.length) {
|
315
|
-
matidsArray = new Array(geometry.groups.length);
|
316
|
-
} else {
|
317
|
-
matidsArray = new Array(materials.length);
|
318
|
-
}
|
319
|
-
matids = matidsArray.fill(null).map((_, i) => this.processMaterial(materials[i % materials.length]));
|
320
|
-
node += `${`<instance_geometry url="#${meshid}">` + (matids != null ? `<bind_material><technique_common>${matids.map(
|
321
|
-
(id, i) => `${`<instance_material symbol="MESH_MATERIAL_${i}" target="#${id}" >`}<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXCOORD" input_set="0" /></instance_material>`
|
322
|
-
).join("")}</technique_common></bind_material>` : "")}</instance_geometry>`;
|
323
|
-
}
|
324
|
-
o.children.forEach((c) => node += this.processObject(c));
|
325
|
-
node += "</node>";
|
326
|
-
return node;
|
327
|
-
}
|
328
|
-
}
|
329
|
-
export {
|
330
|
-
ColladaExporter
|
331
|
-
};
|