three-stdlib 2.22.5 → 2.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +0 -2
- package/package.json +34 -14
- package/BufferGeometryUtils-903f7ecb.js +0 -1
- package/BufferGeometryUtils-f2288d1c.js +0 -740
- package/Nodes-2106b101.js +0 -352
- package/Nodes-8947ba9a.js +0 -1
- package/_polyfill/CompressedArrayTexture.cjs.js +0 -1
- package/_polyfill/CompressedArrayTexture.js +0 -13
- package/_polyfill/Data3DTexture.cjs.js +0 -1
- package/_polyfill/Data3DTexture.js +0 -23
- package/animation/AnimationClipCreator.cjs.js +0 -1
- package/animation/AnimationClipCreator.d.ts +0 -12
- package/animation/AnimationClipCreator.js +0 -77
- package/animation/CCDIKSolver.cjs.js +0 -1
- package/animation/CCDIKSolver.d.ts +0 -25
- package/animation/CCDIKSolver.js +0 -304
- package/animation/MMDAnimationHelper.cjs.js +0 -1
- package/animation/MMDAnimationHelper.d.ts +0 -103
- package/animation/MMDAnimationHelper.js +0 -705
- package/animation/MMDPhysics.cjs.js +0 -1
- package/animation/MMDPhysics.d.ts +0 -119
- package/animation/MMDPhysics.js +0 -976
- package/cameras/CinematicCamera.cjs.js +0 -1
- package/cameras/CinematicCamera.d.ts +0 -41
- package/cameras/CinematicCamera.js +0 -139
- package/controls/ArcballControls.cjs.js +0 -1
- package/controls/ArcballControls.d.ts +0 -161
- package/controls/ArcballControls.js +0 -2642
- package/controls/DeviceOrientationControls.cjs.js +0 -1
- package/controls/DeviceOrientationControls.d.ts +0 -24
- package/controls/DeviceOrientationControls.js +0 -119
- package/controls/DragControls.cjs.js +0 -1
- package/controls/DragControls.d.ts +0 -34
- package/controls/DragControls.js +0 -274
- package/controls/FirstPersonControls.cjs.js +0 -1
- package/controls/FirstPersonControls.d.ts +0 -48
- package/controls/FirstPersonControls.js +0 -290
- package/controls/FlyControls.cjs.js +0 -1
- package/controls/FlyControls.d.ts +0 -32
- package/controls/FlyControls.js +0 -309
- package/controls/OrbitControls.cjs.js +0 -1
- package/controls/OrbitControls.d.ts +0 -63
- package/controls/OrbitControls.js +0 -980
- package/controls/PointerLockControls.cjs.js +0 -1
- package/controls/PointerLockControls.d.ts +0 -24
- package/controls/PointerLockControls.js +0 -135
- package/controls/TrackballControls.cjs.js +0 -1
- package/controls/TrackballControls.d.ts +0 -95
- package/controls/TrackballControls.js +0 -653
- package/controls/TransformControls.cjs.js +0 -1
- package/controls/TransformControls.d.ts +0 -151
- package/controls/TransformControls.js +0 -1275
- package/controls/experimental/CameraControls.cjs.js +0 -1
- package/controls/experimental/CameraControls.d.ts +0 -170
- package/controls/experimental/CameraControls.js +0 -953
- package/csm/CSM.cjs.js +0 -1
- package/csm/CSM.d.ts +0 -61
- package/csm/CSM.js +0 -305
- package/csm/CSMFrustum.cjs.js +0 -1
- package/csm/CSMFrustum.d.ts +0 -19
- package/csm/CSMFrustum.js +0 -90
- package/csm/CSMHelper.cjs.js +0 -1
- package/csm/CSMHelper.d.ts +0 -26
- package/csm/CSMHelper.js +0 -128
- package/csm/CSMShader.cjs.js +0 -1
- package/csm/CSMShader.d.ts +0 -4
- package/csm/CSMShader.js +0 -255
- package/curves/CurveExtras.cjs.js +0 -1
- package/curves/CurveExtras.d.ts +0 -68
- package/curves/CurveExtras.js +0 -266
- package/curves/NURBSCurve.cjs.js +0 -1
- package/curves/NURBSCurve.d.ts +0 -11
- package/curves/NURBSCurve.js +0 -63
- package/curves/NURBSSurface.cjs.js +0 -1
- package/curves/NURBSSurface.d.ts +0 -13
- package/curves/NURBSSurface.js +0 -44
- package/curves/NURBSUtils.cjs.js +0 -1
- package/curves/NURBSUtils.d.ts +0 -22
- package/curves/NURBSUtils.js +0 -375
- package/custom.d.cjs.js +0 -1
- package/custom.d.js +0 -1
- package/deprecated/Geometry.cjs.js +0 -1
- package/deprecated/Geometry.d.ts +0 -342
- package/deprecated/Geometry.js +0 -1261
- package/effects/AnaglyphEffect.cjs.js +0 -1
- package/effects/AnaglyphEffect.d.ts +0 -11
- package/effects/AnaglyphEffect.js +0 -85
- package/effects/AsciiEffect.cjs.js +0 -1
- package/effects/AsciiEffect.d.ts +0 -18
- package/effects/AsciiEffect.js +0 -203
- package/effects/OutlineEffect.cjs.js +0 -1
- package/effects/OutlineEffect.d.ts +0 -28
- package/effects/OutlineEffect.js +0 -378
- package/effects/ParallaxBarrierEffect.cjs.js +0 -1
- package/effects/ParallaxBarrierEffect.d.ts +0 -8
- package/effects/ParallaxBarrierEffect.js +0 -63
- package/effects/PeppersGhostEffect.cjs.js +0 -1
- package/effects/PeppersGhostEffect.d.ts +0 -10
- package/effects/PeppersGhostEffect.js +0 -134
- package/effects/StereoEffect.cjs.js +0 -1
- package/effects/StereoEffect.d.ts +0 -9
- package/effects/StereoEffect.js +0 -36
- package/environments/RoomEnvironment.cjs.js +0 -1
- package/environments/RoomEnvironment.d.ts +0 -5
- package/environments/RoomEnvironment.js +0 -92
- package/exporters/ColladaExporter.cjs.js +0 -1
- package/exporters/ColladaExporter.d.ts +0 -39
- package/exporters/ColladaExporter.js +0 -425
- package/exporters/DRACOExporter.cjs.js +0 -1
- package/exporters/DRACOExporter.d.ts +0 -23
- package/exporters/DRACOExporter.js +0 -186
- package/exporters/GLTFExporter.cjs.js +0 -1
- package/exporters/GLTFExporter.d.ts +0 -270
- package/exporters/GLTFExporter.js +0 -1932
- package/exporters/MMDExporter.cjs.js +0 -1
- package/exporters/MMDExporter.d.ts +0 -8
- package/exporters/MMDExporter.js +0 -160
- package/exporters/OBJExporter.cjs.js +0 -1
- package/exporters/OBJExporter.d.ts +0 -18
- package/exporters/OBJExporter.js +0 -228
- package/exporters/PLYExporter.cjs.js +0 -1
- package/exporters/PLYExporter.d.ts +0 -11
- package/exporters/PLYExporter.js +0 -339
- package/exporters/STLExporter.cjs.js +0 -1
- package/exporters/STLExporter.d.ts +0 -23
- package/exporters/STLExporter.js +0 -180
- package/exporters/USDZExporter.cjs.js +0 -1
- package/exporters/USDZExporter.d.ts +0 -27
- package/exporters/USDZExporter.js +0 -388
- package/geometries/BoxLineGeometry.cjs.js +0 -1
- package/geometries/BoxLineGeometry.d.ts +0 -12
- package/geometries/BoxLineGeometry.js +0 -52
- package/geometries/ConvexGeometry.cjs.js +0 -1
- package/geometries/ConvexGeometry.d.ts +0 -5
- package/geometries/ConvexGeometry.js +0 -38
- package/geometries/DecalGeometry.cjs.js +0 -1
- package/geometries/DecalGeometry.d.ts +0 -10
- package/geometries/DecalGeometry.js +0 -238
- package/geometries/LightningStrike.cjs.js +0 -1
- package/geometries/LightningStrike.d.ts +0 -108
- package/geometries/LightningStrike.js +0 -740
- package/geometries/ParametricGeometries.cjs.js +0 -1
- package/geometries/ParametricGeometries.d.ts +0 -32
- package/geometries/ParametricGeometries.js +0 -179
- package/geometries/ParametricGeometry.cjs.js +0 -1
- package/geometries/ParametricGeometry.d.ts +0 -18
- package/geometries/ParametricGeometry.js +0 -87
- package/geometries/RoundedBoxGeometry.cjs.js +0 -1
- package/geometries/RoundedBoxGeometry.d.ts +0 -5
- package/geometries/RoundedBoxGeometry.js +0 -122
- package/geometries/TeapotGeometry.cjs.js +0 -1
- package/geometries/TeapotGeometry.d.ts +0 -13
- package/geometries/TeapotGeometry.js +0 -297
- package/geometries/TextGeometry.cjs.js +0 -1
- package/geometries/TextGeometry.d.ts +0 -18
- package/geometries/TextGeometry.js +0 -37
- package/helpers/LightProbeHelper.cjs.js +0 -1
- package/helpers/LightProbeHelper.d.ts +0 -10
- package/helpers/LightProbeHelper.js +0 -40
- package/helpers/PositionalAudioHelper.cjs.js +0 -1
- package/helpers/PositionalAudioHelper.d.ts +0 -13
- package/helpers/PositionalAudioHelper.js +0 -75
- package/helpers/RectAreaLightHelper.cjs.js +0 -1
- package/helpers/RectAreaLightHelper.d.ts +0 -10
- package/helpers/RectAreaLightHelper.js +0 -60
- package/helpers/VertexNormalsHelper.cjs.js +0 -1
- package/helpers/VertexNormalsHelper.d.ts +0 -10
- package/helpers/VertexNormalsHelper.js +0 -75
- package/helpers/VertexTangentsHelper.cjs.js +0 -1
- package/helpers/VertexTangentsHelper.d.ts +0 -10
- package/helpers/VertexTangentsHelper.js +0 -63
- package/index.cjs.js +0 -1
- package/index.d.ts +0 -254
- package/index.js +0 -337
- package/interactive/HTMLMesh.cjs.js +0 -1
- package/interactive/HTMLMesh.d.ts +0 -6
- package/interactive/HTMLMesh.js +0 -406
- package/interactive/InteractiveGroup.cjs.js +0 -1
- package/interactive/InteractiveGroup.d.ts +0 -5
- package/interactive/InteractiveGroup.js +0 -87
- package/interactive/SelectionBox.cjs.js +0 -1
- package/interactive/SelectionBox.d.ts +0 -15
- package/interactive/SelectionBox.js +0 -152
- package/interactive/SelectionHelper.cjs.js +0 -1
- package/interactive/SelectionHelper.d.ts +0 -17
- package/interactive/SelectionHelper.js +0 -59
- package/libs/MeshoptDecoder.cjs.js +0 -1
- package/libs/MeshoptDecoder.d.ts +0 -12
- package/libs/MeshoptDecoder.js +0 -124
- package/libs/MotionControllers.cjs.js +0 -1
- package/libs/MotionControllers.d.ts +0 -132
- package/libs/MotionControllers.js +0 -455
- package/lights/LightProbeGenerator.cjs.js +0 -1
- package/lights/LightProbeGenerator.d.ts +0 -6
- package/lights/LightProbeGenerator.js +0 -200
- package/lights/RectAreaLightUniformsLib.cjs.js +0 -1
- package/lights/RectAreaLightUniformsLib.d.ts +0 -3
- package/lights/RectAreaLightUniformsLib.js +0 -9
- package/lines/Line2.cjs.js +0 -1
- package/lines/Line2.d.ts +0 -11
- package/lines/Line2.js +0 -16
- package/lines/LineGeometry.cjs.js +0 -1
- package/lines/LineGeometry.d.ts +0 -10
- package/lines/LineGeometry.js +0 -56
- package/lines/LineMaterial.cjs.js +0 -1
- package/lines/LineMaterial.d.ts +0 -31
- package/lines/LineMaterial.js +0 -577
- package/lines/LineSegments2.cjs.js +0 -1
- package/lines/LineSegments2.d.ts +0 -14
- package/lines/LineSegments2.js +0 -311
- package/lines/LineSegmentsGeometry.cjs.js +0 -1
- package/lines/LineSegmentsGeometry.d.ts +0 -23
- package/lines/LineSegmentsGeometry.js +0 -166
- package/lines/Wireframe.cjs.js +0 -1
- package/lines/Wireframe.d.ts +0 -11
- package/lines/Wireframe.js +0 -45
- package/lines/WireframeGeometry2.cjs.js +0 -1
- package/lines/WireframeGeometry2.d.ts +0 -8
- package/lines/WireframeGeometry2.js +0 -14
- package/loaders/3DMLoader.cjs.js +0 -1
- package/loaders/3DMLoader.d.ts +0 -17
- package/loaders/3DMLoader.js +0 -1037
- package/loaders/3MFLoader.cjs.js +0 -1
- package/loaders/3MFLoader.d.ts +0 -16
- package/loaders/3MFLoader.js +0 -1053
- package/loaders/AMFLoader.cjs.js +0 -1
- package/loaders/AMFLoader.d.ts +0 -14
- package/loaders/AMFLoader.js +0 -389
- package/loaders/AssimpLoader.cjs.js +0 -1
- package/loaders/AssimpLoader.js +0 -1793
- package/loaders/BVHLoader.cjs.js +0 -1
- package/loaders/BVHLoader.d.ts +0 -21
- package/loaders/BVHLoader.js +0 -313
- package/loaders/BasisTextureLoader.cjs.js +0 -1
- package/loaders/BasisTextureLoader.d.ts +0 -32
- package/loaders/BasisTextureLoader.js +0 -602
- package/loaders/ColladaLoader.cjs.js +0 -1
- package/loaders/ColladaLoader.d.ts +0 -20
- package/loaders/ColladaLoader.js +0 -2993
- package/loaders/DDSLoader.cjs.js +0 -1
- package/loaders/DDSLoader.d.ts +0 -16
- package/loaders/DDSLoader.js +0 -214
- package/loaders/DRACOLoader.cjs.js +0 -1
- package/loaders/DRACOLoader.d.ts +0 -18
- package/loaders/DRACOLoader.js +0 -447
- package/loaders/EXRLoader.cjs.js +0 -1
- package/loaders/EXRLoader.d.ts +0 -18
- package/loaders/EXRLoader.js +0 -1699
- package/loaders/FBXLoader.cjs.js +0 -1
- package/loaders/FBXLoader.d.ts +0 -14
- package/loaders/FBXLoader.js +0 -2917
- package/loaders/FontLoader.cjs.js +0 -1
- package/loaders/FontLoader.d.ts +0 -36
- package/loaders/FontLoader.js +0 -144
- package/loaders/GCodeLoader.cjs.js +0 -1
- package/loaders/GCodeLoader.d.ts +0 -15
- package/loaders/GCodeLoader.js +0 -189
- package/loaders/GLTFLoader.cjs.js +0 -1
- package/loaders/GLTFLoader.d.ts +0 -151
- package/loaders/GLTFLoader.js +0 -3136
- package/loaders/HDRCubeTextureLoader.cjs.js +0 -1
- package/loaders/HDRCubeTextureLoader.d.ts +0 -18
- package/loaders/HDRCubeTextureLoader.js +0 -77
- package/loaders/KMZLoader.cjs.js +0 -1
- package/loaders/KMZLoader.d.ts +0 -16
- package/loaders/KMZLoader.js +0 -88
- package/loaders/KTX2Loader.cjs.js +0 -1
- package/loaders/KTX2Loader.d.ts +0 -16
- package/loaders/KTX2Loader.js +0 -596
- package/loaders/KTXLoader.cjs.js +0 -1
- package/loaders/KTXLoader.d.ts +0 -16
- package/loaders/KTXLoader.js +0 -149
- package/loaders/LDrawLoader.cjs.js +0 -1
- package/loaders/LDrawLoader.d.ts +0 -26
- package/loaders/LDrawLoader.js +0 -1842
- package/loaders/LUT3dlLoader.cjs.js +0 -1
- package/loaders/LUT3dlLoader.d.ts +0 -20
- package/loaders/LUT3dlLoader.js +0 -115
- package/loaders/LUTCubeLoader.cjs.js +0 -1
- package/loaders/LUTCubeLoader.d.ts +0 -23
- package/loaders/LUTCubeLoader.js +0 -118
- package/loaders/LWOLoader.cjs.js +0 -1
- package/loaders/LWOLoader.d.ts +0 -26
- package/loaders/LWOLoader.js +0 -737
- package/loaders/LottieLoader.cjs.js +0 -1
- package/loaders/LottieLoader.d.ts +0 -15
- package/loaders/LottieLoader.js +0 -49
- package/loaders/MD2Loader.cjs.js +0 -1
- package/loaders/MD2Loader.d.ts +0 -14
- package/loaders/MD2Loader.js +0 -202
- package/loaders/MDDLoader.cjs.js +0 -1
- package/loaders/MDDLoader.d.ts +0 -19
- package/loaders/MDDLoader.js +0 -78
- package/loaders/MMDLoader.cjs.js +0 -1
- package/loaders/MMDLoader.d.ts +0 -63
- package/loaders/MMDLoader.js +0 -1434
- package/loaders/MTLLoader.cjs.js +0 -1
- package/loaders/MTLLoader.d.ts +0 -112
- package/loaders/MTLLoader.js +0 -390
- package/loaders/NRRDLoader.cjs.js +0 -1
- package/loaders/NRRDLoader.d.ts +0 -21
- package/loaders/NRRDLoader.js +0 -482
- package/loaders/NodeMaterialLoader.cjs.js +0 -1
- package/loaders/NodeMaterialLoader.js +0 -39
- package/loaders/OBJLoader.cjs.js +0 -1
- package/loaders/OBJLoader.d.ts +0 -17
- package/loaders/OBJLoader.js +0 -609
- package/loaders/PCDLoader.cjs.js +0 -1
- package/loaders/PCDLoader.d.ts +0 -15
- package/loaders/PCDLoader.js +0 -267
- package/loaders/PDBLoader.cjs.js +0 -1
- package/loaders/PDBLoader.d.ts +0 -22
- package/loaders/PDBLoader.js +0 -264
- package/loaders/PLYLoader.cjs.js +0 -1
- package/loaders/PLYLoader.d.ts +0 -16
- package/loaders/PLYLoader.js +0 -414
- package/loaders/PRWMLoader.cjs.js +0 -1
- package/loaders/PRWMLoader.d.ts +0 -16
- package/loaders/PRWMLoader.js +0 -197
- package/loaders/PVRLoader.cjs.js +0 -1
- package/loaders/PVRLoader.d.ts +0 -16
- package/loaders/PVRLoader.js +0 -192
- package/loaders/RGBELoader.cjs.js +0 -1
- package/loaders/RGBELoader.d.ts +0 -20
- package/loaders/RGBELoader.js +0 -382
- package/loaders/RGBMLoader.cjs.js +0 -1
- package/loaders/RGBMLoader.d.ts +0 -32
- package/loaders/RGBMLoader.js +0 -1168
- package/loaders/STLLoader.cjs.js +0 -1
- package/loaders/STLLoader.d.ts +0 -14
- package/loaders/STLLoader.js +0 -296
- package/loaders/SVGLoader.cjs.js +0 -1
- package/loaders/SVGLoader.d.ts +0 -63
- package/loaders/SVGLoader.js +0 -2083
- package/loaders/TDSLoader.cjs.js +0 -1
- package/loaders/TDSLoader.d.ts +0 -42
- package/loaders/TDSLoader.js +0 -870
- package/loaders/TGALoader.cjs.js +0 -1
- package/loaders/TGALoader.d.ts +0 -14
- package/loaders/TGALoader.js +0 -396
- package/loaders/TTFLoader.cjs.js +0 -1
- package/loaders/TTFLoader.d.ts +0 -15
- package/loaders/TTFLoader.js +0 -152
- package/loaders/TiltLoader.cjs.js +0 -1
- package/loaders/TiltLoader.d.ts +0 -14
- package/loaders/TiltLoader.js +0 -411
- package/loaders/VOXLoader.cjs.js +0 -1
- package/loaders/VOXLoader.d.ts +0 -28
- package/loaders/VOXLoader.js +0 -196
- package/loaders/VRMLLoader.cjs.js +0 -1
- package/loaders/VRMLLoader.d.ts +0 -14
- package/loaders/VRMLLoader.js +0 -2575
- package/loaders/VRMLoader.cjs.js +0 -1
- package/loaders/VRMLoader.js +0 -46
- package/loaders/VTKLoader.cjs.js +0 -1
- package/loaders/VTKLoader.d.ts +0 -14
- package/loaders/VTKLoader.js +0 -834
- package/loaders/XLoader.cjs.js +0 -1
- package/loaders/XLoader.js +0 -1434
- package/loaders/XYZLoader.cjs.js +0 -1
- package/loaders/XYZLoader.d.ts +0 -14
- package/loaders/XYZLoader.js +0 -66
- package/loaders/lwo/IFFParser.cjs.js +0 -1
- package/loaders/lwo/IFFParser.js +0 -951
- package/loaders/lwo/LWO2Parser.cjs.js +0 -1
- package/loaders/lwo/LWO2Parser.js +0 -430
- package/loaders/lwo/LWO3Parser.cjs.js +0 -1
- package/loaders/lwo/LWO3Parser.js +0 -385
- package/math/Capsule.cjs.js +0 -1
- package/math/Capsule.d.ts +0 -27
- package/math/Capsule.js +0 -87
- package/math/ColorConverter.cjs.js +0 -1
- package/math/ColorConverter.d.ts +0 -21
- package/math/ColorConverter.js +0 -65
- package/math/ConvexHull.cjs.js +0 -1
- package/math/ConvexHull.d.ts +0 -89
- package/math/ConvexHull.js +0 -834
- package/math/ImprovedNoise.cjs.js +0 -1
- package/math/ImprovedNoise.d.ts +0 -4
- package/math/ImprovedNoise.js +0 -52
- package/math/Lut.cjs.js +0 -1
- package/math/Lut.d.ts +0 -27
- package/math/Lut.js +0 -119
- package/math/MeshSurfaceSampler.cjs.js +0 -1
- package/math/MeshSurfaceSampler.d.ts +0 -15
- package/math/MeshSurfaceSampler.js +0 -150
- package/math/OBB.cjs.js +0 -1
- package/math/OBB.d.ts +0 -24
- package/math/OBB.js +0 -296
- package/math/Octree.cjs.js +0 -1
- package/math/Octree.d.ts +0 -24
- package/math/Octree.js +0 -341
- package/math/SimplexNoise.cjs.js +0 -1
- package/math/SimplexNoise.d.ts +0 -17
- package/math/SimplexNoise.js +0 -446
- package/misc/ConvexObjectBreaker.cjs.js +0 -1
- package/misc/ConvexObjectBreaker.d.ts +0 -25
- package/misc/ConvexObjectBreaker.js +0 -398
- package/misc/GPUComputationRenderer.cjs.js +0 -1
- package/misc/GPUComputationRenderer.d.ts +0 -52
- package/misc/GPUComputationRenderer.js +0 -296
- package/misc/Gyroscope.cjs.js +0 -1
- package/misc/Gyroscope.d.ts +0 -5
- package/misc/Gyroscope.js +0 -41
- package/misc/MD2Character.cjs.js +0 -1
- package/misc/MD2Character.d.ts +0 -33
- package/misc/MD2Character.js +0 -184
- package/misc/MD2CharacterComplex.cjs.js +0 -1
- package/misc/MD2CharacterComplex.d.ts +0 -47
- package/misc/MD2CharacterComplex.js +0 -379
- package/misc/MorphAnimMesh.cjs.js +0 -1
- package/misc/MorphAnimMesh.d.ts +0 -13
- package/misc/MorphAnimMesh.js +0 -48
- package/misc/MorphBlendMesh.cjs.js +0 -1
- package/misc/MorphBlendMesh.d.ts +0 -21
- package/misc/MorphBlendMesh.js +0 -203
- package/misc/ProgressiveLightmap.cjs.js +0 -1
- package/misc/ProgressiveLightmap.js +0 -285
- package/misc/RollerCoaster.cjs.js +0 -1
- package/misc/RollerCoaster.d.ts +0 -21
- package/misc/RollerCoaster.js +0 -375
- package/misc/Timer.cjs.js +0 -1
- package/misc/Timer.d.ts +0 -27
- package/misc/Timer.js +0 -125
- package/misc/TubePainter.cjs.js +0 -1
- package/misc/TubePainter.d.ts +0 -10
- package/misc/TubePainter.js +0 -141
- package/misc/Volume.cjs.js +0 -1
- package/misc/Volume.d.ts +0 -37
- package/misc/Volume.js +0 -406
- package/misc/VolumeSlice.cjs.js +0 -1
- package/misc/VolumeSlice.d.ts +0 -28
- package/misc/VolumeSlice.js +0 -194
- package/misc/WebGL.cjs.js +0 -1
- package/misc/WebGL.d.ts +0 -5
- package/misc/WebGL.js +0 -71
- package/modifiers/CurveModifier.cjs.js +0 -1
- package/modifiers/CurveModifier.d.ts +0 -39
- package/modifiers/CurveModifier.js +0 -288
- package/modifiers/EdgeSplitModifier.cjs.js +0 -1
- package/modifiers/EdgeSplitModifier.d.ts +0 -19
- package/modifiers/EdgeSplitModifier.js +0 -205
- package/modifiers/SimplifyModifier.cjs.js +0 -1
- package/modifiers/SimplifyModifier.d.ts +0 -12
- package/modifiers/SimplifyModifier.js +0 -407
- package/modifiers/TessellateModifier.cjs.js +0 -1
- package/modifiers/TessellateModifier.d.ts +0 -8
- package/modifiers/TessellateModifier.js +0 -231
- package/nodes/Nodes.cjs.js +0 -1
- package/nodes/Nodes.js +0 -204
- package/nodes/ShaderNode.cjs.js +0 -1
- package/nodes/ShaderNode.js +0 -308
- package/nodes/accessors/BufferNode.cjs.js +0 -1
- package/nodes/accessors/BufferNode.js +0 -18
- package/nodes/accessors/CameraNode.cjs.js +0 -1
- package/nodes/accessors/CameraNode.js +0 -48
- package/nodes/accessors/CubeTextureNode.cjs.js +0 -1
- package/nodes/accessors/CubeTextureNode.js +0 -53
- package/nodes/accessors/MaterialNode.cjs.js +0 -1
- package/nodes/accessors/MaterialNode.js +0 -80
- package/nodes/accessors/MaterialReferenceNode.cjs.js +0 -1
- package/nodes/accessors/MaterialReferenceNode.js +0 -16
- package/nodes/accessors/ModelNode.cjs.js +0 -1
- package/nodes/accessors/ModelNode.js +0 -10
- package/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
- package/nodes/accessors/ModelViewProjectionNode.js +0 -22
- package/nodes/accessors/NormalNode.cjs.js +0 -1
- package/nodes/accessors/NormalNode.js +0 -60
- package/nodes/accessors/Object3DNode.cjs.js +0 -1
- package/nodes/accessors/Object3DNode.js +0 -85
- package/nodes/accessors/PointUVNode.cjs.js +0 -1
- package/nodes/accessors/PointUVNode.js +0 -16
- package/nodes/accessors/PositionNode.cjs.js +0 -1
- package/nodes/accessors/PositionNode.js +0 -63
- package/nodes/accessors/ReferenceNode.cjs.js +0 -1
- package/nodes/accessors/ReferenceNode.js +0 -43
- package/nodes/accessors/ReflectNode.cjs.js +0 -1
- package/nodes/accessors/ReflectNode.js +0 -45
- package/nodes/accessors/SkinningNode.cjs.js +0 -1
- package/nodes/accessors/SkinningNode.js +0 -59
- package/nodes/accessors/TextureNode.cjs.js +0 -1
- package/nodes/accessors/TextureNode.js +0 -68
- package/nodes/accessors/UVNode.cjs.js +0 -1
- package/nodes/accessors/UVNode.js +0 -28
- package/nodes/core/ArrayUniformNode.cjs.js +0 -1
- package/nodes/core/ArrayUniformNode.js +0 -17
- package/nodes/core/AttributeNode.cjs.js +0 -1
- package/nodes/core/AttributeNode.js +0 -36
- package/nodes/core/BypassNode.cjs.js +0 -1
- package/nodes/core/BypassNode.js +0 -28
- package/nodes/core/CodeNode.cjs.js +0 -1
- package/nodes/core/CodeNode.js +0 -35
- package/nodes/core/ConstNode.cjs.js +0 -1
- package/nodes/core/ConstNode.js +0 -17
- package/nodes/core/ContextNode.cjs.js +0 -1
- package/nodes/core/ContextNode.js +0 -26
- package/nodes/core/ExpressionNode.cjs.js +0 -1
- package/nodes/core/ExpressionNode.js +0 -22
- package/nodes/core/FunctionCallNode.cjs.js +0 -1
- package/nodes/core/FunctionCallNode.js +0 -45
- package/nodes/core/FunctionNode.cjs.js +0 -1
- package/nodes/core/FunctionNode.js +0 -70
- package/nodes/core/InputNode.cjs.js +0 -1
- package/nodes/core/InputNode.js +0 -48
- package/nodes/core/Node.cjs.js +0 -1
- package/nodes/core/Node.js +0 -178
- package/nodes/core/NodeAttribute.cjs.js +0 -1
- package/nodes/core/NodeAttribute.js +0 -11
- package/nodes/core/NodeBuilder.cjs.js +0 -1
- package/nodes/core/NodeBuilder.js +0 -509
- package/nodes/core/NodeCode.cjs.js +0 -1
- package/nodes/core/NodeCode.js +0 -13
- package/nodes/core/NodeFrame.cjs.js +0 -1
- package/nodes/core/NodeFrame.js +0 -37
- package/nodes/core/NodeFunction.cjs.js +0 -1
- package/nodes/core/NodeFunction.js +0 -17
- package/nodes/core/NodeFunctionInput.cjs.js +0 -1
- package/nodes/core/NodeFunctionInput.js +0 -14
- package/nodes/core/NodeKeywords.cjs.js +0 -1
- package/nodes/core/NodeKeywords.js +0 -54
- package/nodes/core/NodeParser.cjs.js +0 -1
- package/nodes/core/NodeParser.js +0 -8
- package/nodes/core/NodeUniform.cjs.js +0 -1
- package/nodes/core/NodeUniform.js +0 -21
- package/nodes/core/NodeUtils.cjs.js +0 -1
- package/nodes/core/NodeUtils.js +0 -61
- package/nodes/core/NodeVar.cjs.js +0 -1
- package/nodes/core/NodeVar.js +0 -11
- package/nodes/core/NodeVary.cjs.js +0 -1
- package/nodes/core/NodeVary.js +0 -11
- package/nodes/core/PropertyNode.cjs.js +0 -1
- package/nodes/core/PropertyNode.js +0 -26
- package/nodes/core/TempNode.cjs.js +0 -1
- package/nodes/core/TempNode.js +0 -30
- package/nodes/core/UniformNode.cjs.js +0 -1
- package/nodes/core/UniformNode.js +0 -28
- package/nodes/core/VarNode.cjs.js +0 -1
- package/nodes/core/VarNode.js +0 -38
- package/nodes/core/VaryNode.cjs.js +0 -1
- package/nodes/core/VaryNode.js +0 -38
- package/nodes/core/constants.cjs.js +0 -1
- package/nodes/core/constants.js +0 -11
- package/nodes/display/ColorSpaceNode.cjs.js +0 -1
- package/nodes/display/ColorSpaceNode.js +0 -66
- package/nodes/display/NormalMapNode.cjs.js +0 -1
- package/nodes/display/NormalMapNode.js +0 -71
- package/nodes/fog/FogNode.cjs.js +0 -1
- package/nodes/fog/FogNode.js +0 -18
- package/nodes/fog/FogRangeNode.cjs.js +0 -1
- package/nodes/fog/FogRangeNode.js +0 -20
- package/nodes/functions/BSDFs.cjs.js +0 -1
- package/nodes/functions/BSDFs.js +0 -121
- package/nodes/functions/PhysicalMaterialFunctions.cjs.js +0 -1
- package/nodes/functions/PhysicalMaterialFunctions.js +0 -57
- package/nodes/lights/LightContextNode.cjs.js +0 -1
- package/nodes/lights/LightContextNode.js +0 -43
- package/nodes/lights/LightNode.cjs.js +0 -1
- package/nodes/lights/LightNode.js +0 -61
- package/nodes/lights/LightsNode.cjs.js +0 -1
- package/nodes/lights/LightsNode.js +0 -77
- package/nodes/loaders/NodeLoader.cjs.js +0 -1
- package/nodes/loaders/NodeLoader.js +0 -212
- package/nodes/loaders/NodeMaterialLoader.cjs.js +0 -1
- package/nodes/loaders/NodeMaterialLoader.js +0 -29
- package/nodes/loaders/NodeObjectLoader.cjs.js +0 -1
- package/nodes/loaders/NodeObjectLoader.js +0 -49
- package/nodes/materials/LineBasicNodeMaterial.cjs.js +0 -1
- package/nodes/materials/LineBasicNodeMaterial.js +0 -31
- package/nodes/materials/Materials.cjs.js +0 -1
- package/nodes/materials/Materials.js +0 -27
- package/nodes/materials/MeshBasicNodeMaterial.cjs.js +0 -1
- package/nodes/materials/MeshBasicNodeMaterial.js +0 -32
- package/nodes/materials/MeshStandardNodeMaterial.cjs.js +0 -1
- package/nodes/materials/MeshStandardNodeMaterial.js +0 -43
- package/nodes/materials/NodeMaterial.cjs.js +0 -1
- package/nodes/materials/NodeMaterial.js +0 -79
- package/nodes/materials/PointsNodeMaterial.cjs.js +0 -1
- package/nodes/materials/PointsNodeMaterial.js +0 -34
- package/nodes/math/CondNode.cjs.js +0 -1
- package/nodes/math/CondNode.js +0 -49
- package/nodes/math/MathNode.cjs.js +0 -1
- package/nodes/math/MathNode.js +0 -206
- package/nodes/math/OperatorNode.cjs.js +0 -1
- package/nodes/math/OperatorNode.js +0 -124
- package/nodes/parsers/GLSLNodeFunction.cjs.js +0 -1
- package/nodes/parsers/GLSLNodeFunction.js +0 -101
- package/nodes/parsers/GLSLNodeParser.cjs.js +0 -1
- package/nodes/parsers/GLSLNodeParser.js +0 -13
- package/nodes/parsers/WGSLNodeFunction.cjs.js +0 -1
- package/nodes/parsers/WGSLNodeFunction.js +0 -71
- package/nodes/parsers/WGSLNodeParser.cjs.js +0 -1
- package/nodes/parsers/WGSLNodeParser.js +0 -13
- package/nodes/procedural/CheckerNode.cjs.js +0 -1
- package/nodes/procedural/CheckerNode.js +0 -26
- package/nodes/utils/ArrayElementNode.cjs.js +0 -1
- package/nodes/utils/ArrayElementNode.js +0 -22
- package/nodes/utils/ConvertNode.cjs.js +0 -1
- package/nodes/utils/ConvertNode.js +0 -29
- package/nodes/utils/JoinNode.cjs.js +0 -1
- package/nodes/utils/JoinNode.js +0 -29
- package/nodes/utils/MatcapUVNode.cjs.js +0 -1
- package/nodes/utils/MatcapUVNode.js +0 -18
- package/nodes/utils/OscNode.cjs.js +0 -1
- package/nodes/utils/OscNode.js +0 -55
- package/nodes/utils/SplitNode.cjs.js +0 -1
- package/nodes/utils/SplitNode.js +0 -58
- package/nodes/utils/SpriteSheetUVNode.cjs.js +0 -1
- package/nodes/utils/SpriteSheetUVNode.js +0 -39
- package/nodes/utils/TimerNode.cjs.js +0 -1
- package/nodes/utils/TimerNode.js +0 -47
- package/objects/GroundProjectedEnv.cjs.js +0 -1
- package/objects/GroundProjectedEnv.d.ts +0 -12
- package/objects/GroundProjectedEnv.js +0 -145
- package/objects/Lensflare.cjs.js +0 -1
- package/objects/Lensflare.d.ts +0 -17
- package/objects/Lensflare.js +0 -332
- package/objects/LightningStorm.cjs.js +0 -1
- package/objects/LightningStorm.d.ts +0 -32
- package/objects/LightningStorm.js +0 -174
- package/objects/MarchingCubes.cjs.js +0 -1
- package/objects/MarchingCubes.d.ts +0 -75
- package/objects/MarchingCubes.js +0 -610
- package/objects/Reflector.cjs.js +0 -1
- package/objects/Reflector.d.ts +0 -19
- package/objects/Reflector.js +0 -188
- package/objects/ReflectorForSSRPass.cjs.js +0 -1
- package/objects/ReflectorForSSRPass.d.ts +0 -57
- package/objects/ReflectorForSSRPass.js +0 -298
- package/objects/ReflectorRTT.cjs.js +0 -1
- package/objects/ReflectorRTT.js +0 -11
- package/objects/Refractor.cjs.js +0 -1
- package/objects/Refractor.d.ts +0 -19
- package/objects/Refractor.js +0 -220
- package/objects/ShadowMesh.cjs.js +0 -1
- package/objects/ShadowMesh.d.ts +0 -7
- package/objects/ShadowMesh.js +0 -50
- package/objects/Sky.cjs.js +0 -1
- package/objects/Sky.d.ts +0 -30
- package/objects/Sky.js +0 -85
- package/objects/Water.cjs.js +0 -1
- package/objects/Water.d.ts +0 -22
- package/objects/Water.js +0 -279
- package/objects/Water2.cjs.js +0 -1
- package/objects/Water2.d.ts +0 -30
- package/objects/Water2.js +0 -288
- package/offscreen/jank.cjs.js +0 -1
- package/offscreen/jank.js +0 -30
- package/offscreen/offscreen.cjs.js +0 -1
- package/offscreen/offscreen.js +0 -7
- package/offscreen/scene.cjs.js +0 -1
- package/offscreen/scene.js +0 -73
- package/physics/AmmoPhysics.cjs.js +0 -1
- package/physics/AmmoPhysics.d.ts +0 -7
- package/physics/AmmoPhysics.js +0 -206
- package/postprocessing/AdaptiveToneMappingPass.cjs.js +0 -1
- package/postprocessing/AdaptiveToneMappingPass.d.ts +0 -29
- package/postprocessing/AdaptiveToneMappingPass.js +0 -247
- package/postprocessing/AfterimagePass.cjs.js +0 -1
- package/postprocessing/AfterimagePass.d.ts +0 -15
- package/postprocessing/AfterimagePass.js +0 -76
- package/postprocessing/BloomPass.cjs.js +0 -1
- package/postprocessing/BloomPass.d.ts +0 -16
- package/postprocessing/BloomPass.js +0 -116
- package/postprocessing/BokehPass.cjs.js +0 -1
- package/postprocessing/BokehPass.d.ts +0 -23
- package/postprocessing/BokehPass.js +0 -106
- package/postprocessing/ClearPass.cjs.js +0 -1
- package/postprocessing/ClearPass.d.ts +0 -10
- package/postprocessing/ClearPass.js +0 -42
- package/postprocessing/CubeTexturePass.cjs.js +0 -1
- package/postprocessing/CubeTexturePass.d.ts +0 -14
- package/postprocessing/CubeTexturePass.js +0 -48
- package/postprocessing/DotScreenPass.cjs.js +0 -1
- package/postprocessing/DotScreenPass.d.ts +0 -10
- package/postprocessing/DotScreenPass.js +0 -48
- package/postprocessing/EffectComposer.cjs.js +0 -1
- package/postprocessing/EffectComposer.d.ts +0 -27
- package/postprocessing/EffectComposer.js +0 -186
- package/postprocessing/FilmPass.cjs.js +0 -1
- package/postprocessing/FilmPass.d.ts +0 -10
- package/postprocessing/FilmPass.js +0 -47
- package/postprocessing/GlitchPass.cjs.js +0 -1
- package/postprocessing/GlitchPass.d.ts +0 -15
- package/postprocessing/GlitchPass.js +0 -96
- package/postprocessing/HalftonePass.cjs.js +0 -1
- package/postprocessing/HalftonePass.d.ts +0 -23
- package/postprocessing/HalftonePass.js +0 -64
- package/postprocessing/LUTPass.cjs.js +0 -1
- package/postprocessing/LUTPass.d.ts +0 -13
- package/postprocessing/LUTPass.js +0 -161
- package/postprocessing/MaskPass.cjs.js +0 -1
- package/postprocessing/MaskPass.d.ts +0 -14
- package/postprocessing/MaskPass.js +0 -79
- package/postprocessing/OutlinePass.cjs.js +0 -1
- package/postprocessing/OutlinePass.d.ts +0 -53
- package/postprocessing/OutlinePass.js +0 -580
- package/postprocessing/Pass.cjs.js +0 -1
- package/postprocessing/Pass.d.ts +0 -20
- package/postprocessing/Pass.js +0 -61
- package/postprocessing/RenderPass.cjs.js +0 -1
- package/postprocessing/RenderPass.d.ts +0 -14
- package/postprocessing/RenderPass.js +0 -71
- package/postprocessing/RenderPixelatedPass.cjs.js +0 -1
- package/postprocessing/RenderPixelatedPass.js +0 -213
- package/postprocessing/SAOPass.cjs.js +0 -1
- package/postprocessing/SAOPass.d.ts +0 -79
- package/postprocessing/SAOPass.js +0 -317
- package/postprocessing/SMAAPass.cjs.js +0 -1
- package/postprocessing/SMAAPass.d.ts +0 -21
- package/postprocessing/SMAAPass.js +0 -132
- package/postprocessing/SSAARenderPass.cjs.js +0 -1
- package/postprocessing/SSAARenderPass.d.ts +0 -17
- package/postprocessing/SSAARenderPass.js +0 -118
- package/postprocessing/SSAOPass.cjs.js +0 -1
- package/postprocessing/SSAOPass.d.ts +0 -71
- package/postprocessing/SSAOPass.js +0 -314
- package/postprocessing/SSRPass.cjs.js +0 -1
- package/postprocessing/SSRPass.d.ts +0 -124
- package/postprocessing/SSRPass.js +0 -508
- package/postprocessing/SavePass.cjs.js +0 -1
- package/postprocessing/SavePass.d.ts +0 -12
- package/postprocessing/SavePass.js +0 -42
- package/postprocessing/ShaderPass.cjs.js +0 -1
- package/postprocessing/ShaderPass.d.ts +0 -13
- package/postprocessing/ShaderPass.js +0 -55
- package/postprocessing/TAARenderPass.cjs.js +0 -1
- package/postprocessing/TAARenderPass.d.ts +0 -8
- package/postprocessing/TAARenderPass.js +0 -107
- package/postprocessing/TexturePass.cjs.js +0 -1
- package/postprocessing/TexturePass.d.ts +0 -12
- package/postprocessing/TexturePass.js +0 -40
- package/postprocessing/UnrealBloomPass.cjs.js +0 -1
- package/postprocessing/UnrealBloomPass.d.ts +0 -31
- package/postprocessing/UnrealBloomPass.js +0 -273
- package/postprocessing/WaterPass.cjs.js +0 -1
- package/postprocessing/WaterPass.d.ts +0 -12
- package/postprocessing/WaterPass.js +0 -102
- package/renderers/CSS2DRenderer.cjs.js +0 -1
- package/renderers/CSS2DRenderer.d.ts +0 -22
- package/renderers/CSS2DRenderer.js +0 -152
- package/renderers/CSS3DRenderer.cjs.js +0 -1
- package/renderers/CSS3DRenderer.d.ts +0 -26
- package/renderers/CSS3DRenderer.js +0 -166
- package/renderers/Projector.cjs.js +0 -1
- package/renderers/Projector.d.ts +0 -60
- package/renderers/Projector.js +0 -678
- package/renderers/SVGRenderer.cjs.js +0 -1
- package/renderers/SVGRenderer.d.ts +0 -25
- package/renderers/SVGRenderer.js +0 -416
- package/renderers/nodes/accessors/CameraNode.cjs.js +0 -1
- package/renderers/nodes/accessors/CameraNode.js +0 -73
- package/renderers/nodes/accessors/ModelNode.cjs.js +0 -1
- package/renderers/nodes/accessors/ModelNode.js +0 -69
- package/renderers/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
- package/renderers/nodes/accessors/ModelViewProjectionNode.js +0 -33
- package/renderers/nodes/accessors/NormalNode.cjs.js +0 -1
- package/renderers/nodes/accessors/NormalNode.js +0 -70
- package/renderers/nodes/accessors/PositionNode.cjs.js +0 -1
- package/renderers/nodes/accessors/PositionNode.js +0 -30
- package/renderers/nodes/accessors/UVNode.cjs.js +0 -1
- package/renderers/nodes/accessors/UVNode.js +0 -17
- package/renderers/nodes/core/AttributeNode.cjs.js +0 -1
- package/renderers/nodes/core/AttributeNode.js +0 -43
- package/renderers/nodes/core/InputNode.cjs.js +0 -1
- package/renderers/nodes/core/InputNode.js +0 -40
- package/renderers/nodes/core/Node.cjs.js +0 -1
- package/renderers/nodes/core/Node.js +0 -43
- package/renderers/nodes/core/NodeAttribute.cjs.js +0 -1
- package/renderers/nodes/core/NodeAttribute.js +0 -12
- package/renderers/nodes/core/NodeBuilder.cjs.js +0 -1
- package/renderers/nodes/core/NodeBuilder.js +0 -309
- package/renderers/nodes/core/NodeFrame.cjs.js +0 -1
- package/renderers/nodes/core/NodeFrame.js +0 -37
- package/renderers/nodes/core/NodeSlot.cjs.js +0 -1
- package/renderers/nodes/core/NodeSlot.js +0 -10
- package/renderers/nodes/core/NodeUniform.cjs.js +0 -1
- package/renderers/nodes/core/NodeUniform.js +0 -22
- package/renderers/nodes/core/NodeVary.cjs.js +0 -1
- package/renderers/nodes/core/NodeVary.js +0 -13
- package/renderers/nodes/core/VaryNode.cjs.js +0 -1
- package/renderers/nodes/core/VaryNode.js +0 -27
- package/renderers/nodes/core/constants.cjs.js +0 -1
- package/renderers/nodes/core/constants.js +0 -19
- package/renderers/nodes/inputs/ColorNode.cjs.js +0 -1
- package/renderers/nodes/inputs/ColorNode.js +0 -16
- package/renderers/nodes/inputs/FloatNode.cjs.js +0 -1
- package/renderers/nodes/inputs/FloatNode.js +0 -16
- package/renderers/nodes/inputs/Matrix3Node.cjs.js +0 -1
- package/renderers/nodes/inputs/Matrix3Node.js +0 -17
- package/renderers/nodes/inputs/Matrix4Node.cjs.js +0 -1
- package/renderers/nodes/inputs/Matrix4Node.js +0 -17
- package/renderers/nodes/inputs/TextureNode.cjs.js +0 -1
- package/renderers/nodes/inputs/TextureNode.js +0 -27
- package/renderers/nodes/inputs/Vector2Node.cjs.js +0 -1
- package/renderers/nodes/inputs/Vector2Node.js +0 -16
- package/renderers/nodes/inputs/Vector3Node.cjs.js +0 -1
- package/renderers/nodes/inputs/Vector3Node.js +0 -17
- package/renderers/nodes/inputs/Vector4Node.cjs.js +0 -1
- package/renderers/nodes/inputs/Vector4Node.js +0 -17
- package/renderers/nodes/math/MathNode.cjs.js +0 -1
- package/renderers/nodes/math/MathNode.js +0 -64
- package/renderers/nodes/math/OperatorNode.cjs.js +0 -1
- package/renderers/nodes/math/OperatorNode.js +0 -57
- package/renderers/nodes/utils/SwitchNode.cjs.js +0 -1
- package/renderers/nodes/utils/SwitchNode.js +0 -24
- package/renderers/nodes/utils/TimerNode.cjs.js +0 -1
- package/renderers/nodes/utils/TimerNode.js +0 -18
- package/renderers/webgpu/WebGPU.cjs.js +0 -1
- package/renderers/webgpu/WebGPU.js +0 -25
- package/renderers/webgpu/WebGPUAttributes.cjs.js +0 -1
- package/renderers/webgpu/WebGPUAttributes.js +0 -75
- package/renderers/webgpu/WebGPUBackground.cjs.js +0 -1
- package/renderers/webgpu/WebGPUBackground.js +0 -77
- package/renderers/webgpu/WebGPUBinding.cjs.js +0 -1
- package/renderers/webgpu/WebGPUBinding.js +0 -16
- package/renderers/webgpu/WebGPUBindings.cjs.js +0 -1
- package/renderers/webgpu/WebGPUBindings.js +0 -190
- package/renderers/webgpu/WebGPUComputePipelines.cjs.js +0 -1
- package/renderers/webgpu/WebGPUComputePipelines.js +0 -54
- package/renderers/webgpu/WebGPUGeometries.cjs.js +0 -1
- package/renderers/webgpu/WebGPUGeometries.js +0 -50
- package/renderers/webgpu/WebGPUInfo.cjs.js +0 -1
- package/renderers/webgpu/WebGPUInfo.js +0 -50
- package/renderers/webgpu/WebGPUObjects.cjs.js +0 -1
- package/renderers/webgpu/WebGPUObjects.js +0 -29
- package/renderers/webgpu/WebGPUProperties.cjs.js +0 -1
- package/renderers/webgpu/WebGPUProperties.js +0 -27
- package/renderers/webgpu/WebGPURenderLists.cjs.js +0 -1
- package/renderers/webgpu/WebGPURenderLists.js +0 -134
- package/renderers/webgpu/WebGPURenderPipelines.cjs.js +0 -1
- package/renderers/webgpu/WebGPURenderPipelines.js +0 -671
- package/renderers/webgpu/WebGPURenderer.cjs.js +0 -1
- package/renderers/webgpu/WebGPURenderer.js +0 -713
- package/renderers/webgpu/WebGPUSampledTexture.cjs.js +0 -1
- package/renderers/webgpu/WebGPUSampledTexture.js +0 -53
- package/renderers/webgpu/WebGPUSampler.cjs.js +0 -1
- package/renderers/webgpu/WebGPUSampler.js +0 -19
- package/renderers/webgpu/WebGPUStorageBuffer.cjs.js +0 -1
- package/renderers/webgpu/WebGPUStorageBuffer.js +0 -19
- package/renderers/webgpu/WebGPUTextureRenderer.cjs.js +0 -1
- package/renderers/webgpu/WebGPUTextureRenderer.js +0 -28
- package/renderers/webgpu/WebGPUTextureUtils.cjs.js +0 -1
- package/renderers/webgpu/WebGPUTextureUtils.js +0 -108
- package/renderers/webgpu/WebGPUTextures.cjs.js +0 -1
- package/renderers/webgpu/WebGPUTextures.js +0 -630
- package/renderers/webgpu/WebGPUUniform.cjs.js +0 -1
- package/renderers/webgpu/WebGPUUniform.js +0 -107
- package/renderers/webgpu/WebGPUUniformsGroup.cjs.js +0 -1
- package/renderers/webgpu/WebGPUUniformsGroup.js +0 -215
- package/renderers/webgpu/constants.cjs.js +0 -1
- package/renderers/webgpu/constants.js +0 -221
- package/renderers/webgpu/nodes/ShaderLib.cjs.js +0 -1
- package/renderers/webgpu/nodes/ShaderLib.js +0 -41
- package/renderers/webgpu/nodes/WebGPUNodeBuilder.cjs.js +0 -1
- package/renderers/webgpu/nodes/WebGPUNodeBuilder.js +0 -235
- package/renderers/webgpu/nodes/WebGPUNodeUniform.cjs.js +0 -1
- package/renderers/webgpu/nodes/WebGPUNodeUniform.js +0 -87
- package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.cjs.js +0 -1
- package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +0 -15
- package/renderers/webgpu/nodes/WebGPUNodes.cjs.js +0 -1
- package/renderers/webgpu/nodes/WebGPUNodes.js +0 -77
- package/shaders/ACESFilmicToneMappingShader.cjs.js +0 -1
- package/shaders/ACESFilmicToneMappingShader.d.ts +0 -9
- package/shaders/ACESFilmicToneMappingShader.js +0 -28
- package/shaders/AfterimageShader.cjs.js +0 -1
- package/shaders/AfterimageShader.d.ts +0 -10
- package/shaders/AfterimageShader.js +0 -22
- package/shaders/BasicShader.cjs.js +0 -1
- package/shaders/BasicShader.d.ts +0 -5
- package/shaders/BasicShader.js +0 -10
- package/shaders/BleachBypassShader.cjs.js +0 -1
- package/shaders/BleachBypassShader.d.ts +0 -9
- package/shaders/BleachBypassShader.js +0 -19
- package/shaders/BlendShader.cjs.js +0 -1
- package/shaders/BlendShader.d.ts +0 -18
- package/shaders/BlendShader.js +0 -23
- package/shaders/BokehShader.cjs.js +0 -1
- package/shaders/BokehShader.d.ts +0 -19
- package/shaders/BokehShader.js +0 -44
- package/shaders/BokehShader2.cjs.js +0 -1
- package/shaders/BokehShader2.d.ts +0 -43
- package/shaders/BokehShader2.js +0 -98
- package/shaders/BrightnessContrastShader.cjs.js +0 -1
- package/shaders/BrightnessContrastShader.d.ts +0 -15
- package/shaders/BrightnessContrastShader.js +0 -23
- package/shaders/ColorCorrectionShader.cjs.js +0 -1
- package/shaders/ColorCorrectionShader.d.ts +0 -19
- package/shaders/ColorCorrectionShader.js +0 -26
- package/shaders/ColorifyShader.cjs.js +0 -1
- package/shaders/ColorifyShader.d.ts +0 -13
- package/shaders/ColorifyShader.js +0 -20
- package/shaders/ConvolutionShader.cjs.js +0 -1
- package/shaders/ConvolutionShader.d.ts +0 -16
- package/shaders/ConvolutionShader.js +0 -51
- package/shaders/CopyShader.cjs.js +0 -1
- package/shaders/CopyShader.d.ts +0 -9
- package/shaders/CopyShader.js +0 -17
- package/shaders/DOFMipMapShader.cjs.js +0 -1
- package/shaders/DOFMipMapShader.d.ts +0 -18
- package/shaders/DOFMipMapShader.js +0 -25
- package/shaders/DepthLimitedBlurShader.cjs.js +0 -1
- package/shaders/DepthLimitedBlurShader.d.ts +0 -28
- package/shaders/DepthLimitedBlurShader.js +0 -69
- package/shaders/DigitalGlitch.cjs.js +0 -1
- package/shaders/DigitalGlitch.d.ts +0 -39
- package/shaders/DigitalGlitch.js +0 -106
- package/shaders/DotScreenShader.cjs.js +0 -1
- package/shaders/DotScreenShader.d.ts +0 -22
- package/shaders/DotScreenShader.js +0 -31
- package/shaders/FXAAShader.cjs.js +0 -1
- package/shaders/FXAAShader.d.ts +0 -13
- package/shaders/FXAAShader.js +0 -23
- package/shaders/FilmShader.cjs.js +0 -1
- package/shaders/FilmShader.d.ts +0 -24
- package/shaders/FilmShader.js +0 -56
- package/shaders/FocusShader.cjs.js +0 -1
- package/shaders/FocusShader.d.ts +0 -21
- package/shaders/FocusShader.js +0 -28
- package/shaders/FreiChenShader.cjs.js +0 -1
- package/shaders/FreiChenShader.d.ts +0 -13
- package/shaders/FreiChenShader.js +0 -28
- package/shaders/FresnelShader.cjs.js +0 -1
- package/shaders/FresnelShader.d.ts +0 -21
- package/shaders/FresnelShader.js +0 -26
- package/shaders/GammaCorrectionShader.cjs.js +0 -1
- package/shaders/GammaCorrectionShader.d.ts +0 -8
- package/shaders/GammaCorrectionShader.js +0 -15
- package/shaders/GodRaysShader.cjs.js +0 -1
- package/shaders/GodRaysShader.d.ts +0 -58
- package/shaders/GodRaysShader.js +0 -137
- package/shaders/HalftoneShader.cjs.js +0 -1
- package/shaders/HalftoneShader.d.ts +0 -45
- package/shaders/HalftoneShader.js +0 -69
- package/shaders/HorizontalBlurShader.cjs.js +0 -1
- package/shaders/HorizontalBlurShader.d.ts +0 -9
- package/shaders/HorizontalBlurShader.js +0 -59
- package/shaders/HorizontalTiltShiftShader.cjs.js +0 -1
- package/shaders/HorizontalTiltShiftShader.d.ts +0 -15
- package/shaders/HorizontalTiltShiftShader.js +0 -25
- package/shaders/HueSaturationShader.cjs.js +0 -1
- package/shaders/HueSaturationShader.d.ts +0 -15
- package/shaders/HueSaturationShader.js +0 -25
- package/shaders/KaleidoShader.cjs.js +0 -1
- package/shaders/KaleidoShader.d.ts +0 -15
- package/shaders/KaleidoShader.js +0 -26
- package/shaders/LuminosityHighPassShader.cjs.js +0 -1
- package/shaders/LuminosityHighPassShader.d.ts +0 -23
- package/shaders/LuminosityHighPassShader.js +0 -31
- package/shaders/LuminosityShader.cjs.js +0 -1
- package/shaders/LuminosityShader.d.ts +0 -9
- package/shaders/LuminosityShader.js +0 -15
- package/shaders/MirrorShader.cjs.js +0 -1
- package/shaders/MirrorShader.d.ts +0 -12
- package/shaders/MirrorShader.js +0 -20
- package/shaders/NormalMapShader.cjs.js +0 -1
- package/shaders/NormalMapShader.d.ts +0 -19
- package/shaders/NormalMapShader.js +0 -27
- package/shaders/ParallaxShader.cjs.js +0 -1
- package/shaders/ParallaxShader.d.ts +0 -28
- package/shaders/ParallaxShader.js +0 -54
- package/shaders/PixelShader.cjs.js +0 -1
- package/shaders/PixelShader.d.ts +0 -15
- package/shaders/PixelShader.js +0 -20
- package/shaders/RGBShiftShader.cjs.js +0 -1
- package/shaders/RGBShiftShader.d.ts +0 -15
- package/shaders/RGBShiftShader.js +0 -26
- package/shaders/SAOShader.cjs.js +0 -1
- package/shaders/SAOShader.d.ts +0 -25
- package/shaders/SAOShader.js +0 -60
- package/shaders/SMAAShader.cjs.js +0 -1
- package/shaders/SMAAShader.d.ts +0 -55
- package/shaders/SMAAShader.js +0 -151
- package/shaders/SSAOShader.cjs.js +0 -1
- package/shaders/SSAOShader.d.ts +0 -80
- package/shaders/SSAOShader.js +0 -100
- package/shaders/SSRShader.cjs.js +0 -1
- package/shaders/SSRShader.d.ts +0 -90
- package/shaders/SSRShader.js +0 -379
- package/shaders/SepiaShader.cjs.js +0 -1
- package/shaders/SepiaShader.d.ts +0 -12
- package/shaders/SepiaShader.js +0 -19
- package/shaders/SobelOperatorShader.cjs.js +0 -1
- package/shaders/SobelOperatorShader.d.ts +0 -13
- package/shaders/SobelOperatorShader.js +0 -33
- package/shaders/SubsurfaceScatteringShader.cjs.js +0 -1
- package/shaders/SubsurfaceScatteringShader.d.ts +0 -5
- package/shaders/SubsurfaceScatteringShader.js +0 -45
- package/shaders/TechnicolorShader.cjs.js +0 -1
- package/shaders/TechnicolorShader.d.ts +0 -9
- package/shaders/TechnicolorShader.js +0 -17
- package/shaders/ToneMapShader.cjs.js +0 -1
- package/shaders/ToneMapShader.d.ts +0 -24
- package/shaders/ToneMapShader.js +0 -32
- package/shaders/ToonShader.cjs.js +0 -1
- package/shaders/ToonShader.d.ts +0 -100
- package/shaders/ToonShader.js +0 -112
- package/shaders/TriangleBlurShader.cjs.js +0 -1
- package/shaders/TriangleBlurShader.d.ts +0 -13
- package/shaders/TriangleBlurShader.js +0 -27
- package/shaders/UnpackDepthRGBAShader.cjs.js +0 -1
- package/shaders/UnpackDepthRGBAShader.d.ts +0 -12
- package/shaders/UnpackDepthRGBAShader.js +0 -18
- package/shaders/VerticalBlurShader.cjs.js +0 -1
- package/shaders/VerticalBlurShader.d.ts +0 -9
- package/shaders/VerticalBlurShader.js +0 -60
- package/shaders/VerticalTiltShiftShader.cjs.js +0 -1
- package/shaders/VerticalTiltShiftShader.d.ts +0 -15
- package/shaders/VerticalTiltShiftShader.js +0 -25
- package/shaders/VignetteShader.cjs.js +0 -1
- package/shaders/VignetteShader.d.ts +0 -15
- package/shaders/VignetteShader.js +0 -32
- package/shaders/VolumeShader.cjs.js +0 -1
- package/shaders/VolumeShader.d.ts +0 -25
- package/shaders/VolumeShader.js +0 -81
- package/shaders/WaterRefractionShader.cjs.js +0 -1
- package/shaders/WaterRefractionShader.d.ts +0 -21
- package/shaders/WaterRefractionShader.js +0 -25
- package/shaders/types.cjs.js +0 -1
- package/shaders/types.d.ts +0 -14
- package/shaders/types.js +0 -1
- package/textures/FlakesTexture.cjs.js +0 -1
- package/textures/FlakesTexture.d.ts +0 -4
- package/textures/FlakesTexture.js +0 -32
- package/types/helpers.cjs.js +0 -1
- package/types/helpers.d.ts +0 -1
- package/types/helpers.js +0 -3
- package/types/shared.cjs.js +0 -1
- package/types/shared.d.ts +0 -2
- package/types/shared.js +0 -1
- package/types/utils.cjs.js +0 -1
- package/types/utils.d.ts +0 -3
- package/types/utils.js +0 -1
- package/utils/BufferGeometryUtils.cjs.js +0 -1
- package/utils/BufferGeometryUtils.d.ts +0 -15
- package/utils/BufferGeometryUtils.js +0 -728
- package/utils/GeometryCompressionUtils.cjs.js +0 -1
- package/utils/GeometryCompressionUtils.d.ts +0 -7
- package/utils/GeometryCompressionUtils.js +0 -545
- package/utils/GeometryUtils.cjs.js +0 -1
- package/utils/GeometryUtils.d.ts +0 -6
- package/utils/GeometryUtils.js +0 -161
- package/utils/LDrawUtils.cjs.js +0 -1
- package/utils/LDrawUtils.d.ts +0 -5
- package/utils/LDrawUtils.js +0 -144
- package/utils/RoughnessMipmapper.cjs.js +0 -1
- package/utils/RoughnessMipmapper.js +0 -257
- package/utils/SceneUtils.cjs.js +0 -1
- package/utils/SceneUtils.d.ts +0 -9
- package/utils/SceneUtils.js +0 -41
- package/utils/ShadowMapViewer.cjs.js +0 -1
- package/utils/ShadowMapViewer.d.ts +0 -24
- package/utils/ShadowMapViewer.js +0 -160
- package/utils/SkeletonUtils.cjs.js +0 -1
- package/utils/SkeletonUtils.d.ts +0 -30
- package/utils/SkeletonUtils.js +0 -383
- package/utils/UVsDebug.cjs.js +0 -1
- package/utils/UVsDebug.d.ts +0 -3
- package/utils/UVsDebug.js +0 -115
- package/utils/WorkerPool.cjs.js +0 -1
- package/utils/WorkerPool.js +0 -82
- package/webxr/ARButton.cjs.js +0 -1
- package/webxr/ARButton.d.ts +0 -5
- package/webxr/ARButton.js +0 -145
- package/webxr/OculusHandModel.cjs.js +0 -1
- package/webxr/OculusHandModel.d.ts +0 -22
- package/webxr/OculusHandModel.js +0 -90
- package/webxr/OculusHandPointerModel.cjs.js +0 -1
- package/webxr/OculusHandPointerModel.d.ts +0 -63
- package/webxr/OculusHandPointerModel.js +0 -248
- package/webxr/Text2D.cjs.js +0 -1
- package/webxr/Text2D.d.ts +0 -3
- package/webxr/Text2D.js +0 -32
- package/webxr/VRButton.cjs.js +0 -1
- package/webxr/VRButton.d.ts +0 -7
- package/webxr/VRButton.js +0 -136
- package/webxr/XRControllerModelFactory.cjs.js +0 -1
- package/webxr/XRControllerModelFactory.d.ts +0 -19
- package/webxr/XRControllerModelFactory.js +0 -237
- package/webxr/XREstimatedLight.cjs.js +0 -1
- package/webxr/XREstimatedLight.d.ts +0 -32
- package/webxr/XREstimatedLight.js +0 -153
- package/webxr/XRHandMeshModel.cjs.js +0 -1
- package/webxr/XRHandMeshModel.d.ts +0 -9
- package/webxr/XRHandMeshModel.js +0 -62
- package/webxr/XRHandModelFactory.cjs.js +0 -1
- package/webxr/XRHandModelFactory.d.ts +0 -25
- package/webxr/XRHandModelFactory.js +0 -64
- package/webxr/XRHandPrimitiveModel.cjs.js +0 -1
- package/webxr/XRHandPrimitiveModel.d.ts +0 -24
- package/webxr/XRHandPrimitiveModel.js +0 -54
package/loaders/VRMLLoader.js
DELETED
|
@@ -1,2575 +0,0 @@
|
|
|
1
|
-
import { Loader, LoaderUtils, FileLoader, Vector3, Vector2, TextureLoader, Scene, Object3D, Group, SphereGeometry, MeshBasicMaterial, BackSide, Mesh, PointsMaterial, Points, LineBasicMaterial, LineSegments, FrontSide, DoubleSide, MeshPhongMaterial, Color, DataTexture, BufferGeometry, Float32BufferAttribute, BoxGeometry, ConeGeometry, CylinderGeometry, Quaternion, ShapeUtils, BufferAttribute, RepeatWrapping, ClampToEdgeWrapping } from 'three';
|
|
2
|
-
import { createToken, Lexer, CstParser } from 'chevrotain';
|
|
3
|
-
|
|
4
|
-
class VRMLLoader extends Loader {
|
|
5
|
-
constructor(manager) {
|
|
6
|
-
super(manager);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
load(url, onLoad, onProgress, onError) {
|
|
10
|
-
const scope = this;
|
|
11
|
-
const path = scope.path === '' ? LoaderUtils.extractUrlBase(url) : scope.path;
|
|
12
|
-
const loader = new FileLoader(scope.manager);
|
|
13
|
-
loader.setPath(scope.path);
|
|
14
|
-
loader.setRequestHeader(scope.requestHeader);
|
|
15
|
-
loader.setWithCredentials(scope.withCredentials);
|
|
16
|
-
loader.load(url, function (text) {
|
|
17
|
-
try {
|
|
18
|
-
onLoad(scope.parse(text, path));
|
|
19
|
-
} catch (e) {
|
|
20
|
-
if (onError) {
|
|
21
|
-
onError(e);
|
|
22
|
-
} else {
|
|
23
|
-
console.error(e);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
scope.manager.itemError(url);
|
|
27
|
-
}
|
|
28
|
-
}, onProgress, onError);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
parse(data, path) {
|
|
32
|
-
const nodeMap = {};
|
|
33
|
-
|
|
34
|
-
function generateVRMLTree(data) {
|
|
35
|
-
// create lexer, parser and visitor
|
|
36
|
-
const tokenData = createTokens();
|
|
37
|
-
const lexer = new VRMLLexer(tokenData.tokens);
|
|
38
|
-
const parser = new VRMLParser(tokenData.tokenVocabulary);
|
|
39
|
-
const visitor = createVisitor(parser.getBaseCstVisitorConstructor()); // lexing
|
|
40
|
-
|
|
41
|
-
const lexingResult = lexer.lex(data);
|
|
42
|
-
parser.input = lexingResult.tokens; // parsing
|
|
43
|
-
|
|
44
|
-
const cstOutput = parser.vrml();
|
|
45
|
-
|
|
46
|
-
if (parser.errors.length > 0) {
|
|
47
|
-
console.error(parser.errors);
|
|
48
|
-
throw Error('THREE.VRMLLoader: Parsing errors detected.');
|
|
49
|
-
} // actions
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const ast = visitor.visit(cstOutput);
|
|
53
|
-
return ast;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function createTokens() {
|
|
57
|
-
// from http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics
|
|
58
|
-
const RouteIdentifier = createToken({
|
|
59
|
-
name: 'RouteIdentifier',
|
|
60
|
-
pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/
|
|
61
|
-
});
|
|
62
|
-
const Identifier = createToken({
|
|
63
|
-
name: 'Identifier',
|
|
64
|
-
pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/,
|
|
65
|
-
longer_alt: RouteIdentifier
|
|
66
|
-
}); // from http://gun.teipir.gr/VRML-amgem/spec/part1/nodesRef.html
|
|
67
|
-
|
|
68
|
-
const nodeTypes = ['Anchor', 'Billboard', 'Collision', 'Group', 'Transform', // grouping nodes
|
|
69
|
-
'Inline', 'LOD', 'Switch', // special groups
|
|
70
|
-
'AudioClip', 'DirectionalLight', 'PointLight', 'Script', 'Shape', 'Sound', 'SpotLight', 'WorldInfo', // common nodes
|
|
71
|
-
'CylinderSensor', 'PlaneSensor', 'ProximitySensor', 'SphereSensor', 'TimeSensor', 'TouchSensor', 'VisibilitySensor', // sensors
|
|
72
|
-
'Box', 'Cone', 'Cylinder', 'ElevationGrid', 'Extrusion', 'IndexedFaceSet', 'IndexedLineSet', 'PointSet', 'Sphere', // geometries
|
|
73
|
-
'Color', 'Coordinate', 'Normal', 'TextureCoordinate', // geometric properties
|
|
74
|
-
'Appearance', 'FontStyle', 'ImageTexture', 'Material', 'MovieTexture', 'PixelTexture', 'TextureTransform', // appearance
|
|
75
|
-
'ColorInterpolator', 'CoordinateInterpolator', 'NormalInterpolator', 'OrientationInterpolator', 'PositionInterpolator', 'ScalarInterpolator', // interpolators
|
|
76
|
-
'Background', 'Fog', 'NavigationInfo', 'Viewpoint', // bindable nodes
|
|
77
|
-
'Text' // Text must be placed at the end of the regex so there are no matches for TextureTransform and TextureCoordinate
|
|
78
|
-
]; //
|
|
79
|
-
|
|
80
|
-
const Version = createToken({
|
|
81
|
-
name: 'Version',
|
|
82
|
-
pattern: /#VRML.*/,
|
|
83
|
-
longer_alt: Identifier
|
|
84
|
-
});
|
|
85
|
-
const NodeName = createToken({
|
|
86
|
-
name: 'NodeName',
|
|
87
|
-
pattern: new RegExp(nodeTypes.join('|')),
|
|
88
|
-
longer_alt: Identifier
|
|
89
|
-
});
|
|
90
|
-
const DEF = createToken({
|
|
91
|
-
name: 'DEF',
|
|
92
|
-
pattern: /DEF/,
|
|
93
|
-
longer_alt: Identifier
|
|
94
|
-
});
|
|
95
|
-
const USE = createToken({
|
|
96
|
-
name: 'USE',
|
|
97
|
-
pattern: /USE/,
|
|
98
|
-
longer_alt: Identifier
|
|
99
|
-
});
|
|
100
|
-
const ROUTE = createToken({
|
|
101
|
-
name: 'ROUTE',
|
|
102
|
-
pattern: /ROUTE/,
|
|
103
|
-
longer_alt: Identifier
|
|
104
|
-
});
|
|
105
|
-
const TO = createToken({
|
|
106
|
-
name: 'TO',
|
|
107
|
-
pattern: /TO/,
|
|
108
|
-
longer_alt: Identifier
|
|
109
|
-
}); //
|
|
110
|
-
|
|
111
|
-
const StringLiteral = createToken({
|
|
112
|
-
name: 'StringLiteral',
|
|
113
|
-
pattern: /"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/
|
|
114
|
-
});
|
|
115
|
-
const HexLiteral = createToken({
|
|
116
|
-
name: 'HexLiteral',
|
|
117
|
-
pattern: /0[xX][0-9a-fA-F]+/
|
|
118
|
-
});
|
|
119
|
-
const NumberLiteral = createToken({
|
|
120
|
-
name: 'NumberLiteral',
|
|
121
|
-
pattern: /[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/
|
|
122
|
-
});
|
|
123
|
-
const TrueLiteral = createToken({
|
|
124
|
-
name: 'TrueLiteral',
|
|
125
|
-
pattern: /TRUE/
|
|
126
|
-
});
|
|
127
|
-
const FalseLiteral = createToken({
|
|
128
|
-
name: 'FalseLiteral',
|
|
129
|
-
pattern: /FALSE/
|
|
130
|
-
});
|
|
131
|
-
const NullLiteral = createToken({
|
|
132
|
-
name: 'NullLiteral',
|
|
133
|
-
pattern: /NULL/
|
|
134
|
-
});
|
|
135
|
-
const LSquare = createToken({
|
|
136
|
-
name: 'LSquare',
|
|
137
|
-
pattern: /\[/
|
|
138
|
-
});
|
|
139
|
-
const RSquare = createToken({
|
|
140
|
-
name: 'RSquare',
|
|
141
|
-
pattern: /]/
|
|
142
|
-
});
|
|
143
|
-
const LCurly = createToken({
|
|
144
|
-
name: 'LCurly',
|
|
145
|
-
pattern: /{/
|
|
146
|
-
});
|
|
147
|
-
const RCurly = createToken({
|
|
148
|
-
name: 'RCurly',
|
|
149
|
-
pattern: /}/
|
|
150
|
-
});
|
|
151
|
-
const Comment = createToken({
|
|
152
|
-
name: 'Comment',
|
|
153
|
-
pattern: /#.*/,
|
|
154
|
-
group: Lexer.SKIPPED // eslint-disable-line no-undef
|
|
155
|
-
|
|
156
|
-
}); // commas, blanks, tabs, newlines and carriage returns are whitespace characters wherever they appear outside of string fields
|
|
157
|
-
|
|
158
|
-
const WhiteSpace = createToken({
|
|
159
|
-
name: 'WhiteSpace',
|
|
160
|
-
pattern: /[ ,\s]/,
|
|
161
|
-
group: Lexer.SKIPPED // eslint-disable-line no-undef
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
const tokens = [WhiteSpace, // keywords appear before the Identifier
|
|
165
|
-
NodeName, DEF, USE, ROUTE, TO, TrueLiteral, FalseLiteral, NullLiteral, // the Identifier must appear after the keywords because all keywords are valid identifiers
|
|
166
|
-
Version, Identifier, RouteIdentifier, StringLiteral, HexLiteral, NumberLiteral, LSquare, RSquare, LCurly, RCurly, Comment];
|
|
167
|
-
const tokenVocabulary = {};
|
|
168
|
-
|
|
169
|
-
for (let i = 0, l = tokens.length; i < l; i++) {
|
|
170
|
-
const token = tokens[i];
|
|
171
|
-
tokenVocabulary[token.name] = token;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return {
|
|
175
|
-
tokens: tokens,
|
|
176
|
-
tokenVocabulary: tokenVocabulary
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function createVisitor(BaseVRMLVisitor) {
|
|
181
|
-
// the visitor is created dynmaically based on the given base class
|
|
182
|
-
function VRMLToASTVisitor() {
|
|
183
|
-
BaseVRMLVisitor.call(this);
|
|
184
|
-
this.validateVisitor();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
VRMLToASTVisitor.prototype = Object.assign(Object.create(BaseVRMLVisitor.prototype), {
|
|
188
|
-
constructor: VRMLToASTVisitor,
|
|
189
|
-
vrml: function (ctx) {
|
|
190
|
-
const data = {
|
|
191
|
-
version: this.visit(ctx.version),
|
|
192
|
-
nodes: [],
|
|
193
|
-
routes: []
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
for (let i = 0, l = ctx.node.length; i < l; i++) {
|
|
197
|
-
const node = ctx.node[i];
|
|
198
|
-
data.nodes.push(this.visit(node));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (ctx.route) {
|
|
202
|
-
for (let i = 0, l = ctx.route.length; i < l; i++) {
|
|
203
|
-
const route = ctx.route[i];
|
|
204
|
-
data.routes.push(this.visit(route));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return data;
|
|
209
|
-
},
|
|
210
|
-
version: function (ctx) {
|
|
211
|
-
return ctx.Version[0].image;
|
|
212
|
-
},
|
|
213
|
-
node: function (ctx) {
|
|
214
|
-
const data = {
|
|
215
|
-
name: ctx.NodeName[0].image,
|
|
216
|
-
fields: []
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
if (ctx.field) {
|
|
220
|
-
for (let i = 0, l = ctx.field.length; i < l; i++) {
|
|
221
|
-
const field = ctx.field[i];
|
|
222
|
-
data.fields.push(this.visit(field));
|
|
223
|
-
}
|
|
224
|
-
} // DEF
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (ctx.def) {
|
|
228
|
-
data.DEF = this.visit(ctx.def[0]);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return data;
|
|
232
|
-
},
|
|
233
|
-
field: function (ctx) {
|
|
234
|
-
const data = {
|
|
235
|
-
name: ctx.Identifier[0].image,
|
|
236
|
-
type: null,
|
|
237
|
-
values: null
|
|
238
|
-
};
|
|
239
|
-
let result; // SFValue
|
|
240
|
-
|
|
241
|
-
if (ctx.singleFieldValue) {
|
|
242
|
-
result = this.visit(ctx.singleFieldValue[0]);
|
|
243
|
-
} // MFValue
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (ctx.multiFieldValue) {
|
|
247
|
-
result = this.visit(ctx.multiFieldValue[0]);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
data.type = result.type;
|
|
251
|
-
data.values = result.values;
|
|
252
|
-
return data;
|
|
253
|
-
},
|
|
254
|
-
def: function (ctx) {
|
|
255
|
-
return (ctx.Identifier || ctx.NodeName)[0].image;
|
|
256
|
-
},
|
|
257
|
-
use: function (ctx) {
|
|
258
|
-
return {
|
|
259
|
-
USE: (ctx.Identifier || ctx.NodeName)[0].image
|
|
260
|
-
};
|
|
261
|
-
},
|
|
262
|
-
singleFieldValue: function (ctx) {
|
|
263
|
-
return processField(this, ctx);
|
|
264
|
-
},
|
|
265
|
-
multiFieldValue: function (ctx) {
|
|
266
|
-
return processField(this, ctx);
|
|
267
|
-
},
|
|
268
|
-
route: function (ctx) {
|
|
269
|
-
const data = {
|
|
270
|
-
FROM: ctx.RouteIdentifier[0].image,
|
|
271
|
-
TO: ctx.RouteIdentifier[1].image
|
|
272
|
-
};
|
|
273
|
-
return data;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
function processField(scope, ctx) {
|
|
278
|
-
const field = {
|
|
279
|
-
type: null,
|
|
280
|
-
values: []
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
if (ctx.node) {
|
|
284
|
-
field.type = 'node';
|
|
285
|
-
|
|
286
|
-
for (let i = 0, l = ctx.node.length; i < l; i++) {
|
|
287
|
-
const node = ctx.node[i];
|
|
288
|
-
field.values.push(scope.visit(node));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (ctx.use) {
|
|
293
|
-
field.type = 'use';
|
|
294
|
-
|
|
295
|
-
for (let i = 0, l = ctx.use.length; i < l; i++) {
|
|
296
|
-
const use = ctx.use[i];
|
|
297
|
-
field.values.push(scope.visit(use));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (ctx.StringLiteral) {
|
|
302
|
-
field.type = 'string';
|
|
303
|
-
|
|
304
|
-
for (let i = 0, l = ctx.StringLiteral.length; i < l; i++) {
|
|
305
|
-
const stringLiteral = ctx.StringLiteral[i];
|
|
306
|
-
field.values.push(stringLiteral.image.replace(/'|"/g, ''));
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if (ctx.NumberLiteral) {
|
|
311
|
-
field.type = 'number';
|
|
312
|
-
|
|
313
|
-
for (let i = 0, l = ctx.NumberLiteral.length; i < l; i++) {
|
|
314
|
-
const numberLiteral = ctx.NumberLiteral[i];
|
|
315
|
-
field.values.push(parseFloat(numberLiteral.image));
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (ctx.HexLiteral) {
|
|
320
|
-
field.type = 'hex';
|
|
321
|
-
|
|
322
|
-
for (let i = 0, l = ctx.HexLiteral.length; i < l; i++) {
|
|
323
|
-
const hexLiteral = ctx.HexLiteral[i];
|
|
324
|
-
field.values.push(hexLiteral.image);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (ctx.TrueLiteral) {
|
|
329
|
-
field.type = 'boolean';
|
|
330
|
-
|
|
331
|
-
for (let i = 0, l = ctx.TrueLiteral.length; i < l; i++) {
|
|
332
|
-
const trueLiteral = ctx.TrueLiteral[i];
|
|
333
|
-
if (trueLiteral.image === 'TRUE') field.values.push(true);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (ctx.FalseLiteral) {
|
|
338
|
-
field.type = 'boolean';
|
|
339
|
-
|
|
340
|
-
for (let i = 0, l = ctx.FalseLiteral.length; i < l; i++) {
|
|
341
|
-
const falseLiteral = ctx.FalseLiteral[i];
|
|
342
|
-
if (falseLiteral.image === 'FALSE') field.values.push(false);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (ctx.NullLiteral) {
|
|
347
|
-
field.type = 'null';
|
|
348
|
-
ctx.NullLiteral.forEach(function () {
|
|
349
|
-
field.values.push(null);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return field;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
return new VRMLToASTVisitor();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function parseTree(tree) {
|
|
360
|
-
// console.log( JSON.stringify( tree, null, 2 ) );
|
|
361
|
-
const nodes = tree.nodes;
|
|
362
|
-
const scene = new Scene(); // first iteration: build nodemap based on DEF statements
|
|
363
|
-
|
|
364
|
-
for (let i = 0, l = nodes.length; i < l; i++) {
|
|
365
|
-
const node = nodes[i];
|
|
366
|
-
buildNodeMap(node);
|
|
367
|
-
} // second iteration: build nodes
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
for (let i = 0, l = nodes.length; i < l; i++) {
|
|
371
|
-
const node = nodes[i];
|
|
372
|
-
const object = getNode(node);
|
|
373
|
-
if (object instanceof Object3D) scene.add(object);
|
|
374
|
-
if (node.name === 'WorldInfo') scene.userData.worldInfo = object;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
return scene;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
function buildNodeMap(node) {
|
|
381
|
-
if (node.DEF) {
|
|
382
|
-
nodeMap[node.DEF] = node;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const fields = node.fields;
|
|
386
|
-
|
|
387
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
388
|
-
const field = fields[i];
|
|
389
|
-
|
|
390
|
-
if (field.type === 'node') {
|
|
391
|
-
const fieldValues = field.values;
|
|
392
|
-
|
|
393
|
-
for (let j = 0, jl = fieldValues.length; j < jl; j++) {
|
|
394
|
-
buildNodeMap(fieldValues[j]);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
function getNode(node) {
|
|
401
|
-
// handle case where a node refers to a different one
|
|
402
|
-
if (node.USE) {
|
|
403
|
-
return resolveUSE(node.USE);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (node.build !== undefined) return node.build;
|
|
407
|
-
node.build = buildNode(node);
|
|
408
|
-
return node.build;
|
|
409
|
-
} // node builder
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
function buildNode(node) {
|
|
413
|
-
const nodeName = node.name;
|
|
414
|
-
let build;
|
|
415
|
-
|
|
416
|
-
switch (nodeName) {
|
|
417
|
-
case 'Group':
|
|
418
|
-
case 'Transform':
|
|
419
|
-
case 'Collision':
|
|
420
|
-
build = buildGroupingNode(node);
|
|
421
|
-
break;
|
|
422
|
-
|
|
423
|
-
case 'Background':
|
|
424
|
-
build = buildBackgroundNode(node);
|
|
425
|
-
break;
|
|
426
|
-
|
|
427
|
-
case 'Shape':
|
|
428
|
-
build = buildShapeNode(node);
|
|
429
|
-
break;
|
|
430
|
-
|
|
431
|
-
case 'Appearance':
|
|
432
|
-
build = buildAppearanceNode(node);
|
|
433
|
-
break;
|
|
434
|
-
|
|
435
|
-
case 'Material':
|
|
436
|
-
build = buildMaterialNode(node);
|
|
437
|
-
break;
|
|
438
|
-
|
|
439
|
-
case 'ImageTexture':
|
|
440
|
-
build = buildImageTextureNode(node);
|
|
441
|
-
break;
|
|
442
|
-
|
|
443
|
-
case 'PixelTexture':
|
|
444
|
-
build = buildPixelTextureNode(node);
|
|
445
|
-
break;
|
|
446
|
-
|
|
447
|
-
case 'TextureTransform':
|
|
448
|
-
build = buildTextureTransformNode(node);
|
|
449
|
-
break;
|
|
450
|
-
|
|
451
|
-
case 'IndexedFaceSet':
|
|
452
|
-
build = buildIndexedFaceSetNode(node);
|
|
453
|
-
break;
|
|
454
|
-
|
|
455
|
-
case 'IndexedLineSet':
|
|
456
|
-
build = buildIndexedLineSetNode(node);
|
|
457
|
-
break;
|
|
458
|
-
|
|
459
|
-
case 'PointSet':
|
|
460
|
-
build = buildPointSetNode(node);
|
|
461
|
-
break;
|
|
462
|
-
|
|
463
|
-
case 'Box':
|
|
464
|
-
build = buildBoxNode(node);
|
|
465
|
-
break;
|
|
466
|
-
|
|
467
|
-
case 'Cone':
|
|
468
|
-
build = buildConeNode(node);
|
|
469
|
-
break;
|
|
470
|
-
|
|
471
|
-
case 'Cylinder':
|
|
472
|
-
build = buildCylinderNode(node);
|
|
473
|
-
break;
|
|
474
|
-
|
|
475
|
-
case 'Sphere':
|
|
476
|
-
build = buildSphereNode(node);
|
|
477
|
-
break;
|
|
478
|
-
|
|
479
|
-
case 'ElevationGrid':
|
|
480
|
-
build = buildElevationGridNode(node);
|
|
481
|
-
break;
|
|
482
|
-
|
|
483
|
-
case 'Extrusion':
|
|
484
|
-
build = buildExtrusionNode(node);
|
|
485
|
-
break;
|
|
486
|
-
|
|
487
|
-
case 'Color':
|
|
488
|
-
case 'Coordinate':
|
|
489
|
-
case 'Normal':
|
|
490
|
-
case 'TextureCoordinate':
|
|
491
|
-
build = buildGeometricNode(node);
|
|
492
|
-
break;
|
|
493
|
-
|
|
494
|
-
case 'WorldInfo':
|
|
495
|
-
build = buildWorldInfoNode(node);
|
|
496
|
-
break;
|
|
497
|
-
|
|
498
|
-
case 'Anchor':
|
|
499
|
-
case 'Billboard':
|
|
500
|
-
case 'Inline':
|
|
501
|
-
case 'LOD':
|
|
502
|
-
case 'Switch':
|
|
503
|
-
case 'AudioClip':
|
|
504
|
-
case 'DirectionalLight':
|
|
505
|
-
case 'PointLight':
|
|
506
|
-
case 'Script':
|
|
507
|
-
case 'Sound':
|
|
508
|
-
case 'SpotLight':
|
|
509
|
-
case 'CylinderSensor':
|
|
510
|
-
case 'PlaneSensor':
|
|
511
|
-
case 'ProximitySensor':
|
|
512
|
-
case 'SphereSensor':
|
|
513
|
-
case 'TimeSensor':
|
|
514
|
-
case 'TouchSensor':
|
|
515
|
-
case 'VisibilitySensor':
|
|
516
|
-
case 'Text':
|
|
517
|
-
case 'FontStyle':
|
|
518
|
-
case 'MovieTexture':
|
|
519
|
-
case 'ColorInterpolator':
|
|
520
|
-
case 'CoordinateInterpolator':
|
|
521
|
-
case 'NormalInterpolator':
|
|
522
|
-
case 'OrientationInterpolator':
|
|
523
|
-
case 'PositionInterpolator':
|
|
524
|
-
case 'ScalarInterpolator':
|
|
525
|
-
case 'Fog':
|
|
526
|
-
case 'NavigationInfo':
|
|
527
|
-
case 'Viewpoint':
|
|
528
|
-
// node not supported yet
|
|
529
|
-
break;
|
|
530
|
-
|
|
531
|
-
default:
|
|
532
|
-
console.warn('THREE.VRMLLoader: Unknown node:', nodeName);
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
if (build !== undefined && node.DEF !== undefined && build.hasOwnProperty('name') === true) {
|
|
537
|
-
build.name = node.DEF;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
return build;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function buildGroupingNode(node) {
|
|
544
|
-
const object = new Group(); //
|
|
545
|
-
|
|
546
|
-
const fields = node.fields;
|
|
547
|
-
|
|
548
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
549
|
-
const field = fields[i];
|
|
550
|
-
const fieldName = field.name;
|
|
551
|
-
const fieldValues = field.values;
|
|
552
|
-
|
|
553
|
-
switch (fieldName) {
|
|
554
|
-
case 'bboxCenter':
|
|
555
|
-
// field not supported
|
|
556
|
-
break;
|
|
557
|
-
|
|
558
|
-
case 'bboxSize':
|
|
559
|
-
// field not supported
|
|
560
|
-
break;
|
|
561
|
-
|
|
562
|
-
case 'center':
|
|
563
|
-
// field not supported
|
|
564
|
-
break;
|
|
565
|
-
|
|
566
|
-
case 'children':
|
|
567
|
-
parseFieldChildren(fieldValues, object);
|
|
568
|
-
break;
|
|
569
|
-
|
|
570
|
-
case 'collide':
|
|
571
|
-
// field not supported
|
|
572
|
-
break;
|
|
573
|
-
|
|
574
|
-
case 'rotation':
|
|
575
|
-
const axis = new Vector3(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
576
|
-
const angle = fieldValues[3];
|
|
577
|
-
object.quaternion.setFromAxisAngle(axis, angle);
|
|
578
|
-
break;
|
|
579
|
-
|
|
580
|
-
case 'scale':
|
|
581
|
-
object.scale.set(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
582
|
-
break;
|
|
583
|
-
|
|
584
|
-
case 'scaleOrientation':
|
|
585
|
-
// field not supported
|
|
586
|
-
break;
|
|
587
|
-
|
|
588
|
-
case 'translation':
|
|
589
|
-
object.position.set(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
590
|
-
break;
|
|
591
|
-
|
|
592
|
-
case 'proxy':
|
|
593
|
-
// field not supported
|
|
594
|
-
break;
|
|
595
|
-
|
|
596
|
-
default:
|
|
597
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
598
|
-
break;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
return object;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
function buildBackgroundNode(node) {
|
|
606
|
-
const group = new Group();
|
|
607
|
-
let groundAngle, groundColor;
|
|
608
|
-
let skyAngle, skyColor;
|
|
609
|
-
const fields = node.fields;
|
|
610
|
-
|
|
611
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
612
|
-
const field = fields[i];
|
|
613
|
-
const fieldName = field.name;
|
|
614
|
-
const fieldValues = field.values;
|
|
615
|
-
|
|
616
|
-
switch (fieldName) {
|
|
617
|
-
case 'groundAngle':
|
|
618
|
-
groundAngle = fieldValues;
|
|
619
|
-
break;
|
|
620
|
-
|
|
621
|
-
case 'groundColor':
|
|
622
|
-
groundColor = fieldValues;
|
|
623
|
-
break;
|
|
624
|
-
|
|
625
|
-
case 'backUrl':
|
|
626
|
-
// field not supported
|
|
627
|
-
break;
|
|
628
|
-
|
|
629
|
-
case 'bottomUrl':
|
|
630
|
-
// field not supported
|
|
631
|
-
break;
|
|
632
|
-
|
|
633
|
-
case 'frontUrl':
|
|
634
|
-
// field not supported
|
|
635
|
-
break;
|
|
636
|
-
|
|
637
|
-
case 'leftUrl':
|
|
638
|
-
// field not supported
|
|
639
|
-
break;
|
|
640
|
-
|
|
641
|
-
case 'rightUrl':
|
|
642
|
-
// field not supported
|
|
643
|
-
break;
|
|
644
|
-
|
|
645
|
-
case 'topUrl':
|
|
646
|
-
// field not supported
|
|
647
|
-
break;
|
|
648
|
-
|
|
649
|
-
case 'skyAngle':
|
|
650
|
-
skyAngle = fieldValues;
|
|
651
|
-
break;
|
|
652
|
-
|
|
653
|
-
case 'skyColor':
|
|
654
|
-
skyColor = fieldValues;
|
|
655
|
-
break;
|
|
656
|
-
|
|
657
|
-
default:
|
|
658
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
const radius = 10000; // sky
|
|
664
|
-
|
|
665
|
-
if (skyColor) {
|
|
666
|
-
const skyGeometry = new SphereGeometry(radius, 32, 16);
|
|
667
|
-
const skyMaterial = new MeshBasicMaterial({
|
|
668
|
-
fog: false,
|
|
669
|
-
side: BackSide,
|
|
670
|
-
depthWrite: false,
|
|
671
|
-
depthTest: false
|
|
672
|
-
});
|
|
673
|
-
|
|
674
|
-
if (skyColor.length > 3) {
|
|
675
|
-
paintFaces(skyGeometry, radius, skyAngle, toColorArray(skyColor), true);
|
|
676
|
-
skyMaterial.vertexColors = true;
|
|
677
|
-
} else {
|
|
678
|
-
skyMaterial.color.setRGB(skyColor[0], skyColor[1], skyColor[2]);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
const sky = new Mesh(skyGeometry, skyMaterial);
|
|
682
|
-
group.add(sky);
|
|
683
|
-
} // ground
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
if (groundColor) {
|
|
687
|
-
if (groundColor.length > 0) {
|
|
688
|
-
const groundGeometry = new SphereGeometry(radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI);
|
|
689
|
-
const groundMaterial = new MeshBasicMaterial({
|
|
690
|
-
fog: false,
|
|
691
|
-
side: BackSide,
|
|
692
|
-
vertexColors: true,
|
|
693
|
-
depthWrite: false,
|
|
694
|
-
depthTest: false
|
|
695
|
-
});
|
|
696
|
-
paintFaces(groundGeometry, radius, groundAngle, toColorArray(groundColor), false);
|
|
697
|
-
const ground = new Mesh(groundGeometry, groundMaterial);
|
|
698
|
-
group.add(ground);
|
|
699
|
-
}
|
|
700
|
-
} // render background group first
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
group.renderOrder = -Infinity;
|
|
704
|
-
return group;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function buildShapeNode(node) {
|
|
708
|
-
const fields = node.fields; // if the appearance field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
709
|
-
|
|
710
|
-
let material = new MeshBasicMaterial({
|
|
711
|
-
color: 0x000000
|
|
712
|
-
});
|
|
713
|
-
let geometry;
|
|
714
|
-
|
|
715
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
716
|
-
const field = fields[i];
|
|
717
|
-
const fieldName = field.name;
|
|
718
|
-
const fieldValues = field.values;
|
|
719
|
-
|
|
720
|
-
switch (fieldName) {
|
|
721
|
-
case 'appearance':
|
|
722
|
-
if (fieldValues[0] !== null) {
|
|
723
|
-
material = getNode(fieldValues[0]);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
break;
|
|
727
|
-
|
|
728
|
-
case 'geometry':
|
|
729
|
-
if (fieldValues[0] !== null) {
|
|
730
|
-
geometry = getNode(fieldValues[0]);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
break;
|
|
734
|
-
|
|
735
|
-
default:
|
|
736
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
} // build 3D object
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
let object;
|
|
743
|
-
|
|
744
|
-
if (geometry && geometry.attributes.position) {
|
|
745
|
-
const type = geometry._type;
|
|
746
|
-
|
|
747
|
-
if (type === 'points') {
|
|
748
|
-
// points
|
|
749
|
-
const pointsMaterial = new PointsMaterial({
|
|
750
|
-
color: 0xffffff
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
if (geometry.attributes.color !== undefined) {
|
|
754
|
-
pointsMaterial.vertexColors = true;
|
|
755
|
-
} else {
|
|
756
|
-
// if the color field is NULL and there is a material defined for the appearance affecting this PointSet, then use the emissiveColor of the material to draw the points
|
|
757
|
-
if (material.isMeshPhongMaterial) {
|
|
758
|
-
pointsMaterial.color.copy(material.emissive);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
object = new Points(geometry, pointsMaterial);
|
|
763
|
-
} else if (type === 'line') {
|
|
764
|
-
// lines
|
|
765
|
-
const lineMaterial = new LineBasicMaterial({
|
|
766
|
-
color: 0xffffff
|
|
767
|
-
});
|
|
768
|
-
|
|
769
|
-
if (geometry.attributes.color !== undefined) {
|
|
770
|
-
lineMaterial.vertexColors = true;
|
|
771
|
-
} else {
|
|
772
|
-
// if the color field is NULL and there is a material defined for the appearance affecting this IndexedLineSet, then use the emissiveColor of the material to draw the lines
|
|
773
|
-
if (material.isMeshPhongMaterial) {
|
|
774
|
-
lineMaterial.color.copy(material.emissive);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
object = new LineSegments(geometry, lineMaterial);
|
|
779
|
-
} else {
|
|
780
|
-
// consider meshes
|
|
781
|
-
// check "solid" hint (it's placed in the geometry but affects the material)
|
|
782
|
-
if (geometry._solid !== undefined) {
|
|
783
|
-
material.side = geometry._solid ? FrontSide : DoubleSide;
|
|
784
|
-
} // check for vertex colors
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
if (geometry.attributes.color !== undefined) {
|
|
788
|
-
material.vertexColors = true;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
object = new Mesh(geometry, material);
|
|
792
|
-
}
|
|
793
|
-
} else {
|
|
794
|
-
object = new Object3D(); // if the geometry field is NULL or no vertices are defined the object is not drawn
|
|
795
|
-
|
|
796
|
-
object.visible = false;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
return object;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
function buildAppearanceNode(node) {
|
|
803
|
-
let material = new MeshPhongMaterial();
|
|
804
|
-
let transformData;
|
|
805
|
-
const fields = node.fields;
|
|
806
|
-
|
|
807
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
808
|
-
const field = fields[i];
|
|
809
|
-
const fieldName = field.name;
|
|
810
|
-
const fieldValues = field.values;
|
|
811
|
-
|
|
812
|
-
switch (fieldName) {
|
|
813
|
-
case 'material':
|
|
814
|
-
if (fieldValues[0] !== null) {
|
|
815
|
-
const materialData = getNode(fieldValues[0]);
|
|
816
|
-
if (materialData.diffuseColor) material.color.copy(materialData.diffuseColor);
|
|
817
|
-
if (materialData.emissiveColor) material.emissive.copy(materialData.emissiveColor);
|
|
818
|
-
if (materialData.shininess) material.shininess = materialData.shininess;
|
|
819
|
-
if (materialData.specularColor) material.specular.copy(materialData.specularColor);
|
|
820
|
-
if (materialData.transparency) material.opacity = 1 - materialData.transparency;
|
|
821
|
-
if (materialData.transparency > 0) material.transparent = true;
|
|
822
|
-
} else {
|
|
823
|
-
// if the material field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
824
|
-
material = new MeshBasicMaterial({
|
|
825
|
-
color: 0x000000
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
break;
|
|
830
|
-
|
|
831
|
-
case 'texture':
|
|
832
|
-
const textureNode = fieldValues[0];
|
|
833
|
-
|
|
834
|
-
if (textureNode !== null) {
|
|
835
|
-
if (textureNode.name === 'ImageTexture' || textureNode.name === 'PixelTexture') {
|
|
836
|
-
material.map = getNode(textureNode);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
break;
|
|
841
|
-
|
|
842
|
-
case 'textureTransform':
|
|
843
|
-
if (fieldValues[0] !== null) {
|
|
844
|
-
transformData = getNode(fieldValues[0]);
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
break;
|
|
848
|
-
|
|
849
|
-
default:
|
|
850
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
851
|
-
break;
|
|
852
|
-
}
|
|
853
|
-
} // only apply texture transform data if a texture was defined
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (material.map) {
|
|
857
|
-
// respect VRML lighting model
|
|
858
|
-
if (material.map.__type) {
|
|
859
|
-
switch (material.map.__type) {
|
|
860
|
-
case TEXTURE_TYPE.INTENSITY_ALPHA:
|
|
861
|
-
material.opacity = 1; // ignore transparency
|
|
862
|
-
|
|
863
|
-
break;
|
|
864
|
-
|
|
865
|
-
case TEXTURE_TYPE.RGB:
|
|
866
|
-
material.color.set(0xffffff); // ignore material color
|
|
867
|
-
|
|
868
|
-
break;
|
|
869
|
-
|
|
870
|
-
case TEXTURE_TYPE.RGBA:
|
|
871
|
-
material.color.set(0xffffff); // ignore material color
|
|
872
|
-
|
|
873
|
-
material.opacity = 1; // ignore transparency
|
|
874
|
-
|
|
875
|
-
break;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
delete material.map.__type;
|
|
879
|
-
} // apply texture transform
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
if (transformData) {
|
|
883
|
-
material.map.center.copy(transformData.center);
|
|
884
|
-
material.map.rotation = transformData.rotation;
|
|
885
|
-
material.map.repeat.copy(transformData.scale);
|
|
886
|
-
material.map.offset.copy(transformData.translation);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
return material;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
function buildMaterialNode(node) {
|
|
894
|
-
const materialData = {};
|
|
895
|
-
const fields = node.fields;
|
|
896
|
-
|
|
897
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
898
|
-
const field = fields[i];
|
|
899
|
-
const fieldName = field.name;
|
|
900
|
-
const fieldValues = field.values;
|
|
901
|
-
|
|
902
|
-
switch (fieldName) {
|
|
903
|
-
case 'ambientIntensity':
|
|
904
|
-
// field not supported
|
|
905
|
-
break;
|
|
906
|
-
|
|
907
|
-
case 'diffuseColor':
|
|
908
|
-
materialData.diffuseColor = new Color(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
909
|
-
break;
|
|
910
|
-
|
|
911
|
-
case 'emissiveColor':
|
|
912
|
-
materialData.emissiveColor = new Color(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
913
|
-
break;
|
|
914
|
-
|
|
915
|
-
case 'shininess':
|
|
916
|
-
materialData.shininess = fieldValues[0];
|
|
917
|
-
break;
|
|
918
|
-
|
|
919
|
-
case 'specularColor':
|
|
920
|
-
materialData.emissiveColor = new Color(fieldValues[0], fieldValues[1], fieldValues[2]);
|
|
921
|
-
break;
|
|
922
|
-
|
|
923
|
-
case 'transparency':
|
|
924
|
-
materialData.transparency = fieldValues[0];
|
|
925
|
-
break;
|
|
926
|
-
|
|
927
|
-
default:
|
|
928
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
return materialData;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
function parseHexColor(hex, textureType, color) {
|
|
937
|
-
let value;
|
|
938
|
-
|
|
939
|
-
switch (textureType) {
|
|
940
|
-
case TEXTURE_TYPE.INTENSITY:
|
|
941
|
-
// Intensity texture: A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image
|
|
942
|
-
value = parseInt(hex);
|
|
943
|
-
color.r = value;
|
|
944
|
-
color.g = value;
|
|
945
|
-
color.b = value;
|
|
946
|
-
color.a = 1;
|
|
947
|
-
break;
|
|
948
|
-
|
|
949
|
-
case TEXTURE_TYPE.INTENSITY_ALPHA:
|
|
950
|
-
// Intensity+Alpha texture: A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte.
|
|
951
|
-
value = parseInt('0x' + hex.substring(2, 4));
|
|
952
|
-
color.r = value;
|
|
953
|
-
color.g = value;
|
|
954
|
-
color.b = value;
|
|
955
|
-
color.a = parseInt('0x' + hex.substring(4, 6));
|
|
956
|
-
break;
|
|
957
|
-
|
|
958
|
-
case TEXTURE_TYPE.RGB:
|
|
959
|
-
// RGB texture: Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components
|
|
960
|
-
color.r = parseInt('0x' + hex.substring(2, 4));
|
|
961
|
-
color.g = parseInt('0x' + hex.substring(4, 6));
|
|
962
|
-
color.b = parseInt('0x' + hex.substring(6, 8));
|
|
963
|
-
color.a = 1;
|
|
964
|
-
break;
|
|
965
|
-
|
|
966
|
-
case TEXTURE_TYPE.RGBA:
|
|
967
|
-
// RGBA texture: Four-component images specify the alpha opacity byte after red/green/blue
|
|
968
|
-
color.r = parseInt('0x' + hex.substring(2, 4));
|
|
969
|
-
color.g = parseInt('0x' + hex.substring(4, 6));
|
|
970
|
-
color.b = parseInt('0x' + hex.substring(6, 8));
|
|
971
|
-
color.a = parseInt('0x' + hex.substring(8, 10));
|
|
972
|
-
break;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
function getTextureType(num_components) {
|
|
977
|
-
let type;
|
|
978
|
-
|
|
979
|
-
switch (num_components) {
|
|
980
|
-
case 1:
|
|
981
|
-
type = TEXTURE_TYPE.INTENSITY;
|
|
982
|
-
break;
|
|
983
|
-
|
|
984
|
-
case 2:
|
|
985
|
-
type = TEXTURE_TYPE.INTENSITY_ALPHA;
|
|
986
|
-
break;
|
|
987
|
-
|
|
988
|
-
case 3:
|
|
989
|
-
type = TEXTURE_TYPE.RGB;
|
|
990
|
-
break;
|
|
991
|
-
|
|
992
|
-
case 4:
|
|
993
|
-
type = TEXTURE_TYPE.RGBA;
|
|
994
|
-
break;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
return type;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
function buildPixelTextureNode(node) {
|
|
1001
|
-
let texture;
|
|
1002
|
-
let wrapS = RepeatWrapping;
|
|
1003
|
-
let wrapT = RepeatWrapping;
|
|
1004
|
-
const fields = node.fields;
|
|
1005
|
-
|
|
1006
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1007
|
-
const field = fields[i];
|
|
1008
|
-
const fieldName = field.name;
|
|
1009
|
-
const fieldValues = field.values;
|
|
1010
|
-
|
|
1011
|
-
switch (fieldName) {
|
|
1012
|
-
case 'image':
|
|
1013
|
-
const width = fieldValues[0];
|
|
1014
|
-
const height = fieldValues[1];
|
|
1015
|
-
const num_components = fieldValues[2];
|
|
1016
|
-
const textureType = getTextureType(num_components);
|
|
1017
|
-
const data = new Uint8Array(4 * width * height);
|
|
1018
|
-
const color = {
|
|
1019
|
-
r: 0,
|
|
1020
|
-
g: 0,
|
|
1021
|
-
b: 0,
|
|
1022
|
-
a: 0
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
for (let j = 3, k = 0, jl = fieldValues.length; j < jl; j++, k++) {
|
|
1026
|
-
parseHexColor(fieldValues[j], textureType, color);
|
|
1027
|
-
const stride = k * 4;
|
|
1028
|
-
data[stride + 0] = color.r;
|
|
1029
|
-
data[stride + 1] = color.g;
|
|
1030
|
-
data[stride + 2] = color.b;
|
|
1031
|
-
data[stride + 3] = color.a;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
texture = new DataTexture(data, width, height);
|
|
1035
|
-
texture.needsUpdate = true;
|
|
1036
|
-
texture.__type = textureType; // needed for material modifications
|
|
1037
|
-
|
|
1038
|
-
break;
|
|
1039
|
-
|
|
1040
|
-
case 'repeatS':
|
|
1041
|
-
if (fieldValues[0] === false) wrapS = ClampToEdgeWrapping;
|
|
1042
|
-
break;
|
|
1043
|
-
|
|
1044
|
-
case 'repeatT':
|
|
1045
|
-
if (fieldValues[0] === false) wrapT = ClampToEdgeWrapping;
|
|
1046
|
-
break;
|
|
1047
|
-
|
|
1048
|
-
default:
|
|
1049
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1050
|
-
break;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
if (texture) {
|
|
1055
|
-
texture.wrapS = wrapS;
|
|
1056
|
-
texture.wrapT = wrapT;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
return texture;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
function buildImageTextureNode(node) {
|
|
1063
|
-
let texture;
|
|
1064
|
-
let wrapS = RepeatWrapping;
|
|
1065
|
-
let wrapT = RepeatWrapping;
|
|
1066
|
-
const fields = node.fields;
|
|
1067
|
-
|
|
1068
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1069
|
-
const field = fields[i];
|
|
1070
|
-
const fieldName = field.name;
|
|
1071
|
-
const fieldValues = field.values;
|
|
1072
|
-
|
|
1073
|
-
switch (fieldName) {
|
|
1074
|
-
case 'url':
|
|
1075
|
-
const url = fieldValues[0];
|
|
1076
|
-
if (url) texture = textureLoader.load(url);
|
|
1077
|
-
break;
|
|
1078
|
-
|
|
1079
|
-
case 'repeatS':
|
|
1080
|
-
if (fieldValues[0] === false) wrapS = ClampToEdgeWrapping;
|
|
1081
|
-
break;
|
|
1082
|
-
|
|
1083
|
-
case 'repeatT':
|
|
1084
|
-
if (fieldValues[0] === false) wrapT = ClampToEdgeWrapping;
|
|
1085
|
-
break;
|
|
1086
|
-
|
|
1087
|
-
default:
|
|
1088
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
if (texture) {
|
|
1094
|
-
texture.wrapS = wrapS;
|
|
1095
|
-
texture.wrapT = wrapT;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
return texture;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function buildTextureTransformNode(node) {
|
|
1102
|
-
const transformData = {
|
|
1103
|
-
center: new Vector2(),
|
|
1104
|
-
rotation: new Vector2(),
|
|
1105
|
-
scale: new Vector2(),
|
|
1106
|
-
translation: new Vector2()
|
|
1107
|
-
};
|
|
1108
|
-
const fields = node.fields;
|
|
1109
|
-
|
|
1110
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1111
|
-
const field = fields[i];
|
|
1112
|
-
const fieldName = field.name;
|
|
1113
|
-
const fieldValues = field.values;
|
|
1114
|
-
|
|
1115
|
-
switch (fieldName) {
|
|
1116
|
-
case 'center':
|
|
1117
|
-
transformData.center.set(fieldValues[0], fieldValues[1]);
|
|
1118
|
-
break;
|
|
1119
|
-
|
|
1120
|
-
case 'rotation':
|
|
1121
|
-
transformData.rotation = fieldValues[0];
|
|
1122
|
-
break;
|
|
1123
|
-
|
|
1124
|
-
case 'scale':
|
|
1125
|
-
transformData.scale.set(fieldValues[0], fieldValues[1]);
|
|
1126
|
-
break;
|
|
1127
|
-
|
|
1128
|
-
case 'translation':
|
|
1129
|
-
transformData.translation.set(fieldValues[0], fieldValues[1]);
|
|
1130
|
-
break;
|
|
1131
|
-
|
|
1132
|
-
default:
|
|
1133
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1134
|
-
break;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
return transformData;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
function buildGeometricNode(node) {
|
|
1142
|
-
return node.fields[0].values;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
function buildWorldInfoNode(node) {
|
|
1146
|
-
const worldInfo = {};
|
|
1147
|
-
const fields = node.fields;
|
|
1148
|
-
|
|
1149
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1150
|
-
const field = fields[i];
|
|
1151
|
-
const fieldName = field.name;
|
|
1152
|
-
const fieldValues = field.values;
|
|
1153
|
-
|
|
1154
|
-
switch (fieldName) {
|
|
1155
|
-
case 'title':
|
|
1156
|
-
worldInfo.title = fieldValues[0];
|
|
1157
|
-
break;
|
|
1158
|
-
|
|
1159
|
-
case 'info':
|
|
1160
|
-
worldInfo.info = fieldValues;
|
|
1161
|
-
break;
|
|
1162
|
-
|
|
1163
|
-
default:
|
|
1164
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1165
|
-
break;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
return worldInfo;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
function buildIndexedFaceSetNode(node) {
|
|
1173
|
-
let color, coord, normal, texCoord;
|
|
1174
|
-
let ccw = true,
|
|
1175
|
-
solid = true,
|
|
1176
|
-
creaseAngle = 0;
|
|
1177
|
-
let colorIndex, coordIndex, normalIndex, texCoordIndex;
|
|
1178
|
-
let colorPerVertex = true,
|
|
1179
|
-
normalPerVertex = true;
|
|
1180
|
-
const fields = node.fields;
|
|
1181
|
-
|
|
1182
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1183
|
-
const field = fields[i];
|
|
1184
|
-
const fieldName = field.name;
|
|
1185
|
-
const fieldValues = field.values;
|
|
1186
|
-
|
|
1187
|
-
switch (fieldName) {
|
|
1188
|
-
case 'color':
|
|
1189
|
-
const colorNode = fieldValues[0];
|
|
1190
|
-
|
|
1191
|
-
if (colorNode !== null) {
|
|
1192
|
-
color = getNode(colorNode);
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
break;
|
|
1196
|
-
|
|
1197
|
-
case 'coord':
|
|
1198
|
-
const coordNode = fieldValues[0];
|
|
1199
|
-
|
|
1200
|
-
if (coordNode !== null) {
|
|
1201
|
-
coord = getNode(coordNode);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
break;
|
|
1205
|
-
|
|
1206
|
-
case 'normal':
|
|
1207
|
-
const normalNode = fieldValues[0];
|
|
1208
|
-
|
|
1209
|
-
if (normalNode !== null) {
|
|
1210
|
-
normal = getNode(normalNode);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
break;
|
|
1214
|
-
|
|
1215
|
-
case 'texCoord':
|
|
1216
|
-
const texCoordNode = fieldValues[0];
|
|
1217
|
-
|
|
1218
|
-
if (texCoordNode !== null) {
|
|
1219
|
-
texCoord = getNode(texCoordNode);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
break;
|
|
1223
|
-
|
|
1224
|
-
case 'ccw':
|
|
1225
|
-
ccw = fieldValues[0];
|
|
1226
|
-
break;
|
|
1227
|
-
|
|
1228
|
-
case 'colorIndex':
|
|
1229
|
-
colorIndex = fieldValues;
|
|
1230
|
-
break;
|
|
1231
|
-
|
|
1232
|
-
case 'colorPerVertex':
|
|
1233
|
-
colorPerVertex = fieldValues[0];
|
|
1234
|
-
break;
|
|
1235
|
-
|
|
1236
|
-
case 'convex':
|
|
1237
|
-
// field not supported
|
|
1238
|
-
break;
|
|
1239
|
-
|
|
1240
|
-
case 'coordIndex':
|
|
1241
|
-
coordIndex = fieldValues;
|
|
1242
|
-
break;
|
|
1243
|
-
|
|
1244
|
-
case 'creaseAngle':
|
|
1245
|
-
creaseAngle = fieldValues[0];
|
|
1246
|
-
break;
|
|
1247
|
-
|
|
1248
|
-
case 'normalIndex':
|
|
1249
|
-
normalIndex = fieldValues;
|
|
1250
|
-
break;
|
|
1251
|
-
|
|
1252
|
-
case 'normalPerVertex':
|
|
1253
|
-
normalPerVertex = fieldValues[0];
|
|
1254
|
-
break;
|
|
1255
|
-
|
|
1256
|
-
case 'solid':
|
|
1257
|
-
solid = fieldValues[0];
|
|
1258
|
-
break;
|
|
1259
|
-
|
|
1260
|
-
case 'texCoordIndex':
|
|
1261
|
-
texCoordIndex = fieldValues;
|
|
1262
|
-
break;
|
|
1263
|
-
|
|
1264
|
-
default:
|
|
1265
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
if (coordIndex === undefined) {
|
|
1271
|
-
console.warn('THREE.VRMLLoader: Missing coordIndex.');
|
|
1272
|
-
return new BufferGeometry(); // handle VRML files with incomplete geometry definition
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
const triangulatedCoordIndex = triangulateFaceIndex(coordIndex, ccw);
|
|
1276
|
-
let colorAttribute;
|
|
1277
|
-
let normalAttribute;
|
|
1278
|
-
let uvAttribute;
|
|
1279
|
-
|
|
1280
|
-
if (color) {
|
|
1281
|
-
if (colorPerVertex === true) {
|
|
1282
|
-
if (colorIndex && colorIndex.length > 0) {
|
|
1283
|
-
// if the colorIndex field is not empty, then it is used to choose colors for each vertex of the IndexedFaceSet.
|
|
1284
|
-
const triangulatedColorIndex = triangulateFaceIndex(colorIndex, ccw);
|
|
1285
|
-
colorAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedColorIndex, color, 3);
|
|
1286
|
-
} else {
|
|
1287
|
-
// if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
|
|
1288
|
-
colorAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new Float32BufferAttribute(color, 3));
|
|
1289
|
-
}
|
|
1290
|
-
} else {
|
|
1291
|
-
if (colorIndex && colorIndex.length > 0) {
|
|
1292
|
-
// if the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet
|
|
1293
|
-
const flattenFaceColors = flattenData(color, colorIndex);
|
|
1294
|
-
const triangulatedFaceColors = triangulateFaceData(flattenFaceColors, coordIndex);
|
|
1295
|
-
colorAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceColors);
|
|
1296
|
-
} else {
|
|
1297
|
-
// if the colorIndex field is empty, then the color are applied to each face of the IndexedFaceSet in order
|
|
1298
|
-
const triangulatedFaceColors = triangulateFaceData(color, coordIndex);
|
|
1299
|
-
colorAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceColors);
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
if (normal) {
|
|
1305
|
-
if (normalPerVertex === true) {
|
|
1306
|
-
// consider vertex normals
|
|
1307
|
-
if (normalIndex && normalIndex.length > 0) {
|
|
1308
|
-
// if the normalIndex field is not empty, then it is used to choose normals for each vertex of the IndexedFaceSet.
|
|
1309
|
-
const triangulatedNormalIndex = triangulateFaceIndex(normalIndex, ccw);
|
|
1310
|
-
normalAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedNormalIndex, normal, 3);
|
|
1311
|
-
} else {
|
|
1312
|
-
// if the normalIndex field is empty, then the coordIndex field is used to choose normals from the Normal node
|
|
1313
|
-
normalAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new Float32BufferAttribute(normal, 3));
|
|
1314
|
-
}
|
|
1315
|
-
} else {
|
|
1316
|
-
// consider face normals
|
|
1317
|
-
if (normalIndex && normalIndex.length > 0) {
|
|
1318
|
-
// if the normalIndex field is not empty, then they are used to choose one normal for each face of the IndexedFaceSet
|
|
1319
|
-
const flattenFaceNormals = flattenData(normal, normalIndex);
|
|
1320
|
-
const triangulatedFaceNormals = triangulateFaceData(flattenFaceNormals, coordIndex);
|
|
1321
|
-
normalAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceNormals);
|
|
1322
|
-
} else {
|
|
1323
|
-
// if the normalIndex field is empty, then the normals are applied to each face of the IndexedFaceSet in order
|
|
1324
|
-
const triangulatedFaceNormals = triangulateFaceData(normal, coordIndex);
|
|
1325
|
-
normalAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceNormals);
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
} else {
|
|
1329
|
-
// if the normal field is NULL, then the loader should automatically generate normals, using creaseAngle to determine if and how normals are smoothed across shared vertices
|
|
1330
|
-
normalAttribute = computeNormalAttribute(triangulatedCoordIndex, coord, creaseAngle);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
if (texCoord) {
|
|
1334
|
-
// texture coordinates are always defined on vertex level
|
|
1335
|
-
if (texCoordIndex && texCoordIndex.length > 0) {
|
|
1336
|
-
// if the texCoordIndex field is not empty, then it is used to choose texture coordinates for each vertex of the IndexedFaceSet.
|
|
1337
|
-
const triangulatedTexCoordIndex = triangulateFaceIndex(texCoordIndex, ccw);
|
|
1338
|
-
uvAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedTexCoordIndex, texCoord, 2);
|
|
1339
|
-
} else {
|
|
1340
|
-
// if the texCoordIndex field is empty, then the coordIndex array is used to choose texture coordinates from the TextureCoordinate node
|
|
1341
|
-
uvAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new Float32BufferAttribute(texCoord, 2));
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
const geometry = new BufferGeometry();
|
|
1346
|
-
const positionAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new Float32BufferAttribute(coord, 3));
|
|
1347
|
-
geometry.setAttribute('position', positionAttribute);
|
|
1348
|
-
geometry.setAttribute('normal', normalAttribute); // optional attributes
|
|
1349
|
-
|
|
1350
|
-
if (colorAttribute) geometry.setAttribute('color', colorAttribute);
|
|
1351
|
-
if (uvAttribute) geometry.setAttribute('uv', uvAttribute); // "solid" influences the material so let's store it for later use
|
|
1352
|
-
|
|
1353
|
-
geometry._solid = solid;
|
|
1354
|
-
geometry._type = 'mesh';
|
|
1355
|
-
return geometry;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
function buildIndexedLineSetNode(node) {
|
|
1359
|
-
let color, coord;
|
|
1360
|
-
let colorIndex, coordIndex;
|
|
1361
|
-
let colorPerVertex = true;
|
|
1362
|
-
const fields = node.fields;
|
|
1363
|
-
|
|
1364
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1365
|
-
const field = fields[i];
|
|
1366
|
-
const fieldName = field.name;
|
|
1367
|
-
const fieldValues = field.values;
|
|
1368
|
-
|
|
1369
|
-
switch (fieldName) {
|
|
1370
|
-
case 'color':
|
|
1371
|
-
const colorNode = fieldValues[0];
|
|
1372
|
-
|
|
1373
|
-
if (colorNode !== null) {
|
|
1374
|
-
color = getNode(colorNode);
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
break;
|
|
1378
|
-
|
|
1379
|
-
case 'coord':
|
|
1380
|
-
const coordNode = fieldValues[0];
|
|
1381
|
-
|
|
1382
|
-
if (coordNode !== null) {
|
|
1383
|
-
coord = getNode(coordNode);
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
break;
|
|
1387
|
-
|
|
1388
|
-
case 'colorIndex':
|
|
1389
|
-
colorIndex = fieldValues;
|
|
1390
|
-
break;
|
|
1391
|
-
|
|
1392
|
-
case 'colorPerVertex':
|
|
1393
|
-
colorPerVertex = fieldValues[0];
|
|
1394
|
-
break;
|
|
1395
|
-
|
|
1396
|
-
case 'coordIndex':
|
|
1397
|
-
coordIndex = fieldValues;
|
|
1398
|
-
break;
|
|
1399
|
-
|
|
1400
|
-
default:
|
|
1401
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1402
|
-
break;
|
|
1403
|
-
}
|
|
1404
|
-
} // build lines
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
let colorAttribute;
|
|
1408
|
-
const expandedLineIndex = expandLineIndex(coordIndex); // create an index for three.js's linesegment primitive
|
|
1409
|
-
|
|
1410
|
-
if (color) {
|
|
1411
|
-
if (colorPerVertex === true) {
|
|
1412
|
-
if (colorIndex.length > 0) {
|
|
1413
|
-
// if the colorIndex field is not empty, then one color is used for each polyline of the IndexedLineSet.
|
|
1414
|
-
const expandedColorIndex = expandLineIndex(colorIndex); // compute colors for each line segment (rendering primitve)
|
|
1415
|
-
|
|
1416
|
-
colorAttribute = computeAttributeFromIndexedData(expandedLineIndex, expandedColorIndex, color, 3); // compute data on vertex level
|
|
1417
|
-
} else {
|
|
1418
|
-
// if the colorIndex field is empty, then the colors are applied to each polyline of the IndexedLineSet in order.
|
|
1419
|
-
colorAttribute = toNonIndexedAttribute(expandedLineIndex, new Float32BufferAttribute(color, 3));
|
|
1420
|
-
}
|
|
1421
|
-
} else {
|
|
1422
|
-
if (colorIndex.length > 0) {
|
|
1423
|
-
// if the colorIndex field is not empty, then colors are applied to each vertex of the IndexedLineSet
|
|
1424
|
-
const flattenLineColors = flattenData(color, colorIndex); // compute colors for each VRML primitve
|
|
1425
|
-
|
|
1426
|
-
const expandedLineColors = expandLineData(flattenLineColors, coordIndex); // compute colors for each line segment (rendering primitve)
|
|
1427
|
-
|
|
1428
|
-
colorAttribute = computeAttributeFromLineData(expandedLineIndex, expandedLineColors); // compute data on vertex level
|
|
1429
|
-
} else {
|
|
1430
|
-
// if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
|
|
1431
|
-
const expandedLineColors = expandLineData(color, coordIndex); // compute colors for each line segment (rendering primitve)
|
|
1432
|
-
|
|
1433
|
-
colorAttribute = computeAttributeFromLineData(expandedLineIndex, expandedLineColors); // compute data on vertex level
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
} //
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
const geometry = new BufferGeometry();
|
|
1440
|
-
const positionAttribute = toNonIndexedAttribute(expandedLineIndex, new Float32BufferAttribute(coord, 3));
|
|
1441
|
-
geometry.setAttribute('position', positionAttribute);
|
|
1442
|
-
if (colorAttribute) geometry.setAttribute('color', colorAttribute);
|
|
1443
|
-
geometry._type = 'line';
|
|
1444
|
-
return geometry;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
function buildPointSetNode(node) {
|
|
1448
|
-
let color, coord;
|
|
1449
|
-
const fields = node.fields;
|
|
1450
|
-
|
|
1451
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1452
|
-
const field = fields[i];
|
|
1453
|
-
const fieldName = field.name;
|
|
1454
|
-
const fieldValues = field.values;
|
|
1455
|
-
|
|
1456
|
-
switch (fieldName) {
|
|
1457
|
-
case 'color':
|
|
1458
|
-
const colorNode = fieldValues[0];
|
|
1459
|
-
|
|
1460
|
-
if (colorNode !== null) {
|
|
1461
|
-
color = getNode(colorNode);
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
break;
|
|
1465
|
-
|
|
1466
|
-
case 'coord':
|
|
1467
|
-
const coordNode = fieldValues[0];
|
|
1468
|
-
|
|
1469
|
-
if (coordNode !== null) {
|
|
1470
|
-
coord = getNode(coordNode);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
break;
|
|
1474
|
-
|
|
1475
|
-
default:
|
|
1476
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1477
|
-
break;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
const geometry = new BufferGeometry();
|
|
1482
|
-
geometry.setAttribute('position', new Float32BufferAttribute(coord, 3));
|
|
1483
|
-
if (color) geometry.setAttribute('color', new Float32BufferAttribute(color, 3));
|
|
1484
|
-
geometry._type = 'points';
|
|
1485
|
-
return geometry;
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
function buildBoxNode(node) {
|
|
1489
|
-
const size = new Vector3(2, 2, 2);
|
|
1490
|
-
const fields = node.fields;
|
|
1491
|
-
|
|
1492
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1493
|
-
const field = fields[i];
|
|
1494
|
-
const fieldName = field.name;
|
|
1495
|
-
const fieldValues = field.values;
|
|
1496
|
-
|
|
1497
|
-
switch (fieldName) {
|
|
1498
|
-
case 'size':
|
|
1499
|
-
size.x = fieldValues[0];
|
|
1500
|
-
size.y = fieldValues[1];
|
|
1501
|
-
size.z = fieldValues[2];
|
|
1502
|
-
break;
|
|
1503
|
-
|
|
1504
|
-
default:
|
|
1505
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1506
|
-
break;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
const geometry = new BoxGeometry(size.x, size.y, size.z);
|
|
1511
|
-
return geometry;
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
function buildConeNode(node) {
|
|
1515
|
-
let radius = 1,
|
|
1516
|
-
height = 2,
|
|
1517
|
-
openEnded = false;
|
|
1518
|
-
const fields = node.fields;
|
|
1519
|
-
|
|
1520
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1521
|
-
const field = fields[i];
|
|
1522
|
-
const fieldName = field.name;
|
|
1523
|
-
const fieldValues = field.values;
|
|
1524
|
-
|
|
1525
|
-
switch (fieldName) {
|
|
1526
|
-
case 'bottom':
|
|
1527
|
-
openEnded = !fieldValues[0];
|
|
1528
|
-
break;
|
|
1529
|
-
|
|
1530
|
-
case 'bottomRadius':
|
|
1531
|
-
radius = fieldValues[0];
|
|
1532
|
-
break;
|
|
1533
|
-
|
|
1534
|
-
case 'height':
|
|
1535
|
-
height = fieldValues[0];
|
|
1536
|
-
break;
|
|
1537
|
-
|
|
1538
|
-
case 'side':
|
|
1539
|
-
// field not supported
|
|
1540
|
-
break;
|
|
1541
|
-
|
|
1542
|
-
default:
|
|
1543
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1544
|
-
break;
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
const geometry = new ConeGeometry(radius, height, 16, 1, openEnded);
|
|
1549
|
-
return geometry;
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
function buildCylinderNode(node) {
|
|
1553
|
-
let radius = 1,
|
|
1554
|
-
height = 2;
|
|
1555
|
-
const fields = node.fields;
|
|
1556
|
-
|
|
1557
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1558
|
-
const field = fields[i];
|
|
1559
|
-
const fieldName = field.name;
|
|
1560
|
-
const fieldValues = field.values;
|
|
1561
|
-
|
|
1562
|
-
switch (fieldName) {
|
|
1563
|
-
case 'bottom':
|
|
1564
|
-
// field not supported
|
|
1565
|
-
break;
|
|
1566
|
-
|
|
1567
|
-
case 'radius':
|
|
1568
|
-
radius = fieldValues[0];
|
|
1569
|
-
break;
|
|
1570
|
-
|
|
1571
|
-
case 'height':
|
|
1572
|
-
height = fieldValues[0];
|
|
1573
|
-
break;
|
|
1574
|
-
|
|
1575
|
-
case 'side':
|
|
1576
|
-
// field not supported
|
|
1577
|
-
break;
|
|
1578
|
-
|
|
1579
|
-
case 'top':
|
|
1580
|
-
// field not supported
|
|
1581
|
-
break;
|
|
1582
|
-
|
|
1583
|
-
default:
|
|
1584
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1585
|
-
break;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
const geometry = new CylinderGeometry(radius, radius, height, 16, 1);
|
|
1590
|
-
return geometry;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
function buildSphereNode(node) {
|
|
1594
|
-
let radius = 1;
|
|
1595
|
-
const fields = node.fields;
|
|
1596
|
-
|
|
1597
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1598
|
-
const field = fields[i];
|
|
1599
|
-
const fieldName = field.name;
|
|
1600
|
-
const fieldValues = field.values;
|
|
1601
|
-
|
|
1602
|
-
switch (fieldName) {
|
|
1603
|
-
case 'radius':
|
|
1604
|
-
radius = fieldValues[0];
|
|
1605
|
-
break;
|
|
1606
|
-
|
|
1607
|
-
default:
|
|
1608
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1609
|
-
break;
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
const geometry = new SphereGeometry(radius, 16, 16);
|
|
1614
|
-
return geometry;
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
function buildElevationGridNode(node) {
|
|
1618
|
-
let color;
|
|
1619
|
-
let normal;
|
|
1620
|
-
let texCoord;
|
|
1621
|
-
let height;
|
|
1622
|
-
let colorPerVertex = true;
|
|
1623
|
-
let normalPerVertex = true;
|
|
1624
|
-
let solid = true;
|
|
1625
|
-
let ccw = true;
|
|
1626
|
-
let creaseAngle = 0;
|
|
1627
|
-
let xDimension = 2;
|
|
1628
|
-
let zDimension = 2;
|
|
1629
|
-
let xSpacing = 1;
|
|
1630
|
-
let zSpacing = 1;
|
|
1631
|
-
const fields = node.fields;
|
|
1632
|
-
|
|
1633
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1634
|
-
const field = fields[i];
|
|
1635
|
-
const fieldName = field.name;
|
|
1636
|
-
const fieldValues = field.values;
|
|
1637
|
-
|
|
1638
|
-
switch (fieldName) {
|
|
1639
|
-
case 'color':
|
|
1640
|
-
const colorNode = fieldValues[0];
|
|
1641
|
-
|
|
1642
|
-
if (colorNode !== null) {
|
|
1643
|
-
color = getNode(colorNode);
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
break;
|
|
1647
|
-
|
|
1648
|
-
case 'normal':
|
|
1649
|
-
const normalNode = fieldValues[0];
|
|
1650
|
-
|
|
1651
|
-
if (normalNode !== null) {
|
|
1652
|
-
normal = getNode(normalNode);
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
break;
|
|
1656
|
-
|
|
1657
|
-
case 'texCoord':
|
|
1658
|
-
const texCoordNode = fieldValues[0];
|
|
1659
|
-
|
|
1660
|
-
if (texCoordNode !== null) {
|
|
1661
|
-
texCoord = getNode(texCoordNode);
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
break;
|
|
1665
|
-
|
|
1666
|
-
case 'height':
|
|
1667
|
-
height = fieldValues;
|
|
1668
|
-
break;
|
|
1669
|
-
|
|
1670
|
-
case 'ccw':
|
|
1671
|
-
ccw = fieldValues[0];
|
|
1672
|
-
break;
|
|
1673
|
-
|
|
1674
|
-
case 'colorPerVertex':
|
|
1675
|
-
colorPerVertex = fieldValues[0];
|
|
1676
|
-
break;
|
|
1677
|
-
|
|
1678
|
-
case 'creaseAngle':
|
|
1679
|
-
creaseAngle = fieldValues[0];
|
|
1680
|
-
break;
|
|
1681
|
-
|
|
1682
|
-
case 'normalPerVertex':
|
|
1683
|
-
normalPerVertex = fieldValues[0];
|
|
1684
|
-
break;
|
|
1685
|
-
|
|
1686
|
-
case 'solid':
|
|
1687
|
-
solid = fieldValues[0];
|
|
1688
|
-
break;
|
|
1689
|
-
|
|
1690
|
-
case 'xDimension':
|
|
1691
|
-
xDimension = fieldValues[0];
|
|
1692
|
-
break;
|
|
1693
|
-
|
|
1694
|
-
case 'xSpacing':
|
|
1695
|
-
xSpacing = fieldValues[0];
|
|
1696
|
-
break;
|
|
1697
|
-
|
|
1698
|
-
case 'zDimension':
|
|
1699
|
-
zDimension = fieldValues[0];
|
|
1700
|
-
break;
|
|
1701
|
-
|
|
1702
|
-
case 'zSpacing':
|
|
1703
|
-
zSpacing = fieldValues[0];
|
|
1704
|
-
break;
|
|
1705
|
-
|
|
1706
|
-
default:
|
|
1707
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1708
|
-
break;
|
|
1709
|
-
}
|
|
1710
|
-
} // vertex data
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
const vertices = [];
|
|
1714
|
-
const normals = [];
|
|
1715
|
-
const colors = [];
|
|
1716
|
-
const uvs = [];
|
|
1717
|
-
|
|
1718
|
-
for (let i = 0; i < zDimension; i++) {
|
|
1719
|
-
for (let j = 0; j < xDimension; j++) {
|
|
1720
|
-
// compute a row major index
|
|
1721
|
-
const index = i * xDimension + j; // vertices
|
|
1722
|
-
|
|
1723
|
-
const x = xSpacing * i;
|
|
1724
|
-
const y = height[index];
|
|
1725
|
-
const z = zSpacing * j;
|
|
1726
|
-
vertices.push(x, y, z); // colors
|
|
1727
|
-
|
|
1728
|
-
if (color && colorPerVertex === true) {
|
|
1729
|
-
const r = color[index * 3 + 0];
|
|
1730
|
-
const g = color[index * 3 + 1];
|
|
1731
|
-
const b = color[index * 3 + 2];
|
|
1732
|
-
colors.push(r, g, b);
|
|
1733
|
-
} // normals
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
if (normal && normalPerVertex === true) {
|
|
1737
|
-
const xn = normal[index * 3 + 0];
|
|
1738
|
-
const yn = normal[index * 3 + 1];
|
|
1739
|
-
const zn = normal[index * 3 + 2];
|
|
1740
|
-
normals.push(xn, yn, zn);
|
|
1741
|
-
} // uvs
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
if (texCoord) {
|
|
1745
|
-
const s = texCoord[index * 2 + 0];
|
|
1746
|
-
const t = texCoord[index * 2 + 1];
|
|
1747
|
-
uvs.push(s, t);
|
|
1748
|
-
} else {
|
|
1749
|
-
uvs.push(i / (xDimension - 1), j / (zDimension - 1));
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
} // indices
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
const indices = [];
|
|
1756
|
-
|
|
1757
|
-
for (let i = 0; i < xDimension - 1; i++) {
|
|
1758
|
-
for (let j = 0; j < zDimension - 1; j++) {
|
|
1759
|
-
// from https://tecfa.unige.ch/guides/vrml/vrml97/spec/part1/nodesRef.html#ElevationGrid
|
|
1760
|
-
const a = i + j * xDimension;
|
|
1761
|
-
const b = i + (j + 1) * xDimension;
|
|
1762
|
-
const c = i + 1 + (j + 1) * xDimension;
|
|
1763
|
-
const d = i + 1 + j * xDimension; // faces
|
|
1764
|
-
|
|
1765
|
-
if (ccw === true) {
|
|
1766
|
-
indices.push(a, c, b);
|
|
1767
|
-
indices.push(c, a, d);
|
|
1768
|
-
} else {
|
|
1769
|
-
indices.push(a, b, c);
|
|
1770
|
-
indices.push(c, d, a);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
} //
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
const positionAttribute = toNonIndexedAttribute(indices, new Float32BufferAttribute(vertices, 3));
|
|
1777
|
-
const uvAttribute = toNonIndexedAttribute(indices, new Float32BufferAttribute(uvs, 2));
|
|
1778
|
-
let colorAttribute;
|
|
1779
|
-
let normalAttribute; // color attribute
|
|
1780
|
-
|
|
1781
|
-
if (color) {
|
|
1782
|
-
if (colorPerVertex === false) {
|
|
1783
|
-
for (let i = 0; i < xDimension - 1; i++) {
|
|
1784
|
-
for (let j = 0; j < zDimension - 1; j++) {
|
|
1785
|
-
const index = i + j * (xDimension - 1);
|
|
1786
|
-
const r = color[index * 3 + 0];
|
|
1787
|
-
const g = color[index * 3 + 1];
|
|
1788
|
-
const b = color[index * 3 + 2]; // one color per quad
|
|
1789
|
-
|
|
1790
|
-
colors.push(r, g, b);
|
|
1791
|
-
colors.push(r, g, b);
|
|
1792
|
-
colors.push(r, g, b);
|
|
1793
|
-
colors.push(r, g, b);
|
|
1794
|
-
colors.push(r, g, b);
|
|
1795
|
-
colors.push(r, g, b);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
colorAttribute = new Float32BufferAttribute(colors, 3);
|
|
1800
|
-
} else {
|
|
1801
|
-
colorAttribute = toNonIndexedAttribute(indices, new Float32BufferAttribute(colors, 3));
|
|
1802
|
-
}
|
|
1803
|
-
} // normal attribute
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
if (normal) {
|
|
1807
|
-
if (normalPerVertex === false) {
|
|
1808
|
-
for (let i = 0; i < xDimension - 1; i++) {
|
|
1809
|
-
for (let j = 0; j < zDimension - 1; j++) {
|
|
1810
|
-
const index = i + j * (xDimension - 1);
|
|
1811
|
-
const xn = normal[index * 3 + 0];
|
|
1812
|
-
const yn = normal[index * 3 + 1];
|
|
1813
|
-
const zn = normal[index * 3 + 2]; // one normal per quad
|
|
1814
|
-
|
|
1815
|
-
normals.push(xn, yn, zn);
|
|
1816
|
-
normals.push(xn, yn, zn);
|
|
1817
|
-
normals.push(xn, yn, zn);
|
|
1818
|
-
normals.push(xn, yn, zn);
|
|
1819
|
-
normals.push(xn, yn, zn);
|
|
1820
|
-
normals.push(xn, yn, zn);
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
normalAttribute = new Float32BufferAttribute(normals, 3);
|
|
1825
|
-
} else {
|
|
1826
|
-
normalAttribute = toNonIndexedAttribute(indices, new Float32BufferAttribute(normals, 3));
|
|
1827
|
-
}
|
|
1828
|
-
} else {
|
|
1829
|
-
normalAttribute = computeNormalAttribute(indices, vertices, creaseAngle);
|
|
1830
|
-
} // build geometry
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
const geometry = new BufferGeometry();
|
|
1834
|
-
geometry.setAttribute('position', positionAttribute);
|
|
1835
|
-
geometry.setAttribute('normal', normalAttribute);
|
|
1836
|
-
geometry.setAttribute('uv', uvAttribute);
|
|
1837
|
-
if (colorAttribute) geometry.setAttribute('color', colorAttribute); // "solid" influences the material so let's store it for later use
|
|
1838
|
-
|
|
1839
|
-
geometry._solid = solid;
|
|
1840
|
-
geometry._type = 'mesh';
|
|
1841
|
-
return geometry;
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
function buildExtrusionNode(node) {
|
|
1845
|
-
let crossSection = [1, 1, 1, -1, -1, -1, -1, 1, 1, 1];
|
|
1846
|
-
let spine = [0, 0, 0, 0, 1, 0];
|
|
1847
|
-
let scale;
|
|
1848
|
-
let orientation;
|
|
1849
|
-
let beginCap = true;
|
|
1850
|
-
let ccw = true;
|
|
1851
|
-
let creaseAngle = 0;
|
|
1852
|
-
let endCap = true;
|
|
1853
|
-
let solid = true;
|
|
1854
|
-
const fields = node.fields;
|
|
1855
|
-
|
|
1856
|
-
for (let i = 0, l = fields.length; i < l; i++) {
|
|
1857
|
-
const field = fields[i];
|
|
1858
|
-
const fieldName = field.name;
|
|
1859
|
-
const fieldValues = field.values;
|
|
1860
|
-
|
|
1861
|
-
switch (fieldName) {
|
|
1862
|
-
case 'beginCap':
|
|
1863
|
-
beginCap = fieldValues[0];
|
|
1864
|
-
break;
|
|
1865
|
-
|
|
1866
|
-
case 'ccw':
|
|
1867
|
-
ccw = fieldValues[0];
|
|
1868
|
-
break;
|
|
1869
|
-
|
|
1870
|
-
case 'convex':
|
|
1871
|
-
// field not supported
|
|
1872
|
-
break;
|
|
1873
|
-
|
|
1874
|
-
case 'creaseAngle':
|
|
1875
|
-
creaseAngle = fieldValues[0];
|
|
1876
|
-
break;
|
|
1877
|
-
|
|
1878
|
-
case 'crossSection':
|
|
1879
|
-
crossSection = fieldValues;
|
|
1880
|
-
break;
|
|
1881
|
-
|
|
1882
|
-
case 'endCap':
|
|
1883
|
-
endCap = fieldValues[0];
|
|
1884
|
-
break;
|
|
1885
|
-
|
|
1886
|
-
case 'orientation':
|
|
1887
|
-
orientation = fieldValues;
|
|
1888
|
-
break;
|
|
1889
|
-
|
|
1890
|
-
case 'scale':
|
|
1891
|
-
scale = fieldValues;
|
|
1892
|
-
break;
|
|
1893
|
-
|
|
1894
|
-
case 'solid':
|
|
1895
|
-
solid = fieldValues[0];
|
|
1896
|
-
break;
|
|
1897
|
-
|
|
1898
|
-
case 'spine':
|
|
1899
|
-
spine = fieldValues; // only extrusion along the Y-axis are supported so far
|
|
1900
|
-
|
|
1901
|
-
break;
|
|
1902
|
-
|
|
1903
|
-
default:
|
|
1904
|
-
console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
|
|
1905
|
-
break;
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
const crossSectionClosed = crossSection[0] === crossSection[crossSection.length - 2] && crossSection[1] === crossSection[crossSection.length - 1]; // vertices
|
|
1910
|
-
|
|
1911
|
-
const vertices = [];
|
|
1912
|
-
const spineVector = new Vector3();
|
|
1913
|
-
const scaling = new Vector3();
|
|
1914
|
-
const axis = new Vector3();
|
|
1915
|
-
const vertex = new Vector3();
|
|
1916
|
-
const quaternion = new Quaternion();
|
|
1917
|
-
|
|
1918
|
-
for (let i = 0, j = 0, o = 0, il = spine.length; i < il; i += 3, j += 2, o += 4) {
|
|
1919
|
-
spineVector.fromArray(spine, i);
|
|
1920
|
-
scaling.x = scale ? scale[j + 0] : 1;
|
|
1921
|
-
scaling.y = 1;
|
|
1922
|
-
scaling.z = scale ? scale[j + 1] : 1;
|
|
1923
|
-
axis.x = orientation ? orientation[o + 0] : 0;
|
|
1924
|
-
axis.y = orientation ? orientation[o + 1] : 0;
|
|
1925
|
-
axis.z = orientation ? orientation[o + 2] : 1;
|
|
1926
|
-
const angle = orientation ? orientation[o + 3] : 0;
|
|
1927
|
-
|
|
1928
|
-
for (let k = 0, kl = crossSection.length; k < kl; k += 2) {
|
|
1929
|
-
vertex.x = crossSection[k + 0];
|
|
1930
|
-
vertex.y = 0;
|
|
1931
|
-
vertex.z = crossSection[k + 1]; // scale
|
|
1932
|
-
|
|
1933
|
-
vertex.multiply(scaling); // rotate
|
|
1934
|
-
|
|
1935
|
-
quaternion.setFromAxisAngle(axis, angle);
|
|
1936
|
-
vertex.applyQuaternion(quaternion); // translate
|
|
1937
|
-
|
|
1938
|
-
vertex.add(spineVector);
|
|
1939
|
-
vertices.push(vertex.x, vertex.y, vertex.z);
|
|
1940
|
-
}
|
|
1941
|
-
} // indices
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
const indices = [];
|
|
1945
|
-
const spineCount = spine.length / 3;
|
|
1946
|
-
const crossSectionCount = crossSection.length / 2;
|
|
1947
|
-
|
|
1948
|
-
for (let i = 0; i < spineCount - 1; i++) {
|
|
1949
|
-
for (let j = 0; j < crossSectionCount - 1; j++) {
|
|
1950
|
-
const a = j + i * crossSectionCount;
|
|
1951
|
-
let b = j + 1 + i * crossSectionCount;
|
|
1952
|
-
const c = j + (i + 1) * crossSectionCount;
|
|
1953
|
-
let d = j + 1 + (i + 1) * crossSectionCount;
|
|
1954
|
-
|
|
1955
|
-
if (j === crossSectionCount - 2 && crossSectionClosed === true) {
|
|
1956
|
-
b = i * crossSectionCount;
|
|
1957
|
-
d = (i + 1) * crossSectionCount;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
if (ccw === true) {
|
|
1961
|
-
indices.push(a, b, c);
|
|
1962
|
-
indices.push(c, b, d);
|
|
1963
|
-
} else {
|
|
1964
|
-
indices.push(a, c, b);
|
|
1965
|
-
indices.push(c, d, b);
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
} // triangulate cap
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
if (beginCap === true || endCap === true) {
|
|
1972
|
-
const contour = [];
|
|
1973
|
-
|
|
1974
|
-
for (let i = 0, l = crossSection.length; i < l; i += 2) {
|
|
1975
|
-
contour.push(new Vector2(crossSection[i], crossSection[i + 1]));
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
const faces = ShapeUtils.triangulateShape(contour, []);
|
|
1979
|
-
const capIndices = [];
|
|
1980
|
-
|
|
1981
|
-
for (let i = 0, l = faces.length; i < l; i++) {
|
|
1982
|
-
const face = faces[i];
|
|
1983
|
-
capIndices.push(face[0], face[1], face[2]);
|
|
1984
|
-
} // begin cap
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
if (beginCap === true) {
|
|
1988
|
-
for (let i = 0, l = capIndices.length; i < l; i += 3) {
|
|
1989
|
-
if (ccw === true) {
|
|
1990
|
-
indices.push(capIndices[i + 0], capIndices[i + 1], capIndices[i + 2]);
|
|
1991
|
-
} else {
|
|
1992
|
-
indices.push(capIndices[i + 0], capIndices[i + 2], capIndices[i + 1]);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
} // end cap
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
if (endCap === true) {
|
|
1999
|
-
const indexOffset = crossSectionCount * (spineCount - 1); // references to the first vertex of the last cross section
|
|
2000
|
-
|
|
2001
|
-
for (let i = 0, l = capIndices.length; i < l; i += 3) {
|
|
2002
|
-
if (ccw === true) {
|
|
2003
|
-
indices.push(indexOffset + capIndices[i + 0], indexOffset + capIndices[i + 2], indexOffset + capIndices[i + 1]);
|
|
2004
|
-
} else {
|
|
2005
|
-
indices.push(indexOffset + capIndices[i + 0], indexOffset + capIndices[i + 1], indexOffset + capIndices[i + 2]);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
const positionAttribute = toNonIndexedAttribute(indices, new Float32BufferAttribute(vertices, 3));
|
|
2012
|
-
const normalAttribute = computeNormalAttribute(indices, vertices, creaseAngle);
|
|
2013
|
-
const geometry = new BufferGeometry();
|
|
2014
|
-
geometry.setAttribute('position', positionAttribute);
|
|
2015
|
-
geometry.setAttribute('normal', normalAttribute); // no uvs yet
|
|
2016
|
-
// "solid" influences the material so let's store it for later use
|
|
2017
|
-
|
|
2018
|
-
geometry._solid = solid;
|
|
2019
|
-
geometry._type = 'mesh';
|
|
2020
|
-
return geometry;
|
|
2021
|
-
} // helper functions
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
function resolveUSE(identifier) {
|
|
2025
|
-
const node = nodeMap[identifier];
|
|
2026
|
-
const build = getNode(node); // because the same 3D objects can have different transformations, it's necessary to clone them.
|
|
2027
|
-
// materials can be influenced by the geometry (e.g. vertex normals). cloning is necessary to avoid
|
|
2028
|
-
// any side effects
|
|
2029
|
-
|
|
2030
|
-
return build.isObject3D || build.isMaterial ? build.clone() : build;
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
function parseFieldChildren(children, owner) {
|
|
2034
|
-
for (let i = 0, l = children.length; i < l; i++) {
|
|
2035
|
-
const object = getNode(children[i]);
|
|
2036
|
-
if (object instanceof Object3D) owner.add(object);
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
function triangulateFaceIndex(index, ccw) {
|
|
2041
|
-
const indices = []; // since face defintions can have more than three vertices, it's necessary to
|
|
2042
|
-
// perform a simple triangulation
|
|
2043
|
-
|
|
2044
|
-
let start = 0;
|
|
2045
|
-
|
|
2046
|
-
for (let i = 0, l = index.length; i < l; i++) {
|
|
2047
|
-
const i1 = index[start];
|
|
2048
|
-
const i2 = index[i + (ccw ? 1 : 2)];
|
|
2049
|
-
const i3 = index[i + (ccw ? 2 : 1)];
|
|
2050
|
-
indices.push(i1, i2, i3); // an index of -1 indicates that the current face has ended and the next one begins
|
|
2051
|
-
|
|
2052
|
-
if (index[i + 3] === -1 || i + 3 >= l) {
|
|
2053
|
-
i += 3;
|
|
2054
|
-
start = i + 1;
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
return indices;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
function triangulateFaceData(data, index) {
|
|
2062
|
-
const triangulatedData = [];
|
|
2063
|
-
let start = 0;
|
|
2064
|
-
|
|
2065
|
-
for (let i = 0, l = index.length; i < l; i++) {
|
|
2066
|
-
const stride = start * 3;
|
|
2067
|
-
const x = data[stride];
|
|
2068
|
-
const y = data[stride + 1];
|
|
2069
|
-
const z = data[stride + 2];
|
|
2070
|
-
triangulatedData.push(x, y, z); // an index of -1 indicates that the current face has ended and the next one begins
|
|
2071
|
-
|
|
2072
|
-
if (index[i + 3] === -1 || i + 3 >= l) {
|
|
2073
|
-
i += 3;
|
|
2074
|
-
start++;
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
return triangulatedData;
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
function flattenData(data, index) {
|
|
2082
|
-
const flattenData = [];
|
|
2083
|
-
|
|
2084
|
-
for (let i = 0, l = index.length; i < l; i++) {
|
|
2085
|
-
const i1 = index[i];
|
|
2086
|
-
const stride = i1 * 3;
|
|
2087
|
-
const x = data[stride];
|
|
2088
|
-
const y = data[stride + 1];
|
|
2089
|
-
const z = data[stride + 2];
|
|
2090
|
-
flattenData.push(x, y, z);
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
return flattenData;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
function expandLineIndex(index) {
|
|
2097
|
-
const indices = [];
|
|
2098
|
-
|
|
2099
|
-
for (let i = 0, l = index.length; i < l; i++) {
|
|
2100
|
-
const i1 = index[i];
|
|
2101
|
-
const i2 = index[i + 1];
|
|
2102
|
-
indices.push(i1, i2); // an index of -1 indicates that the current line has ended and the next one begins
|
|
2103
|
-
|
|
2104
|
-
if (index[i + 2] === -1 || i + 2 >= l) {
|
|
2105
|
-
i += 2;
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
return indices;
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
function expandLineData(data, index) {
|
|
2113
|
-
const triangulatedData = [];
|
|
2114
|
-
let start = 0;
|
|
2115
|
-
|
|
2116
|
-
for (let i = 0, l = index.length; i < l; i++) {
|
|
2117
|
-
const stride = start * 3;
|
|
2118
|
-
const x = data[stride];
|
|
2119
|
-
const y = data[stride + 1];
|
|
2120
|
-
const z = data[stride + 2];
|
|
2121
|
-
triangulatedData.push(x, y, z); // an index of -1 indicates that the current line has ended and the next one begins
|
|
2122
|
-
|
|
2123
|
-
if (index[i + 2] === -1 || i + 2 >= l) {
|
|
2124
|
-
i += 2;
|
|
2125
|
-
start++;
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
return triangulatedData;
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
const vA = new Vector3();
|
|
2133
|
-
const vB = new Vector3();
|
|
2134
|
-
const vC = new Vector3();
|
|
2135
|
-
const uvA = new Vector2();
|
|
2136
|
-
const uvB = new Vector2();
|
|
2137
|
-
const uvC = new Vector2();
|
|
2138
|
-
|
|
2139
|
-
function computeAttributeFromIndexedData(coordIndex, index, data, itemSize) {
|
|
2140
|
-
const array = []; // we use the coordIndex.length as delimiter since normalIndex must contain at least as many indices
|
|
2141
|
-
|
|
2142
|
-
for (let i = 0, l = coordIndex.length; i < l; i += 3) {
|
|
2143
|
-
const a = index[i];
|
|
2144
|
-
const b = index[i + 1];
|
|
2145
|
-
const c = index[i + 2];
|
|
2146
|
-
|
|
2147
|
-
if (itemSize === 2) {
|
|
2148
|
-
uvA.fromArray(data, a * itemSize);
|
|
2149
|
-
uvB.fromArray(data, b * itemSize);
|
|
2150
|
-
uvC.fromArray(data, c * itemSize);
|
|
2151
|
-
array.push(uvA.x, uvA.y);
|
|
2152
|
-
array.push(uvB.x, uvB.y);
|
|
2153
|
-
array.push(uvC.x, uvC.y);
|
|
2154
|
-
} else {
|
|
2155
|
-
vA.fromArray(data, a * itemSize);
|
|
2156
|
-
vB.fromArray(data, b * itemSize);
|
|
2157
|
-
vC.fromArray(data, c * itemSize);
|
|
2158
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2159
|
-
array.push(vB.x, vB.y, vB.z);
|
|
2160
|
-
array.push(vC.x, vC.y, vC.z);
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
return new Float32BufferAttribute(array, itemSize);
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
function computeAttributeFromFaceData(index, faceData) {
|
|
2168
|
-
const array = [];
|
|
2169
|
-
|
|
2170
|
-
for (let i = 0, j = 0, l = index.length; i < l; i += 3, j++) {
|
|
2171
|
-
vA.fromArray(faceData, j * 3);
|
|
2172
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2173
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2174
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
return new Float32BufferAttribute(array, 3);
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
function computeAttributeFromLineData(index, lineData) {
|
|
2181
|
-
const array = [];
|
|
2182
|
-
|
|
2183
|
-
for (let i = 0, j = 0, l = index.length; i < l; i += 2, j++) {
|
|
2184
|
-
vA.fromArray(lineData, j * 3);
|
|
2185
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2186
|
-
array.push(vA.x, vA.y, vA.z);
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
return new Float32BufferAttribute(array, 3);
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
function toNonIndexedAttribute(indices, attribute) {
|
|
2193
|
-
const array = attribute.array;
|
|
2194
|
-
const itemSize = attribute.itemSize;
|
|
2195
|
-
const array2 = new array.constructor(indices.length * itemSize);
|
|
2196
|
-
let index = 0,
|
|
2197
|
-
index2 = 0;
|
|
2198
|
-
|
|
2199
|
-
for (let i = 0, l = indices.length; i < l; i++) {
|
|
2200
|
-
index = indices[i] * itemSize;
|
|
2201
|
-
|
|
2202
|
-
for (let j = 0; j < itemSize; j++) {
|
|
2203
|
-
array2[index2++] = array[index++];
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
return new Float32BufferAttribute(array2, itemSize);
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
const ab = new Vector3();
|
|
2211
|
-
const cb = new Vector3();
|
|
2212
|
-
|
|
2213
|
-
function computeNormalAttribute(index, coord, creaseAngle) {
|
|
2214
|
-
const faces = [];
|
|
2215
|
-
const vertexNormals = {}; // prepare face and raw vertex normals
|
|
2216
|
-
|
|
2217
|
-
for (let i = 0, l = index.length; i < l; i += 3) {
|
|
2218
|
-
const a = index[i];
|
|
2219
|
-
const b = index[i + 1];
|
|
2220
|
-
const c = index[i + 2];
|
|
2221
|
-
const face = new Face(a, b, c);
|
|
2222
|
-
vA.fromArray(coord, a * 3);
|
|
2223
|
-
vB.fromArray(coord, b * 3);
|
|
2224
|
-
vC.fromArray(coord, c * 3);
|
|
2225
|
-
cb.subVectors(vC, vB);
|
|
2226
|
-
ab.subVectors(vA, vB);
|
|
2227
|
-
cb.cross(ab);
|
|
2228
|
-
cb.normalize();
|
|
2229
|
-
face.normal.copy(cb);
|
|
2230
|
-
if (vertexNormals[a] === undefined) vertexNormals[a] = [];
|
|
2231
|
-
if (vertexNormals[b] === undefined) vertexNormals[b] = [];
|
|
2232
|
-
if (vertexNormals[c] === undefined) vertexNormals[c] = [];
|
|
2233
|
-
vertexNormals[a].push(face.normal);
|
|
2234
|
-
vertexNormals[b].push(face.normal);
|
|
2235
|
-
vertexNormals[c].push(face.normal);
|
|
2236
|
-
faces.push(face);
|
|
2237
|
-
} // compute vertex normals and build final geometry
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
const normals = [];
|
|
2241
|
-
|
|
2242
|
-
for (let i = 0, l = faces.length; i < l; i++) {
|
|
2243
|
-
const face = faces[i];
|
|
2244
|
-
const nA = weightedNormal(vertexNormals[face.a], face.normal, creaseAngle);
|
|
2245
|
-
const nB = weightedNormal(vertexNormals[face.b], face.normal, creaseAngle);
|
|
2246
|
-
const nC = weightedNormal(vertexNormals[face.c], face.normal, creaseAngle);
|
|
2247
|
-
vA.fromArray(coord, face.a * 3);
|
|
2248
|
-
vB.fromArray(coord, face.b * 3);
|
|
2249
|
-
vC.fromArray(coord, face.c * 3);
|
|
2250
|
-
normals.push(nA.x, nA.y, nA.z);
|
|
2251
|
-
normals.push(nB.x, nB.y, nB.z);
|
|
2252
|
-
normals.push(nC.x, nC.y, nC.z);
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
return new Float32BufferAttribute(normals, 3);
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
function weightedNormal(normals, vector, creaseAngle) {
|
|
2259
|
-
const normal = new Vector3();
|
|
2260
|
-
|
|
2261
|
-
if (creaseAngle === 0) {
|
|
2262
|
-
normal.copy(vector);
|
|
2263
|
-
} else {
|
|
2264
|
-
for (let i = 0, l = normals.length; i < l; i++) {
|
|
2265
|
-
if (normals[i].angleTo(vector) < creaseAngle) {
|
|
2266
|
-
normal.add(normals[i]);
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
return normal.normalize();
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
function toColorArray(colors) {
|
|
2275
|
-
const array = [];
|
|
2276
|
-
|
|
2277
|
-
for (let i = 0, l = colors.length; i < l; i += 3) {
|
|
2278
|
-
array.push(new Color(colors[i], colors[i + 1], colors[i + 2]));
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
return array;
|
|
2282
|
-
}
|
|
2283
|
-
/**
|
|
2284
|
-
* Vertically paints the faces interpolating between the
|
|
2285
|
-
* specified colors at the specified angels. This is used for the Background
|
|
2286
|
-
* node, but could be applied to other nodes with multiple faces as well.
|
|
2287
|
-
*
|
|
2288
|
-
* When used with the Background node, default is directionIsDown is true if
|
|
2289
|
-
* interpolating the skyColor down from the Zenith. When interpolationg up from
|
|
2290
|
-
* the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
|
|
2291
|
-
*
|
|
2292
|
-
* The first angle is never specified, it is the Zenith (0 rad). Angles are specified
|
|
2293
|
-
* in radians. The geometry is thought a sphere, but could be anything. The color interpolation
|
|
2294
|
-
* is linear along the Y axis in any case.
|
|
2295
|
-
*
|
|
2296
|
-
* You must specify one more color than you have angles at the beginning of the colors array.
|
|
2297
|
-
* This is the color of the Zenith (the top of the shape).
|
|
2298
|
-
*
|
|
2299
|
-
* @param {BufferGeometry} geometry
|
|
2300
|
-
* @param {number} radius
|
|
2301
|
-
* @param {array} angles
|
|
2302
|
-
* @param {array} colors
|
|
2303
|
-
* @param {boolean} topDown - Whether to work top down or bottom up.
|
|
2304
|
-
*/
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
function paintFaces(geometry, radius, angles, colors, topDown) {
|
|
2308
|
-
// compute threshold values
|
|
2309
|
-
const thresholds = [];
|
|
2310
|
-
const startAngle = topDown === true ? 0 : Math.PI;
|
|
2311
|
-
|
|
2312
|
-
for (let i = 0, l = colors.length; i < l; i++) {
|
|
2313
|
-
let angle = i === 0 ? 0 : angles[i - 1];
|
|
2314
|
-
angle = topDown === true ? angle : startAngle - angle;
|
|
2315
|
-
const point = new Vector3();
|
|
2316
|
-
point.setFromSphericalCoords(radius, angle, 0);
|
|
2317
|
-
thresholds.push(point);
|
|
2318
|
-
} // generate vertex colors
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
const indices = geometry.index;
|
|
2322
|
-
const positionAttribute = geometry.attributes.position;
|
|
2323
|
-
const colorAttribute = new BufferAttribute(new Float32Array(geometry.attributes.position.count * 3), 3);
|
|
2324
|
-
const position = new Vector3();
|
|
2325
|
-
const color = new Color();
|
|
2326
|
-
|
|
2327
|
-
for (let i = 0; i < indices.count; i++) {
|
|
2328
|
-
const index = indices.getX(i);
|
|
2329
|
-
position.fromBufferAttribute(positionAttribute, index);
|
|
2330
|
-
let thresholdIndexA, thresholdIndexB;
|
|
2331
|
-
let t = 1;
|
|
2332
|
-
|
|
2333
|
-
for (let j = 1; j < thresholds.length; j++) {
|
|
2334
|
-
thresholdIndexA = j - 1;
|
|
2335
|
-
thresholdIndexB = j;
|
|
2336
|
-
const thresholdA = thresholds[thresholdIndexA];
|
|
2337
|
-
const thresholdB = thresholds[thresholdIndexB];
|
|
2338
|
-
|
|
2339
|
-
if (topDown === true) {
|
|
2340
|
-
// interpolation for sky color
|
|
2341
|
-
if (position.y <= thresholdA.y && position.y > thresholdB.y) {
|
|
2342
|
-
t = Math.abs(thresholdA.y - position.y) / Math.abs(thresholdA.y - thresholdB.y);
|
|
2343
|
-
break;
|
|
2344
|
-
}
|
|
2345
|
-
} else {
|
|
2346
|
-
// interpolation for ground color
|
|
2347
|
-
if (position.y >= thresholdA.y && position.y < thresholdB.y) {
|
|
2348
|
-
t = Math.abs(thresholdA.y - position.y) / Math.abs(thresholdA.y - thresholdB.y);
|
|
2349
|
-
break;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
const colorA = colors[thresholdIndexA];
|
|
2355
|
-
const colorB = colors[thresholdIndexB];
|
|
2356
|
-
color.copy(colorA).lerp(colorB, t);
|
|
2357
|
-
colorAttribute.setXYZ(index, color.r, color.g, color.b);
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
geometry.setAttribute('color', colorAttribute);
|
|
2361
|
-
} //
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
const textureLoader = new TextureLoader(this.manager);
|
|
2365
|
-
textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin); // check version (only 2.0 is supported)
|
|
2366
|
-
|
|
2367
|
-
if (data.indexOf('#VRML V2.0') === -1) {
|
|
2368
|
-
throw Error('THREE.VRMLLexer: Version of VRML asset not supported.');
|
|
2369
|
-
} // create JSON representing the tree structure of the VRML asset
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
const tree = generateVRMLTree(data); // parse the tree structure to a three.js scene
|
|
2373
|
-
|
|
2374
|
-
const scene = parseTree(tree);
|
|
2375
|
-
return scene;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
|
-
class VRMLLexer {
|
|
2381
|
-
constructor(tokens) {
|
|
2382
|
-
this.lexer = new Lexer(tokens); // eslint-disable-line no-undef
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
lex(inputText) {
|
|
2386
|
-
const lexingResult = this.lexer.tokenize(inputText);
|
|
2387
|
-
|
|
2388
|
-
if (lexingResult.errors.length > 0) {
|
|
2389
|
-
console.error(lexingResult.errors);
|
|
2390
|
-
throw Error('THREE.VRMLLexer: Lexing errors detected.');
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
return lexingResult;
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
class VRMLParser extends CstParser {
|
|
2399
|
-
constructor(tokenVocabulary) {
|
|
2400
|
-
super(tokenVocabulary);
|
|
2401
|
-
const $ = this;
|
|
2402
|
-
const Version = tokenVocabulary['Version'];
|
|
2403
|
-
const LCurly = tokenVocabulary['LCurly'];
|
|
2404
|
-
const RCurly = tokenVocabulary['RCurly'];
|
|
2405
|
-
const LSquare = tokenVocabulary['LSquare'];
|
|
2406
|
-
const RSquare = tokenVocabulary['RSquare'];
|
|
2407
|
-
const Identifier = tokenVocabulary['Identifier'];
|
|
2408
|
-
const RouteIdentifier = tokenVocabulary['RouteIdentifier'];
|
|
2409
|
-
const StringLiteral = tokenVocabulary['StringLiteral'];
|
|
2410
|
-
const HexLiteral = tokenVocabulary['HexLiteral'];
|
|
2411
|
-
const NumberLiteral = tokenVocabulary['NumberLiteral'];
|
|
2412
|
-
const TrueLiteral = tokenVocabulary['TrueLiteral'];
|
|
2413
|
-
const FalseLiteral = tokenVocabulary['FalseLiteral'];
|
|
2414
|
-
const NullLiteral = tokenVocabulary['NullLiteral'];
|
|
2415
|
-
const DEF = tokenVocabulary['DEF'];
|
|
2416
|
-
const USE = tokenVocabulary['USE'];
|
|
2417
|
-
const ROUTE = tokenVocabulary['ROUTE'];
|
|
2418
|
-
const TO = tokenVocabulary['TO'];
|
|
2419
|
-
const NodeName = tokenVocabulary['NodeName'];
|
|
2420
|
-
$.RULE('vrml', function () {
|
|
2421
|
-
$.SUBRULE($.version);
|
|
2422
|
-
$.AT_LEAST_ONE(function () {
|
|
2423
|
-
$.SUBRULE($.node);
|
|
2424
|
-
});
|
|
2425
|
-
$.MANY(function () {
|
|
2426
|
-
$.SUBRULE($.route);
|
|
2427
|
-
});
|
|
2428
|
-
});
|
|
2429
|
-
$.RULE('version', function () {
|
|
2430
|
-
$.CONSUME(Version);
|
|
2431
|
-
});
|
|
2432
|
-
$.RULE('node', function () {
|
|
2433
|
-
$.OPTION(function () {
|
|
2434
|
-
$.SUBRULE($.def);
|
|
2435
|
-
});
|
|
2436
|
-
$.CONSUME(NodeName);
|
|
2437
|
-
$.CONSUME(LCurly);
|
|
2438
|
-
$.MANY(function () {
|
|
2439
|
-
$.SUBRULE($.field);
|
|
2440
|
-
});
|
|
2441
|
-
$.CONSUME(RCurly);
|
|
2442
|
-
});
|
|
2443
|
-
$.RULE('field', function () {
|
|
2444
|
-
$.CONSUME(Identifier);
|
|
2445
|
-
$.OR2([{
|
|
2446
|
-
ALT: function () {
|
|
2447
|
-
$.SUBRULE($.singleFieldValue);
|
|
2448
|
-
}
|
|
2449
|
-
}, {
|
|
2450
|
-
ALT: function () {
|
|
2451
|
-
$.SUBRULE($.multiFieldValue);
|
|
2452
|
-
}
|
|
2453
|
-
}]);
|
|
2454
|
-
});
|
|
2455
|
-
$.RULE('def', function () {
|
|
2456
|
-
$.CONSUME(DEF);
|
|
2457
|
-
$.OR([{
|
|
2458
|
-
ALT: function () {
|
|
2459
|
-
$.CONSUME(Identifier);
|
|
2460
|
-
}
|
|
2461
|
-
}, {
|
|
2462
|
-
ALT: function () {
|
|
2463
|
-
$.CONSUME(NodeName);
|
|
2464
|
-
}
|
|
2465
|
-
}]);
|
|
2466
|
-
});
|
|
2467
|
-
$.RULE('use', function () {
|
|
2468
|
-
$.CONSUME(USE);
|
|
2469
|
-
$.OR([{
|
|
2470
|
-
ALT: function () {
|
|
2471
|
-
$.CONSUME(Identifier);
|
|
2472
|
-
}
|
|
2473
|
-
}, {
|
|
2474
|
-
ALT: function () {
|
|
2475
|
-
$.CONSUME(NodeName);
|
|
2476
|
-
}
|
|
2477
|
-
}]);
|
|
2478
|
-
});
|
|
2479
|
-
$.RULE('singleFieldValue', function () {
|
|
2480
|
-
$.AT_LEAST_ONE(function () {
|
|
2481
|
-
$.OR([{
|
|
2482
|
-
ALT: function () {
|
|
2483
|
-
$.SUBRULE($.node);
|
|
2484
|
-
}
|
|
2485
|
-
}, {
|
|
2486
|
-
ALT: function () {
|
|
2487
|
-
$.SUBRULE($.use);
|
|
2488
|
-
}
|
|
2489
|
-
}, {
|
|
2490
|
-
ALT: function () {
|
|
2491
|
-
$.CONSUME(StringLiteral);
|
|
2492
|
-
}
|
|
2493
|
-
}, {
|
|
2494
|
-
ALT: function () {
|
|
2495
|
-
$.CONSUME(HexLiteral);
|
|
2496
|
-
}
|
|
2497
|
-
}, {
|
|
2498
|
-
ALT: function () {
|
|
2499
|
-
$.CONSUME(NumberLiteral);
|
|
2500
|
-
}
|
|
2501
|
-
}, {
|
|
2502
|
-
ALT: function () {
|
|
2503
|
-
$.CONSUME(TrueLiteral);
|
|
2504
|
-
}
|
|
2505
|
-
}, {
|
|
2506
|
-
ALT: function () {
|
|
2507
|
-
$.CONSUME(FalseLiteral);
|
|
2508
|
-
}
|
|
2509
|
-
}, {
|
|
2510
|
-
ALT: function () {
|
|
2511
|
-
$.CONSUME(NullLiteral);
|
|
2512
|
-
}
|
|
2513
|
-
}]);
|
|
2514
|
-
});
|
|
2515
|
-
});
|
|
2516
|
-
$.RULE('multiFieldValue', function () {
|
|
2517
|
-
$.CONSUME(LSquare);
|
|
2518
|
-
$.MANY(function () {
|
|
2519
|
-
$.OR([{
|
|
2520
|
-
ALT: function () {
|
|
2521
|
-
$.SUBRULE($.node);
|
|
2522
|
-
}
|
|
2523
|
-
}, {
|
|
2524
|
-
ALT: function () {
|
|
2525
|
-
$.SUBRULE($.use);
|
|
2526
|
-
}
|
|
2527
|
-
}, {
|
|
2528
|
-
ALT: function () {
|
|
2529
|
-
$.CONSUME(StringLiteral);
|
|
2530
|
-
}
|
|
2531
|
-
}, {
|
|
2532
|
-
ALT: function () {
|
|
2533
|
-
$.CONSUME(HexLiteral);
|
|
2534
|
-
}
|
|
2535
|
-
}, {
|
|
2536
|
-
ALT: function () {
|
|
2537
|
-
$.CONSUME(NumberLiteral);
|
|
2538
|
-
}
|
|
2539
|
-
}, {
|
|
2540
|
-
ALT: function () {
|
|
2541
|
-
$.CONSUME(NullLiteral);
|
|
2542
|
-
}
|
|
2543
|
-
}]);
|
|
2544
|
-
});
|
|
2545
|
-
$.CONSUME(RSquare);
|
|
2546
|
-
});
|
|
2547
|
-
$.RULE('route', function () {
|
|
2548
|
-
$.CONSUME(ROUTE);
|
|
2549
|
-
$.CONSUME(RouteIdentifier);
|
|
2550
|
-
$.CONSUME(TO);
|
|
2551
|
-
$.CONSUME2(RouteIdentifier);
|
|
2552
|
-
});
|
|
2553
|
-
this.performSelfAnalysis();
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
class Face {
|
|
2559
|
-
constructor(a, b, c) {
|
|
2560
|
-
this.a = a;
|
|
2561
|
-
this.b = b;
|
|
2562
|
-
this.c = c;
|
|
2563
|
-
this.normal = new Vector3();
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
const TEXTURE_TYPE = {
|
|
2569
|
-
INTENSITY: 1,
|
|
2570
|
-
INTENSITY_ALPHA: 2,
|
|
2571
|
-
RGB: 3,
|
|
2572
|
-
RGBA: 4
|
|
2573
|
-
};
|
|
2574
|
-
|
|
2575
|
-
export { VRMLLoader };
|