@anov/3d 0.0.4-alpha.1 → 0.0.4-alpha13
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/README.md +1 -144
- package/dist/applicationApi.d.ts +34 -0
- package/dist/{core/cssRenderer.js → applicationApi.js} +53 -21
- package/dist/environment/index.d.ts +27 -0
- package/dist/environment/index.js +84 -0
- package/dist/environment/time/index.d.ts +12 -0
- package/dist/environment/time/index.js +27 -0
- package/dist/environment/weather/type.d.ts +15 -0
- package/dist/environment/weather/type.js +27 -0
- package/dist/hooksManager.d.ts +2 -0
- package/dist/hooksManager.js +15 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +38 -5
- package/dist/messageStatus.d.ts +49 -0
- package/dist/messageStatus.js +50 -0
- package/dist/utils/index.d.ts +11 -50
- package/dist/utils/index.js +29 -92
- package/dist/utils/messageFn.d.ts +12 -0
- package/dist/utils/messageFn.js +33 -0
- package/package.json +8 -24
- package/dist/commonEnu.d.ts +0 -5
- package/dist/commonEnu.js +0 -6
- package/dist/core/camera.d.ts +0 -32
- package/dist/core/camera.js +0 -74
- package/dist/core/control/transformControls.d.ts +0 -12
- package/dist/core/control/transformControls.js +0 -72
- package/dist/core/cssRenderer.d.ts +0 -17
- package/dist/core/events.d.ts +0 -16
- package/dist/core/events.js +0 -38
- package/dist/core/global/global.d.ts +0 -27
- package/dist/core/global/global.js +0 -72
- package/dist/core/global/globalControl.d.ts +0 -17
- package/dist/core/global/globalControl.js +0 -62
- package/dist/core/group.d.ts +0 -57
- package/dist/core/group.js +0 -157
- package/dist/core/line.d.ts +0 -13
- package/dist/core/line.js +0 -83
- package/dist/core/mesh.d.ts +0 -59
- package/dist/core/mesh.js +0 -180
- package/dist/core/model.d.ts +0 -30
- package/dist/core/model.js +0 -109
- package/dist/core/scene.d.ts +0 -175
- package/dist/core/scene.js +0 -381
- package/dist/core/use/useScene.d.ts +0 -10
- package/dist/core/use/useScene.js +0 -14
- package/dist/core/use/useframe.d.ts +0 -6
- package/dist/core/use/useframe.js +0 -11
- package/dist/export.d.ts +0 -40
- package/dist/export.js +0 -36
- package/dist/threeCell.d.ts +0 -8
- package/dist/threeCell.js +0 -16
- package/dist/type.d.ts +0 -3
- package/dist/type.js +0 -1
- package/dist/utils/createElement.d.ts +0 -103
- package/dist/utils/createElement.js +0 -145
- package/dist/utils/createLabel.d.ts +0 -2
- package/dist/utils/createLabel.js +0 -4
- package/dist/utils/line.d.ts +0 -0
- package/dist/utils/line.js +0 -0
- package/dist/utils/move.d.ts +0 -48
- package/dist/utils/move.js +0 -149
- package/examples/fonts/LICENSE +0 -13
- package/examples/fonts/README.md +0 -11
- package/examples/fonts/droid/NOTICE +0 -190
- package/examples/fonts/droid/README.txt +0 -18
- package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
- package/examples/fonts/gentilis_bold.typeface.json +0 -1
- package/examples/fonts/gentilis_regular.typeface.json +0 -1
- package/examples/fonts/helvetiker_bold.typeface.json +0 -1
- package/examples/fonts/helvetiker_regular.typeface.json +0 -1
- package/examples/fonts/optimer_bold.typeface.json +0 -1
- package/examples/fonts/optimer_regular.typeface.json +0 -1
- package/examples/fonts/ttf/README.md +0 -9
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/animation/AnimationClipCreator.js +0 -116
- package/examples/jsm/animation/CCDIKSolver.js +0 -482
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1207
- package/examples/jsm/animation/MMDPhysics.js +0 -1406
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/examples/jsm/capabilities/WebGL.js +0 -91
- package/examples/jsm/capabilities/WebGPU.js +0 -53
- package/examples/jsm/controls/ArcballControls.js +0 -3224
- package/examples/jsm/controls/DragControls.js +0 -220
- package/examples/jsm/controls/FirstPersonControls.js +0 -325
- package/examples/jsm/controls/FlyControls.js +0 -300
- package/examples/jsm/controls/MapControls.js +0 -28
- package/examples/jsm/controls/OrbitControls.js +0 -1388
- package/examples/jsm/controls/PointerLockControls.js +0 -162
- package/examples/jsm/controls/TrackballControls.js +0 -828
- package/examples/jsm/controls/TransformControls.js +0 -1557
- package/examples/jsm/csm/CSM.js +0 -384
- package/examples/jsm/csm/CSMFrustum.js +0 -152
- package/examples/jsm/csm/CSMHelper.js +0 -193
- package/examples/jsm/csm/CSMShader.js +0 -252
- package/examples/jsm/curves/CurveExtras.js +0 -422
- package/examples/jsm/curves/NURBSCurve.js +0 -80
- package/examples/jsm/curves/NURBSSurface.js +0 -52
- package/examples/jsm/curves/NURBSUtils.js +0 -487
- package/examples/jsm/effects/AnaglyphEffect.js +0 -154
- package/examples/jsm/effects/AsciiEffect.js +0 -263
- package/examples/jsm/effects/OutlineEffect.js +0 -539
- package/examples/jsm/effects/ParallaxBarrierEffect.js +0 -119
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -153
- package/examples/jsm/effects/StereoEffect.js +0 -55
- package/examples/jsm/environments/DebugEnvironment.js +0 -52
- package/examples/jsm/environments/RoomEnvironment.js +0 -148
- package/examples/jsm/exporters/DRACOExporter.js +0 -267
- package/examples/jsm/exporters/EXRExporter.js +0 -501
- package/examples/jsm/exporters/GLTFExporter.js +0 -3161
- package/examples/jsm/exporters/KTX2Exporter.js +0 -292
- package/examples/jsm/exporters/MMDExporter.js +0 -217
- package/examples/jsm/exporters/OBJExporter.js +0 -284
- package/examples/jsm/exporters/PLYExporter.js +0 -528
- package/examples/jsm/exporters/STLExporter.js +0 -199
- package/examples/jsm/exporters/USDZExporter.js +0 -711
- package/examples/jsm/geometries/BoxLineGeometry.js +0 -69
- package/examples/jsm/geometries/ConvexGeometry.js +0 -53
- package/examples/jsm/geometries/DecalGeometry.js +0 -356
- package/examples/jsm/geometries/ParametricGeometries.js +0 -254
- package/examples/jsm/geometries/ParametricGeometry.js +0 -139
- package/examples/jsm/geometries/RoundedBoxGeometry.js +0 -155
- package/examples/jsm/geometries/TeapotGeometry.js +0 -704
- package/examples/jsm/geometries/TextGeometry.js +0 -57
- package/examples/jsm/helpers/LightProbeHelper.js +0 -130
- package/examples/jsm/helpers/OctreeHelper.js +0 -73
- package/examples/jsm/helpers/PositionalAudioHelper.js +0 -109
- package/examples/jsm/helpers/RectAreaLightHelper.js +0 -85
- package/examples/jsm/helpers/VertexNormalsHelper.js +0 -96
- package/examples/jsm/helpers/VertexTangentsHelper.js +0 -88
- package/examples/jsm/helpers/ViewHelper.js +0 -333
- package/examples/jsm/interactive/HTMLMesh.js +0 -565
- package/examples/jsm/interactive/InteractiveGroup.js +0 -116
- package/examples/jsm/interactive/SelectionBox.js +0 -227
- package/examples/jsm/interactive/SelectionHelper.js +0 -104
- package/examples/jsm/libs/ammo.wasm.js +0 -822
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +0 -46
- package/examples/jsm/libs/basis/basis_transcoder.js +0 -21
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +0 -141
- package/examples/jsm/libs/draco/README.md +0 -32
- package/examples/jsm/libs/draco/draco_decoder.js +0 -34
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +0 -117
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +0 -116
- package/examples/jsm/libs/ecsy.module.js +0 -1792
- package/examples/jsm/libs/fflate.module.js +0 -2474
- package/examples/jsm/libs/ktx-parse.module.js +0 -1
- package/examples/jsm/libs/lil-gui.module.min.js +0 -8
- package/examples/jsm/libs/lottie_canvas.module.js +0 -14844
- package/examples/jsm/libs/meshopt_decoder.module.js +0 -178
- package/examples/jsm/libs/mikktspace.module.js +0 -128
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/libs/motion-controllers.module.js +0 -397
- package/examples/jsm/libs/opentype.module.js +0 -14568
- package/examples/jsm/libs/potpack.module.js +0 -125
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +0 -167
- package/examples/jsm/libs/tween.module.js +0 -803
- package/examples/jsm/libs/utif.module.js +0 -1579
- package/examples/jsm/libs/zstddec.module.js +0 -1
- package/examples/jsm/lights/IESSpotLight.js +0 -25
- package/examples/jsm/lights/LightProbeGenerator.js +0 -252
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +0 -79
- package/examples/jsm/lines/Line2.js +0 -19
- package/examples/jsm/lines/LineGeometry.js +0 -79
- package/examples/jsm/lines/LineMaterial.js +0 -702
- package/examples/jsm/lines/LineSegments2.js +0 -361
- package/examples/jsm/lines/LineSegmentsGeometry.js +0 -241
- package/examples/jsm/lines/Wireframe.js +0 -56
- package/examples/jsm/lines/WireframeGeometry2.js +0 -24
- package/examples/jsm/loaders/3DMLoader.js +0 -1497
- package/examples/jsm/loaders/3MFLoader.js +0 -1478
- package/examples/jsm/loaders/AMFLoader.js +0 -521
- package/examples/jsm/loaders/BVHLoader.js +0 -437
- package/examples/jsm/loaders/ColladaLoader.js +0 -4122
- package/examples/jsm/loaders/DDSLoader.js +0 -274
- package/examples/jsm/loaders/DRACOLoader.js +0 -612
- package/examples/jsm/loaders/EXRLoader.js +0 -2309
- package/examples/jsm/loaders/FBXLoader.js +0 -4142
- package/examples/jsm/loaders/FontLoader.js +0 -183
- package/examples/jsm/loaders/GCodeLoader.js +0 -261
- package/examples/jsm/loaders/GLTFLoader.js +0 -4576
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +0 -115
- package/examples/jsm/loaders/IESLoader.js +0 -337
- package/examples/jsm/loaders/KMZLoader.js +0 -130
- package/examples/jsm/loaders/KTX2Loader.js +0 -868
- package/examples/jsm/loaders/KTXLoader.js +0 -176
- package/examples/jsm/loaders/LDrawLoader.js +0 -2464
- package/examples/jsm/loaders/LUT3dlLoader.js +0 -151
- package/examples/jsm/loaders/LUTCubeLoader.js +0 -153
- package/examples/jsm/loaders/LWOLoader.js +0 -1052
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/LottieLoader.js +0 -77
- package/examples/jsm/loaders/MD2Loader.js +0 -399
- package/examples/jsm/loaders/MDDLoader.js +0 -102
- package/examples/jsm/loaders/MMDLoader.js +0 -2273
- package/examples/jsm/loaders/MTLLoader.js +0 -567
- package/examples/jsm/loaders/MaterialXLoader.js +0 -734
- package/examples/jsm/loaders/NRRDLoader.js +0 -699
- package/examples/jsm/loaders/OBJLoader.js +0 -905
- package/examples/jsm/loaders/PCDLoader.js +0 -467
- package/examples/jsm/loaders/PDBLoader.js +0 -232
- package/examples/jsm/loaders/PLYLoader.js +0 -771
- package/examples/jsm/loaders/PVRLoader.js +0 -251
- package/examples/jsm/loaders/RGBELoader.js +0 -468
- package/examples/jsm/loaders/RGBMLoader.js +0 -1065
- package/examples/jsm/loaders/STLLoader.js +0 -403
- package/examples/jsm/loaders/SVGLoader.js +0 -3172
- package/examples/jsm/loaders/TDSLoader.js +0 -1124
- package/examples/jsm/loaders/TGALoader.js +0 -517
- package/examples/jsm/loaders/TIFFLoader.js +0 -36
- package/examples/jsm/loaders/TTFLoader.js +0 -214
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/loaders/USDZLoader.js +0 -633
- package/examples/jsm/loaders/VOXLoader.js +0 -311
- package/examples/jsm/loaders/VRMLLoader.js +0 -3533
- package/examples/jsm/loaders/VTKLoader.js +0 -1163
- package/examples/jsm/loaders/XYZLoader.js +0 -106
- package/examples/jsm/loaders/lwo/IFFParser.js +0 -1218
- package/examples/jsm/loaders/lwo/LWO2Parser.js +0 -414
- package/examples/jsm/loaders/lwo/LWO3Parser.js +0 -373
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -420
- package/examples/jsm/math/Capsule.js +0 -137
- package/examples/jsm/math/ColorConverter.js +0 -36
- package/examples/jsm/math/ConvexHull.js +0 -1271
- package/examples/jsm/math/ImprovedNoise.js +0 -71
- package/examples/jsm/math/Lut.js +0 -204
- package/examples/jsm/math/MeshSurfaceSampler.js +0 -250
- package/examples/jsm/math/OBB.js +0 -423
- package/examples/jsm/math/Octree.js +0 -462
- package/examples/jsm/math/SimplexNoise.js +0 -444
- package/examples/jsm/misc/ConvexObjectBreaker.js +0 -519
- package/examples/jsm/misc/GPUComputationRenderer.js +0 -446
- package/examples/jsm/misc/Gyroscope.js +0 -66
- package/examples/jsm/misc/MD2Character.js +0 -276
- package/examples/jsm/misc/MD2CharacterComplex.js +0 -576
- package/examples/jsm/misc/MorphAnimMesh.js +0 -75
- package/examples/jsm/misc/MorphBlendMesh.js +0 -322
- package/examples/jsm/misc/ProgressiveLightMap.js +0 -323
- package/examples/jsm/misc/RollerCoaster.js +0 -566
- package/examples/jsm/misc/TubePainter.js +0 -205
- package/examples/jsm/misc/Volume.js +0 -473
- package/examples/jsm/misc/VolumeSlice.js +0 -229
- package/examples/jsm/modifiers/CurveModifier.js +0 -326
- package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -279
- package/examples/jsm/modifiers/SimplifyModifier.js +0 -525
- package/examples/jsm/modifiers/TessellateModifier.js +0 -307
- package/examples/jsm/nodes/Nodes.js +0 -171
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +0 -99
- package/examples/jsm/nodes/accessors/BufferNode.js +0 -30
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -98
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -103
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -77
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -71
- package/examples/jsm/nodes/accessors/MaterialNode.js +0 -267
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +0 -39
- package/examples/jsm/nodes/accessors/ModelNode.js +0 -34
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +0 -29
- package/examples/jsm/nodes/accessors/MorphNode.js +0 -70
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -96
- package/examples/jsm/nodes/accessors/Object3DNode.js +0 -150
- package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReferenceNode.js +0 -72
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/SceneNode.js +0 -52
- package/examples/jsm/nodes/accessors/SkinningNode.js +0 -93
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +0 -27
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -103
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +0 -94
- package/examples/jsm/nodes/accessors/TextureNode.js +0 -271
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +0 -35
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/accessors/UserDataNode.js +0 -29
- package/examples/jsm/nodes/code/CodeNode.js +0 -78
- package/examples/jsm/nodes/code/ExpressionNode.js +0 -37
- package/examples/jsm/nodes/code/FunctionCallNode.js +0 -96
- package/examples/jsm/nodes/code/FunctionNode.js +0 -127
- package/examples/jsm/nodes/code/ScriptableNode.js +0 -488
- package/examples/jsm/nodes/code/ScriptableValueNode.js +0 -167
- package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
- package/examples/jsm/nodes/core/AttributeNode.js +0 -102
- package/examples/jsm/nodes/core/BypassNode.js +0 -45
- package/examples/jsm/nodes/core/CacheNode.js +0 -46
- package/examples/jsm/nodes/core/ConstNode.js +0 -32
- package/examples/jsm/nodes/core/ContextNode.js +0 -61
- package/examples/jsm/nodes/core/IndexNode.js +0 -66
- package/examples/jsm/nodes/core/InputNode.js +0 -83
- package/examples/jsm/nodes/core/LightingModel.js +0 -15
- package/examples/jsm/nodes/core/Node.js +0 -454
- package/examples/jsm/nodes/core/NodeAttribute.js +0 -15
- package/examples/jsm/nodes/core/NodeBuilder.js +0 -1016
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/NodeCode.js +0 -15
- package/examples/jsm/nodes/core/NodeFrame.js +0 -110
- package/examples/jsm/nodes/core/NodeFunction.js +0 -22
- package/examples/jsm/nodes/core/NodeFunctionInput.js +0 -17
- package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
- package/examples/jsm/nodes/core/NodeParser.js +0 -11
- package/examples/jsm/nodes/core/NodeUniform.js +0 -28
- package/examples/jsm/nodes/core/NodeUtils.js +0 -212
- package/examples/jsm/nodes/core/NodeVar.js +0 -14
- package/examples/jsm/nodes/core/NodeVarying.js +0 -17
- package/examples/jsm/nodes/core/PropertyNode.js +0 -61
- package/examples/jsm/nodes/core/StackNode.js +0 -99
- package/examples/jsm/nodes/core/TempNode.js +0 -58
- package/examples/jsm/nodes/core/UniformNode.js +0 -61
- package/examples/jsm/nodes/core/VarNode.js +0 -87
- package/examples/jsm/nodes/core/VaryingNode.js +0 -69
- package/examples/jsm/nodes/core/constants.js +0 -27
- package/examples/jsm/nodes/display/BlendModeNode.js +0 -99
- package/examples/jsm/nodes/display/BumpMapNode.js +0 -77
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -100
- package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
- package/examples/jsm/nodes/display/FrontFacingNode.js +0 -27
- package/examples/jsm/nodes/display/NormalMapNode.js +0 -106
- package/examples/jsm/nodes/display/PosterizeNode.js +0 -32
- package/examples/jsm/nodes/display/ToneMappingNode.js +0 -141
- package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -69
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -34
- package/examples/jsm/nodes/display/ViewportNode.js +0 -115
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -31
- package/examples/jsm/nodes/display/ViewportTextureNode.js +0 -75
- package/examples/jsm/nodes/fog/FogExp2Node.js +0 -35
- package/examples/jsm/nodes/fog/FogNode.js +0 -37
- package/examples/jsm/nodes/fog/FogRangeNode.js +0 -34
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +0 -40
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +0 -9
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +0 -43
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +0 -29
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +0 -18
- package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +0 -13
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +0 -16
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +0 -13
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +0 -20
- package/examples/jsm/nodes/functions/PhongLightingModel.js +0 -67
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +0 -343
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
- package/examples/jsm/nodes/functions/material/getRoughness.js +0 -18
- package/examples/jsm/nodes/geometry/RangeNode.js +0 -104
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +0 -85
- package/examples/jsm/nodes/lighting/AONode.js +0 -27
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +0 -27
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -184
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +0 -40
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -191
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +0 -55
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +0 -39
- package/examples/jsm/nodes/lighting/LightNode.js +0 -57
- package/examples/jsm/nodes/lighting/LightUtils.js +0 -17
- package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -102
- package/examples/jsm/nodes/lighting/LightingNode.js +0 -21
- package/examples/jsm/nodes/lighting/LightsNode.js +0 -128
- package/examples/jsm/nodes/lighting/PointLightNode.js +0 -68
- package/examples/jsm/nodes/lighting/SpotLightNode.js +0 -89
- package/examples/jsm/nodes/loaders/NodeLoader.js +0 -108
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +0 -59
- package/examples/jsm/nodes/loaders/NodeObjectLoader.js +0 -70
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/Materials.js +0 -12
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -27
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +0 -128
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +0 -80
- package/examples/jsm/nodes/materials/NodeMaterial.js +0 -536
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -49
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -103
- package/examples/jsm/nodes/materialx/DISCLAIMER.md +0 -199
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +0 -68
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +0 -56
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +0 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +0 -19
- package/examples/jsm/nodes/math/CondNode.js +0 -86
- package/examples/jsm/nodes/math/MathNode.js +0 -359
- package/examples/jsm/nodes/math/OperatorNode.js +0 -269
- package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +0 -152
- package/examples/jsm/nodes/parsers/GLSLNodeParser.js +0 -14
- package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
- package/examples/jsm/nodes/shadernode/ShaderNode.js +0 -420
- package/examples/jsm/nodes/utils/ArrayElementNode.js +0 -33
- package/examples/jsm/nodes/utils/ConvertNode.js +0 -65
- package/examples/jsm/nodes/utils/DiscardNode.js +0 -26
- package/examples/jsm/nodes/utils/EquirectUVNode.js +0 -33
- package/examples/jsm/nodes/utils/JoinNode.js +0 -51
- package/examples/jsm/nodes/utils/LoopNode.js +0 -186
- package/examples/jsm/nodes/utils/MatcapUVNode.js +0 -30
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +0 -46
- package/examples/jsm/nodes/utils/OscNode.js +0 -81
- package/examples/jsm/nodes/utils/PackingNode.js +0 -55
- package/examples/jsm/nodes/utils/RemapNode.js +0 -42
- package/examples/jsm/nodes/utils/RotateUVNode.js +0 -43
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
- package/examples/jsm/nodes/utils/SplitNode.js +0 -104
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +0 -41
- package/examples/jsm/nodes/utils/TimerNode.js +0 -94
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +0 -62
- package/examples/jsm/objects/GroundProjectedSkybox.js +0 -172
- package/examples/jsm/objects/Lensflare.js +0 -377
- package/examples/jsm/objects/MarchingCubes.js +0 -1176
- package/examples/jsm/objects/Reflector.js +0 -264
- package/examples/jsm/objects/ReflectorForSSRPass.js +0 -349
- package/examples/jsm/objects/Refractor.js +0 -324
- package/examples/jsm/objects/ShadowMesh.js +0 -80
- package/examples/jsm/objects/Sky.js +0 -219
- package/examples/jsm/objects/Water.js +0 -330
- package/examples/jsm/objects/Water2.js +0 -358
- package/examples/jsm/offscreen/jank.js +0 -45
- package/examples/jsm/offscreen/offscreen.js +0 -8
- package/examples/jsm/offscreen/scene.js +0 -86
- package/examples/jsm/physics/AmmoPhysics.js +0 -285
- package/examples/jsm/physics/RapierPhysics.js +0 -199
- package/examples/jsm/postprocessing/AfterimagePass.js +0 -104
- package/examples/jsm/postprocessing/BloomPass.js +0 -172
- package/examples/jsm/postprocessing/BokehPass.js +0 -140
- package/examples/jsm/postprocessing/ClearPass.js +0 -46
- package/examples/jsm/postprocessing/CubeTexturePass.js +0 -85
- package/examples/jsm/postprocessing/DotScreenPass.js +0 -65
- package/examples/jsm/postprocessing/EffectComposer.js +0 -231
- package/examples/jsm/postprocessing/FilmPass.js +0 -66
- package/examples/jsm/postprocessing/GlitchPass.js +0 -128
- package/examples/jsm/postprocessing/HalftonePass.js +0 -79
- package/examples/jsm/postprocessing/LUTPass.js +0 -173
- package/examples/jsm/postprocessing/MaskPass.js +0 -104
- package/examples/jsm/postprocessing/OutlinePass.js +0 -654
- package/examples/jsm/postprocessing/OutputPass.js +0 -91
- package/examples/jsm/postprocessing/Pass.js +0 -84
- package/examples/jsm/postprocessing/RenderPass.js +0 -81
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +0 -235
- package/examples/jsm/postprocessing/SAOPass.js +0 -411
- package/examples/jsm/postprocessing/SMAAPass.js +0 -201
- package/examples/jsm/postprocessing/SSAARenderPass.js +0 -228
- package/examples/jsm/postprocessing/SSAOPass.js +0 -440
- package/examples/jsm/postprocessing/SSRPass.js +0 -641
- package/examples/jsm/postprocessing/SavePass.js +0 -79
- package/examples/jsm/postprocessing/ShaderPass.js +0 -77
- package/examples/jsm/postprocessing/TAARenderPass.js +0 -189
- package/examples/jsm/postprocessing/TexturePass.js +0 -67
- package/examples/jsm/postprocessing/UnrealBloomPass.js +0 -415
- package/examples/jsm/renderers/CSS2DRenderer.js +0 -215
- package/examples/jsm/renderers/CSS3DRenderer.js +0 -335
- package/examples/jsm/renderers/Projector.js +0 -918
- package/examples/jsm/renderers/SVGRenderer.js +0 -553
- package/examples/jsm/renderers/common/Animation.js +0 -58
- package/examples/jsm/renderers/common/Attributes.js +0 -75
- package/examples/jsm/renderers/common/Backend.js +0 -162
- package/examples/jsm/renderers/common/Background.js +0 -136
- package/examples/jsm/renderers/common/Binding.js +0 -19
- package/examples/jsm/renderers/common/Bindings.js +0 -165
- package/examples/jsm/renderers/common/Buffer.js +0 -38
- package/examples/jsm/renderers/common/BufferUtils.js +0 -33
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- package/examples/jsm/renderers/common/ComputePipeline.js +0 -17
- package/examples/jsm/renderers/common/Constants.js +0 -14
- package/examples/jsm/renderers/common/CubeRenderTarget.js +0 -65
- package/examples/jsm/renderers/common/DataMap.js +0 -54
- package/examples/jsm/renderers/common/Geometries.js +0 -215
- package/examples/jsm/renderers/common/Info.js +0 -73
- package/examples/jsm/renderers/common/Pipeline.js +0 -13
- package/examples/jsm/renderers/common/Pipelines.js +0 -370
- package/examples/jsm/renderers/common/ProgrammableStage.js +0 -18
- package/examples/jsm/renderers/common/RenderContext.js +0 -38
- package/examples/jsm/renderers/common/RenderContexts.js +0 -49
- package/examples/jsm/renderers/common/RenderList.js +0 -178
- package/examples/jsm/renderers/common/RenderLists.js +0 -38
- package/examples/jsm/renderers/common/RenderObject.js +0 -129
- package/examples/jsm/renderers/common/RenderObjects.js +0 -95
- package/examples/jsm/renderers/common/RenderPipeline.js +0 -16
- package/examples/jsm/renderers/common/Renderer.js +0 -895
- package/examples/jsm/renderers/common/SampledTexture.js +0 -80
- package/examples/jsm/renderers/common/Sampler.js +0 -18
- package/examples/jsm/renderers/common/StorageBuffer.js +0 -17
- package/examples/jsm/renderers/common/Textures.js +0 -218
- package/examples/jsm/renderers/common/Uniform.js +0 -140
- package/examples/jsm/renderers/common/UniformBuffer.js +0 -15
- package/examples/jsm/renderers/common/UniformsGroup.js +0 -299
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +0 -39
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +0 -21
- package/examples/jsm/renderers/common/nodes/NodeUniform.js +0 -135
- package/examples/jsm/renderers/common/nodes/Nodes.js +0 -330
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +0 -340
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +0 -764
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +0 -49
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +0 -844
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +0 -32
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +0 -902
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.js +0 -14
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +0 -274
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +0 -223
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +0 -324
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +0 -533
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +0 -964
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +0 -92
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +0 -87
- package/examples/jsm/shaders/AfterimageShader.js +0 -56
- package/examples/jsm/shaders/BasicShader.js +0 -27
- package/examples/jsm/shaders/BleachBypassShader.js +0 -62
- package/examples/jsm/shaders/BlendShader.js +0 -47
- package/examples/jsm/shaders/BokehShader.js +0 -143
- package/examples/jsm/shaders/BokehShader2.js +0 -393
- package/examples/jsm/shaders/BrightnessContrastShader.js +0 -54
- package/examples/jsm/shaders/ColorCorrectionShader.js +0 -50
- package/examples/jsm/shaders/ColorifyShader.js +0 -51
- package/examples/jsm/shaders/ConvolutionShader.js +0 -103
- package/examples/jsm/shaders/CopyShader.js +0 -45
- package/examples/jsm/shaders/DOFMipMapShader.js +0 -54
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +0 -166
- package/examples/jsm/shaders/DigitalGlitch.js +0 -101
- package/examples/jsm/shaders/DotScreenShader.js +0 -70
- package/examples/jsm/shaders/ExposureShader.js +0 -44
- package/examples/jsm/shaders/FXAAShader.js +0 -286
- package/examples/jsm/shaders/FilmShader.js +0 -102
- package/examples/jsm/shaders/FocusShader.js +0 -87
- package/examples/jsm/shaders/FreiChenShader.js +0 -94
- package/examples/jsm/shaders/GammaCorrectionShader.js +0 -43
- package/examples/jsm/shaders/GodRaysShader.js +0 -313
- package/examples/jsm/shaders/HalftoneShader.js +0 -310
- package/examples/jsm/shaders/HorizontalBlurShader.js +0 -59
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +0 -61
- package/examples/jsm/shaders/HueSaturationShader.js +0 -65
- package/examples/jsm/shaders/KaleidoShader.js +0 -56
- package/examples/jsm/shaders/LuminosityHighPassShader.js +0 -64
- package/examples/jsm/shaders/LuminosityShader.js +0 -46
- package/examples/jsm/shaders/MMDToonShader.js +0 -132
- package/examples/jsm/shaders/MirrorShader.js +0 -54
- package/examples/jsm/shaders/NormalMapShader.js +0 -53
- package/examples/jsm/shaders/OutputShader.js +0 -78
- package/examples/jsm/shaders/RGBShiftShader.js +0 -54
- package/examples/jsm/shaders/SAOShader.js +0 -188
- package/examples/jsm/shaders/SMAAShader.js +0 -460
- package/examples/jsm/shaders/SSAOShader.js +0 -288
- package/examples/jsm/shaders/SSRShader.js +0 -364
- package/examples/jsm/shaders/SepiaShader.js +0 -52
- package/examples/jsm/shaders/SobelOperatorShader.js +0 -90
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +0 -88
- package/examples/jsm/shaders/TechnicolorShader.js +0 -43
- package/examples/jsm/shaders/ToonShader.js +0 -326
- package/examples/jsm/shaders/TriangleBlurShader.js +0 -72
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +0 -45
- package/examples/jsm/shaders/VelocityShader.js +0 -128
- package/examples/jsm/shaders/VerticalBlurShader.js +0 -59
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +0 -61
- package/examples/jsm/shaders/VignetteShader.js +0 -51
- package/examples/jsm/shaders/VolumeShader.js +0 -289
- package/examples/jsm/shaders/WaterRefractionShader.js +0 -93
- package/examples/jsm/textures/FlakesTexture.js +0 -40
- package/examples/jsm/utils/BufferGeometryUtils.js +0 -1373
- package/examples/jsm/utils/CameraUtils.js +0 -73
- package/examples/jsm/utils/GPUStatsPanel.js +0 -128
- package/examples/jsm/utils/GeometryCompressionUtils.js +0 -639
- package/examples/jsm/utils/GeometryUtils.js +0 -221
- package/examples/jsm/utils/LDrawUtils.js +0 -202
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/examples/jsm/utils/SceneUtils.js +0 -254
- package/examples/jsm/utils/ShadowMapViewer.js +0 -210
- package/examples/jsm/utils/SkeletonUtils.js +0 -413
- package/examples/jsm/utils/TextureUtils.js +0 -86
- package/examples/jsm/utils/UVsDebug.js +0 -165
- package/examples/jsm/utils/WorkerPool.js +0 -102
- package/examples/jsm/webxr/ARButton.js +0 -208
- package/examples/jsm/webxr/OculusHandModel.js +0 -109
- package/examples/jsm/webxr/OculusHandPointerModel.js +0 -413
- package/examples/jsm/webxr/Text2D.js +0 -38
- package/examples/jsm/webxr/VRButton.js +0 -200
- package/examples/jsm/webxr/XRButton.js +0 -198
- package/examples/jsm/webxr/XRControllerModelFactory.js +0 -299
- package/examples/jsm/webxr/XREstimatedLight.js +0 -223
- package/examples/jsm/webxr/XRHandMeshModel.js +0 -112
- package/examples/jsm/webxr/XRHandModelFactory.js +0 -105
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +0 -103
- package/examples/jsm/webxr/XRPlanes.js +0 -100
- package/lib/3d.min.js +0 -1
|
@@ -1,1218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* === IFFParser ===
|
|
3
|
-
* - Parses data from the IFF buffer.
|
|
4
|
-
* - LWO3 files are in IFF format and can contain the following data types, referred to by shorthand codes
|
|
5
|
-
*
|
|
6
|
-
* ATOMIC DATA TYPES
|
|
7
|
-
* ID Tag - 4x 7 bit uppercase ASCII chars: ID4
|
|
8
|
-
* signed integer, 1, 2, or 4 byte length: I1, I2, I4
|
|
9
|
-
* unsigned integer, 1, 2, or 4 byte length: U1, U2, U4
|
|
10
|
-
* float, 4 byte length: F4
|
|
11
|
-
* string, series of ASCII chars followed by null byte (If the length of the string including the null terminating byte is odd, an extra null is added so that the data that follows will begin on an even byte boundary): S0
|
|
12
|
-
*
|
|
13
|
-
* COMPOUND DATA TYPES
|
|
14
|
-
* Variable-length Index (index into an array or collection): U2 or U4 : VX
|
|
15
|
-
* Color (RGB): F4 + F4 + F4: COL12
|
|
16
|
-
* Coordinate (x, y, z): F4 + F4 + F4: VEC12
|
|
17
|
-
* Percentage F4 data type from 0->1 with 1 = 100%: FP4
|
|
18
|
-
* Angle in radian F4: ANG4
|
|
19
|
-
* Filename (string) S0: FNAM0
|
|
20
|
-
* XValue F4 + index (VX) + optional envelope( ENVL ): XVAL
|
|
21
|
-
* XValue vector VEC12 + index (VX) + optional envelope( ENVL ): XVAL3
|
|
22
|
-
*
|
|
23
|
-
* The IFF file is arranged in chunks:
|
|
24
|
-
* CHUNK = ID4 + length (U4) + length X bytes of data + optional 0 pad byte
|
|
25
|
-
* optional 0 pad byte is there to ensure chunk ends on even boundary, not counted in size
|
|
26
|
-
*
|
|
27
|
-
* COMPOUND DATA TYPES
|
|
28
|
-
* - Chunks are combined in Forms (collections of chunks)
|
|
29
|
-
* - FORM = string 'FORM' (ID4) + length (U4) + type (ID4) + optional ( CHUNK | FORM )
|
|
30
|
-
* - CHUNKS and FORMS are collectively referred to as blocks
|
|
31
|
-
* - The entire file is contained in one top level FORM
|
|
32
|
-
*
|
|
33
|
-
**/
|
|
34
|
-
|
|
35
|
-
import { LWO2Parser } from './LWO2Parser.js';
|
|
36
|
-
import { LWO3Parser } from './LWO3Parser.js';
|
|
37
|
-
|
|
38
|
-
function IFFParser( ) {
|
|
39
|
-
|
|
40
|
-
this.debugger = new Debugger();
|
|
41
|
-
// this.debugger.enable(); // un-comment to log IFF hierarchy.
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
IFFParser.prototype = {
|
|
46
|
-
|
|
47
|
-
constructor: IFFParser,
|
|
48
|
-
|
|
49
|
-
parse: function ( buffer ) {
|
|
50
|
-
|
|
51
|
-
this.reader = new DataViewReader( buffer );
|
|
52
|
-
|
|
53
|
-
this.tree = {
|
|
54
|
-
materials: {},
|
|
55
|
-
layers: [],
|
|
56
|
-
tags: [],
|
|
57
|
-
textures: [],
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// start out at the top level to add any data before first layer is encountered
|
|
61
|
-
this.currentLayer = this.tree;
|
|
62
|
-
this.currentForm = this.tree;
|
|
63
|
-
|
|
64
|
-
this.parseTopForm();
|
|
65
|
-
|
|
66
|
-
if ( this.tree.format === undefined ) return;
|
|
67
|
-
|
|
68
|
-
if ( this.tree.format === 'LWO2' ) {
|
|
69
|
-
|
|
70
|
-
this.parser = new LWO2Parser( this );
|
|
71
|
-
while ( ! this.reader.endOfFile() ) this.parser.parseBlock();
|
|
72
|
-
|
|
73
|
-
} else if ( this.tree.format === 'LWO3' ) {
|
|
74
|
-
|
|
75
|
-
this.parser = new LWO3Parser( this );
|
|
76
|
-
while ( ! this.reader.endOfFile() ) this.parser.parseBlock();
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
this.debugger.offset = this.reader.offset;
|
|
81
|
-
this.debugger.closeForms();
|
|
82
|
-
|
|
83
|
-
return this.tree;
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
parseTopForm() {
|
|
88
|
-
|
|
89
|
-
this.debugger.offset = this.reader.offset;
|
|
90
|
-
|
|
91
|
-
var topForm = this.reader.getIDTag();
|
|
92
|
-
|
|
93
|
-
if ( topForm !== 'FORM' ) {
|
|
94
|
-
|
|
95
|
-
console.warn( 'LWOLoader: Top-level FORM missing.' );
|
|
96
|
-
return;
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var length = this.reader.getUint32();
|
|
101
|
-
|
|
102
|
-
this.debugger.dataOffset = this.reader.offset;
|
|
103
|
-
this.debugger.length = length;
|
|
104
|
-
|
|
105
|
-
var type = this.reader.getIDTag();
|
|
106
|
-
|
|
107
|
-
if ( type === 'LWO2' ) {
|
|
108
|
-
|
|
109
|
-
this.tree.format = type;
|
|
110
|
-
|
|
111
|
-
} else if ( type === 'LWO3' ) {
|
|
112
|
-
|
|
113
|
-
this.tree.format = type;
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this.debugger.node = 0;
|
|
118
|
-
this.debugger.nodeID = type;
|
|
119
|
-
this.debugger.log();
|
|
120
|
-
|
|
121
|
-
return;
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
///
|
|
127
|
-
// FORM PARSING METHODS
|
|
128
|
-
///
|
|
129
|
-
|
|
130
|
-
// Forms are organisational and can contain any number of sub chunks and sub forms
|
|
131
|
-
// FORM ::= 'FORM'[ID4], length[U4], type[ID4], ( chunk[CHUNK] | form[FORM] ) * }
|
|
132
|
-
parseForm( length ) {
|
|
133
|
-
|
|
134
|
-
var type = this.reader.getIDTag();
|
|
135
|
-
|
|
136
|
-
switch ( type ) {
|
|
137
|
-
|
|
138
|
-
// SKIPPED FORMS
|
|
139
|
-
// if skipForm( length ) is called, the entire form and any sub forms and chunks are skipped
|
|
140
|
-
|
|
141
|
-
case 'ISEQ': // Image sequence
|
|
142
|
-
case 'ANIM': // plug in animation
|
|
143
|
-
case 'STCC': // Color-cycling Still
|
|
144
|
-
case 'VPVL':
|
|
145
|
-
case 'VPRM':
|
|
146
|
-
case 'NROT':
|
|
147
|
-
case 'WRPW': // image wrap w ( for cylindrical and spherical projections)
|
|
148
|
-
case 'WRPH': // image wrap h
|
|
149
|
-
case 'FUNC':
|
|
150
|
-
case 'FALL':
|
|
151
|
-
case 'OPAC':
|
|
152
|
-
case 'GRAD': // gradient texture
|
|
153
|
-
case 'ENVS':
|
|
154
|
-
case 'VMOP':
|
|
155
|
-
case 'VMBG':
|
|
156
|
-
|
|
157
|
-
// Car Material FORMS
|
|
158
|
-
case 'OMAX':
|
|
159
|
-
case 'STEX':
|
|
160
|
-
case 'CKBG':
|
|
161
|
-
case 'CKEY':
|
|
162
|
-
case 'VMLA':
|
|
163
|
-
case 'VMLB':
|
|
164
|
-
this.debugger.skipped = true;
|
|
165
|
-
this.skipForm( length ); // not currently supported
|
|
166
|
-
break;
|
|
167
|
-
|
|
168
|
-
// if break; is called directly, the position in the lwoTree is not created
|
|
169
|
-
// any sub chunks and forms are added to the parent form instead
|
|
170
|
-
case 'META':
|
|
171
|
-
case 'NNDS':
|
|
172
|
-
case 'NODS':
|
|
173
|
-
case 'NDTA':
|
|
174
|
-
case 'ADAT':
|
|
175
|
-
case 'AOVS':
|
|
176
|
-
case 'BLOK':
|
|
177
|
-
|
|
178
|
-
// used by texture nodes
|
|
179
|
-
case 'IBGC': // imageBackgroundColor
|
|
180
|
-
case 'IOPC': // imageOpacity
|
|
181
|
-
case 'IIMG': // hold reference to image path
|
|
182
|
-
case 'TXTR':
|
|
183
|
-
// this.setupForm( type, length );
|
|
184
|
-
this.debugger.length = 4;
|
|
185
|
-
this.debugger.skipped = true;
|
|
186
|
-
break;
|
|
187
|
-
|
|
188
|
-
case 'IFAL': // imageFallof
|
|
189
|
-
case 'ISCL': // imageScale
|
|
190
|
-
case 'IPOS': // imagePosition
|
|
191
|
-
case 'IROT': // imageRotation
|
|
192
|
-
case 'IBMP':
|
|
193
|
-
case 'IUTD':
|
|
194
|
-
case 'IVTD':
|
|
195
|
-
this.parseTextureNodeAttribute( type );
|
|
196
|
-
break;
|
|
197
|
-
|
|
198
|
-
case 'ENVL':
|
|
199
|
-
this.parseEnvelope( length );
|
|
200
|
-
break;
|
|
201
|
-
|
|
202
|
-
// CLIP FORM AND SUB FORMS
|
|
203
|
-
|
|
204
|
-
case 'CLIP':
|
|
205
|
-
if ( this.tree.format === 'LWO2' ) {
|
|
206
|
-
|
|
207
|
-
this.parseForm( length );
|
|
208
|
-
|
|
209
|
-
} else {
|
|
210
|
-
|
|
211
|
-
this.parseClip( length );
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
break;
|
|
216
|
-
|
|
217
|
-
case 'STIL':
|
|
218
|
-
this.parseImage();
|
|
219
|
-
break;
|
|
220
|
-
|
|
221
|
-
case 'XREF': // clone of another STIL
|
|
222
|
-
this.reader.skip( 8 ); // unknown
|
|
223
|
-
this.currentForm.referenceTexture = {
|
|
224
|
-
index: this.reader.getUint32(),
|
|
225
|
-
refName: this.reader.getString() // internal unique ref
|
|
226
|
-
};
|
|
227
|
-
break;
|
|
228
|
-
|
|
229
|
-
// Not in spec, used by texture nodes
|
|
230
|
-
|
|
231
|
-
case 'IMST':
|
|
232
|
-
this.parseImageStateForm( length );
|
|
233
|
-
break;
|
|
234
|
-
|
|
235
|
-
// SURF FORM AND SUB FORMS
|
|
236
|
-
|
|
237
|
-
case 'SURF':
|
|
238
|
-
this.parseSurfaceForm( length );
|
|
239
|
-
break;
|
|
240
|
-
|
|
241
|
-
case 'VALU': // Not in spec
|
|
242
|
-
this.parseValueForm( length );
|
|
243
|
-
break;
|
|
244
|
-
|
|
245
|
-
case 'NTAG':
|
|
246
|
-
this.parseSubNode( length );
|
|
247
|
-
break;
|
|
248
|
-
|
|
249
|
-
case 'ATTR': // BSDF Node Attributes
|
|
250
|
-
case 'SATR': // Standard Node Attributes
|
|
251
|
-
this.setupForm( 'attributes', length );
|
|
252
|
-
break;
|
|
253
|
-
|
|
254
|
-
case 'NCON':
|
|
255
|
-
this.parseConnections( length );
|
|
256
|
-
break;
|
|
257
|
-
|
|
258
|
-
case 'SSHA':
|
|
259
|
-
this.parentForm = this.currentForm;
|
|
260
|
-
this.currentForm = this.currentSurface;
|
|
261
|
-
this.setupForm( 'surfaceShader', length );
|
|
262
|
-
break;
|
|
263
|
-
|
|
264
|
-
case 'SSHD':
|
|
265
|
-
this.setupForm( 'surfaceShaderData', length );
|
|
266
|
-
break;
|
|
267
|
-
|
|
268
|
-
case 'ENTR': // Not in spec
|
|
269
|
-
this.parseEntryForm( length );
|
|
270
|
-
break;
|
|
271
|
-
|
|
272
|
-
// Image Map Layer
|
|
273
|
-
|
|
274
|
-
case 'IMAP':
|
|
275
|
-
this.parseImageMap( length );
|
|
276
|
-
break;
|
|
277
|
-
|
|
278
|
-
case 'TAMP':
|
|
279
|
-
this.parseXVAL( 'amplitude', length );
|
|
280
|
-
break;
|
|
281
|
-
|
|
282
|
-
//Texture Mapping Form
|
|
283
|
-
|
|
284
|
-
case 'TMAP':
|
|
285
|
-
this.setupForm( 'textureMap', length );
|
|
286
|
-
break;
|
|
287
|
-
|
|
288
|
-
case 'CNTR':
|
|
289
|
-
this.parseXVAL3( 'center', length );
|
|
290
|
-
break;
|
|
291
|
-
|
|
292
|
-
case 'SIZE':
|
|
293
|
-
this.parseXVAL3( 'scale', length );
|
|
294
|
-
break;
|
|
295
|
-
|
|
296
|
-
case 'ROTA':
|
|
297
|
-
this.parseXVAL3( 'rotation', length );
|
|
298
|
-
break;
|
|
299
|
-
|
|
300
|
-
default:
|
|
301
|
-
this.parseUnknownForm( type, length );
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
this.debugger.node = 0;
|
|
306
|
-
this.debugger.nodeID = type;
|
|
307
|
-
this.debugger.log();
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
setupForm( type, length ) {
|
|
312
|
-
|
|
313
|
-
if ( ! this.currentForm ) this.currentForm = this.currentNode;
|
|
314
|
-
|
|
315
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
316
|
-
this.parentForm = this.currentForm;
|
|
317
|
-
|
|
318
|
-
if ( ! this.currentForm[ type ] ) {
|
|
319
|
-
|
|
320
|
-
this.currentForm[ type ] = {};
|
|
321
|
-
this.currentForm = this.currentForm[ type ];
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
} else {
|
|
325
|
-
|
|
326
|
-
// should never see this unless there's a bug in the reader
|
|
327
|
-
console.warn( 'LWOLoader: form already exists on parent: ', type, this.currentForm );
|
|
328
|
-
|
|
329
|
-
this.currentForm = this.currentForm[ type ];
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
skipForm( length ) {
|
|
337
|
-
|
|
338
|
-
this.reader.skip( length - 4 );
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
parseUnknownForm( type, length ) {
|
|
343
|
-
|
|
344
|
-
console.warn( 'LWOLoader: unknown FORM encountered: ' + type, length );
|
|
345
|
-
|
|
346
|
-
printBuffer( this.reader.dv.buffer, this.reader.offset, length - 4 );
|
|
347
|
-
this.reader.skip( length - 4 );
|
|
348
|
-
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
parseSurfaceForm( length ) {
|
|
352
|
-
|
|
353
|
-
this.reader.skip( 8 ); // unknown Uint32 x2
|
|
354
|
-
|
|
355
|
-
var name = this.reader.getString();
|
|
356
|
-
|
|
357
|
-
var surface = {
|
|
358
|
-
attributes: {}, // LWO2 style non-node attributes will go here
|
|
359
|
-
connections: {},
|
|
360
|
-
name: name,
|
|
361
|
-
inputName: name,
|
|
362
|
-
nodes: {},
|
|
363
|
-
source: this.reader.getString(),
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
this.tree.materials[ name ] = surface;
|
|
367
|
-
this.currentSurface = surface;
|
|
368
|
-
|
|
369
|
-
this.parentForm = this.tree.materials;
|
|
370
|
-
this.currentForm = surface;
|
|
371
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
parseSurfaceLwo2( length ) {
|
|
376
|
-
|
|
377
|
-
var name = this.reader.getString();
|
|
378
|
-
|
|
379
|
-
var surface = {
|
|
380
|
-
attributes: {}, // LWO2 style non-node attributes will go here
|
|
381
|
-
connections: {},
|
|
382
|
-
name: name,
|
|
383
|
-
nodes: {},
|
|
384
|
-
source: this.reader.getString(),
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
this.tree.materials[ name ] = surface;
|
|
388
|
-
this.currentSurface = surface;
|
|
389
|
-
|
|
390
|
-
this.parentForm = this.tree.materials;
|
|
391
|
-
this.currentForm = surface;
|
|
392
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
393
|
-
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
parseSubNode( length ) {
|
|
397
|
-
|
|
398
|
-
// parse the NRNM CHUNK of the subnode FORM to get
|
|
399
|
-
// a meaningful name for the subNode
|
|
400
|
-
// some subnodes can be renamed, but Input and Surface cannot
|
|
401
|
-
|
|
402
|
-
this.reader.skip( 8 ); // NRNM + length
|
|
403
|
-
var name = this.reader.getString();
|
|
404
|
-
|
|
405
|
-
var node = {
|
|
406
|
-
name: name
|
|
407
|
-
};
|
|
408
|
-
this.currentForm = node;
|
|
409
|
-
this.currentNode = node;
|
|
410
|
-
|
|
411
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
},
|
|
415
|
-
|
|
416
|
-
// collect attributes from all nodes at the top level of a surface
|
|
417
|
-
parseConnections( length ) {
|
|
418
|
-
|
|
419
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
420
|
-
this.parentForm = this.currentForm;
|
|
421
|
-
|
|
422
|
-
this.currentForm = this.currentSurface.connections;
|
|
423
|
-
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
// surface node attribute data, e.g. specular, roughness etc
|
|
427
|
-
parseEntryForm( length ) {
|
|
428
|
-
|
|
429
|
-
this.reader.skip( 8 ); // NAME + length
|
|
430
|
-
var name = this.reader.getString();
|
|
431
|
-
this.currentForm = this.currentNode.attributes;
|
|
432
|
-
|
|
433
|
-
this.setupForm( name, length );
|
|
434
|
-
|
|
435
|
-
},
|
|
436
|
-
|
|
437
|
-
// parse values from material - doesn't match up to other LWO3 data types
|
|
438
|
-
// sub form of entry form
|
|
439
|
-
parseValueForm() {
|
|
440
|
-
|
|
441
|
-
this.reader.skip( 8 ); // unknown + length
|
|
442
|
-
|
|
443
|
-
var valueType = this.reader.getString();
|
|
444
|
-
|
|
445
|
-
if ( valueType === 'double' ) {
|
|
446
|
-
|
|
447
|
-
this.currentForm.value = this.reader.getUint64();
|
|
448
|
-
|
|
449
|
-
} else if ( valueType === 'int' ) {
|
|
450
|
-
|
|
451
|
-
this.currentForm.value = this.reader.getUint32();
|
|
452
|
-
|
|
453
|
-
} else if ( valueType === 'vparam' ) {
|
|
454
|
-
|
|
455
|
-
this.reader.skip( 24 );
|
|
456
|
-
this.currentForm.value = this.reader.getFloat64();
|
|
457
|
-
|
|
458
|
-
} else if ( valueType === 'vparam3' ) {
|
|
459
|
-
|
|
460
|
-
this.reader.skip( 24 );
|
|
461
|
-
this.currentForm.value = this.reader.getFloat64Array( 3 );
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
// holds various data about texture node image state
|
|
468
|
-
// Data other thanmipMapLevel unknown
|
|
469
|
-
parseImageStateForm() {
|
|
470
|
-
|
|
471
|
-
this.reader.skip( 8 ); // unknown
|
|
472
|
-
|
|
473
|
-
this.currentForm.mipMapLevel = this.reader.getFloat32();
|
|
474
|
-
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
// LWO2 style image data node OR LWO3 textures defined at top level in editor (not as SURF node)
|
|
478
|
-
parseImageMap( length ) {
|
|
479
|
-
|
|
480
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
481
|
-
this.parentForm = this.currentForm;
|
|
482
|
-
|
|
483
|
-
if ( ! this.currentForm.maps ) this.currentForm.maps = [];
|
|
484
|
-
|
|
485
|
-
var map = {};
|
|
486
|
-
this.currentForm.maps.push( map );
|
|
487
|
-
this.currentForm = map;
|
|
488
|
-
|
|
489
|
-
this.reader.skip( 10 ); // unknown, could be an issue if it contains a VX
|
|
490
|
-
|
|
491
|
-
},
|
|
492
|
-
|
|
493
|
-
parseTextureNodeAttribute( type ) {
|
|
494
|
-
|
|
495
|
-
this.reader.skip( 28 ); // FORM + length + VPRM + unknown + Uint32 x2 + float32
|
|
496
|
-
|
|
497
|
-
this.reader.skip( 20 ); // FORM + length + VPVL + float32 + Uint32
|
|
498
|
-
|
|
499
|
-
switch ( type ) {
|
|
500
|
-
|
|
501
|
-
case 'ISCL':
|
|
502
|
-
this.currentNode.scale = this.reader.getFloat32Array( 3 );
|
|
503
|
-
break;
|
|
504
|
-
case 'IPOS':
|
|
505
|
-
this.currentNode.position = this.reader.getFloat32Array( 3 );
|
|
506
|
-
break;
|
|
507
|
-
case 'IROT':
|
|
508
|
-
this.currentNode.rotation = this.reader.getFloat32Array( 3 );
|
|
509
|
-
break;
|
|
510
|
-
case 'IFAL':
|
|
511
|
-
this.currentNode.falloff = this.reader.getFloat32Array( 3 );
|
|
512
|
-
break;
|
|
513
|
-
|
|
514
|
-
case 'IBMP':
|
|
515
|
-
this.currentNode.amplitude = this.reader.getFloat32();
|
|
516
|
-
break;
|
|
517
|
-
case 'IUTD':
|
|
518
|
-
this.currentNode.uTiles = this.reader.getFloat32();
|
|
519
|
-
break;
|
|
520
|
-
case 'IVTD':
|
|
521
|
-
this.currentNode.vTiles = this.reader.getFloat32();
|
|
522
|
-
break;
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
this.reader.skip( 2 ); // unknown
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
|
|
531
|
-
// ENVL forms are currently ignored
|
|
532
|
-
parseEnvelope( length ) {
|
|
533
|
-
|
|
534
|
-
this.reader.skip( length - 4 ); // skipping entirely for now
|
|
535
|
-
|
|
536
|
-
},
|
|
537
|
-
|
|
538
|
-
///
|
|
539
|
-
// CHUNK PARSING METHODS
|
|
540
|
-
///
|
|
541
|
-
|
|
542
|
-
// clips can either be defined inside a surface node, or at the top
|
|
543
|
-
// level and they have a different format in each case
|
|
544
|
-
parseClip( length ) {
|
|
545
|
-
|
|
546
|
-
var tag = this.reader.getIDTag();
|
|
547
|
-
|
|
548
|
-
// inside surface node
|
|
549
|
-
if ( tag === 'FORM' ) {
|
|
550
|
-
|
|
551
|
-
this.reader.skip( 16 );
|
|
552
|
-
|
|
553
|
-
this.currentNode.fileName = this.reader.getString();
|
|
554
|
-
|
|
555
|
-
return;
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// otherwise top level
|
|
560
|
-
this.reader.setOffset( this.reader.offset - 4 );
|
|
561
|
-
|
|
562
|
-
this.currentFormEnd = this.reader.offset + length;
|
|
563
|
-
this.parentForm = this.currentForm;
|
|
564
|
-
|
|
565
|
-
this.reader.skip( 8 ); // unknown
|
|
566
|
-
|
|
567
|
-
var texture = {
|
|
568
|
-
index: this.reader.getUint32()
|
|
569
|
-
};
|
|
570
|
-
this.tree.textures.push( texture );
|
|
571
|
-
this.currentForm = texture;
|
|
572
|
-
|
|
573
|
-
},
|
|
574
|
-
|
|
575
|
-
parseClipLwo2( length ) {
|
|
576
|
-
|
|
577
|
-
var texture = {
|
|
578
|
-
index: this.reader.getUint32(),
|
|
579
|
-
fileName: ''
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
// seach STIL block
|
|
583
|
-
while ( true ) {
|
|
584
|
-
|
|
585
|
-
var tag = this.reader.getIDTag();
|
|
586
|
-
var n_length = this.reader.getUint16();
|
|
587
|
-
if ( tag === 'STIL' ) {
|
|
588
|
-
|
|
589
|
-
texture.fileName = this.reader.getString();
|
|
590
|
-
break;
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if ( n_length >= length ) {
|
|
595
|
-
|
|
596
|
-
break;
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
this.tree.textures.push( texture );
|
|
603
|
-
this.currentForm = texture;
|
|
604
|
-
|
|
605
|
-
},
|
|
606
|
-
|
|
607
|
-
parseImage() {
|
|
608
|
-
|
|
609
|
-
this.reader.skip( 8 ); // unknown
|
|
610
|
-
this.currentForm.fileName = this.reader.getString();
|
|
611
|
-
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
parseXVAL( type, length ) {
|
|
615
|
-
|
|
616
|
-
var endOffset = this.reader.offset + length - 4;
|
|
617
|
-
this.reader.skip( 8 );
|
|
618
|
-
|
|
619
|
-
this.currentForm[ type ] = this.reader.getFloat32();
|
|
620
|
-
|
|
621
|
-
this.reader.setOffset( endOffset ); // set end offset directly to skip optional envelope
|
|
622
|
-
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
parseXVAL3( type, length ) {
|
|
626
|
-
|
|
627
|
-
var endOffset = this.reader.offset + length - 4;
|
|
628
|
-
this.reader.skip( 8 );
|
|
629
|
-
|
|
630
|
-
this.currentForm[ type ] = {
|
|
631
|
-
x: this.reader.getFloat32(),
|
|
632
|
-
y: this.reader.getFloat32(),
|
|
633
|
-
z: this.reader.getFloat32(),
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
this.reader.setOffset( endOffset );
|
|
637
|
-
|
|
638
|
-
},
|
|
639
|
-
|
|
640
|
-
// Tags associated with an object
|
|
641
|
-
// OTAG { type[ID4], tag-string[S0] }
|
|
642
|
-
parseObjectTag() {
|
|
643
|
-
|
|
644
|
-
if ( ! this.tree.objectTags ) this.tree.objectTags = {};
|
|
645
|
-
|
|
646
|
-
this.tree.objectTags[ this.reader.getIDTag() ] = {
|
|
647
|
-
tagString: this.reader.getString()
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
},
|
|
651
|
-
|
|
652
|
-
// Signals the start of a new layer. All the data chunks which follow will be included in this layer until another layer chunk is encountered.
|
|
653
|
-
// LAYR: number[U2], flags[U2], pivot[VEC12], name[S0], parent[U2]
|
|
654
|
-
parseLayer( length ) {
|
|
655
|
-
|
|
656
|
-
var layer = {
|
|
657
|
-
number: this.reader.getUint16(),
|
|
658
|
-
flags: this.reader.getUint16(), // If the least significant bit of flags is set, the layer is hidden.
|
|
659
|
-
pivot: this.reader.getFloat32Array( 3 ), // Note: this seems to be superflous, as the geometry is translated when pivot is present
|
|
660
|
-
name: this.reader.getString(),
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
this.tree.layers.push( layer );
|
|
664
|
-
this.currentLayer = layer;
|
|
665
|
-
|
|
666
|
-
var parsedLength = 16 + stringOffset( this.currentLayer.name ); // index ( 2 ) + flags( 2 ) + pivot( 12 ) + stringlength
|
|
667
|
-
|
|
668
|
-
// if we have not reached then end of the layer block, there must be a parent defined
|
|
669
|
-
this.currentLayer.parent = ( parsedLength < length ) ? this.reader.getUint16() : - 1; // omitted or -1 for no parent
|
|
670
|
-
|
|
671
|
-
},
|
|
672
|
-
|
|
673
|
-
// VEC12 * ( F4 + F4 + F4 ) array of x,y,z vectors
|
|
674
|
-
// Converting from left to right handed coordinate system:
|
|
675
|
-
// x -> -x and switch material FrontSide -> BackSide
|
|
676
|
-
parsePoints( length ) {
|
|
677
|
-
|
|
678
|
-
this.currentPoints = [];
|
|
679
|
-
for ( var i = 0; i < length / 4; i += 3 ) {
|
|
680
|
-
|
|
681
|
-
// z -> -z to match three.js right handed coords
|
|
682
|
-
this.currentPoints.push( this.reader.getFloat32(), this.reader.getFloat32(), - this.reader.getFloat32() );
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
|
|
688
|
-
// parse VMAP or VMAD
|
|
689
|
-
// Associates a set of floating-point vectors with a set of points.
|
|
690
|
-
// VMAP: { type[ID4], dimension[U2], name[S0], ( vert[VX], value[F4] # dimension ) * }
|
|
691
|
-
|
|
692
|
-
// VMAD Associates a set of floating-point vectors with the vertices of specific polygons.
|
|
693
|
-
// Similar to VMAP UVs, but associates with polygon vertices rather than points
|
|
694
|
-
// to solve to problem of UV seams: VMAD chunks are paired with VMAPs of the same name,
|
|
695
|
-
// if they exist. The vector values in the VMAD will then replace those in the
|
|
696
|
-
// corresponding VMAP, but only for calculations involving the specified polygons.
|
|
697
|
-
// VMAD { type[ID4], dimension[U2], name[S0], ( vert[VX], poly[VX], value[F4] # dimension ) * }
|
|
698
|
-
parseVertexMapping( length, discontinuous ) {
|
|
699
|
-
|
|
700
|
-
var finalOffset = this.reader.offset + length;
|
|
701
|
-
|
|
702
|
-
var channelName = this.reader.getString();
|
|
703
|
-
|
|
704
|
-
if ( this.reader.offset === finalOffset ) {
|
|
705
|
-
|
|
706
|
-
// then we are in a texture node and the VMAP chunk is just a reference to a UV channel name
|
|
707
|
-
this.currentForm.UVChannel = channelName;
|
|
708
|
-
return;
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// otherwise reset to initial length and parse normal VMAP CHUNK
|
|
713
|
-
this.reader.setOffset( this.reader.offset - stringOffset( channelName ) );
|
|
714
|
-
|
|
715
|
-
var type = this.reader.getIDTag();
|
|
716
|
-
|
|
717
|
-
this.reader.getUint16(); // dimension
|
|
718
|
-
var name = this.reader.getString();
|
|
719
|
-
|
|
720
|
-
var remainingLength = length - 6 - stringOffset( name );
|
|
721
|
-
|
|
722
|
-
switch ( type ) {
|
|
723
|
-
|
|
724
|
-
case 'TXUV':
|
|
725
|
-
this.parseUVMapping( name, finalOffset, discontinuous );
|
|
726
|
-
break;
|
|
727
|
-
case 'MORF':
|
|
728
|
-
case 'SPOT':
|
|
729
|
-
this.parseMorphTargets( name, finalOffset, type ); // can't be discontinuous
|
|
730
|
-
break;
|
|
731
|
-
// unsupported VMAPs
|
|
732
|
-
case 'APSL':
|
|
733
|
-
case 'NORM':
|
|
734
|
-
case 'WGHT':
|
|
735
|
-
case 'MNVW':
|
|
736
|
-
case 'PICK':
|
|
737
|
-
case 'RGB ':
|
|
738
|
-
case 'RGBA':
|
|
739
|
-
this.reader.skip( remainingLength );
|
|
740
|
-
break;
|
|
741
|
-
default:
|
|
742
|
-
console.warn( 'LWOLoader: unknown vertex map type: ' + type );
|
|
743
|
-
this.reader.skip( remainingLength );
|
|
744
|
-
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
},
|
|
748
|
-
|
|
749
|
-
parseUVMapping( name, finalOffset, discontinuous ) {
|
|
750
|
-
|
|
751
|
-
var uvIndices = [];
|
|
752
|
-
var polyIndices = [];
|
|
753
|
-
var uvs = [];
|
|
754
|
-
|
|
755
|
-
while ( this.reader.offset < finalOffset ) {
|
|
756
|
-
|
|
757
|
-
uvIndices.push( this.reader.getVariableLengthIndex() );
|
|
758
|
-
|
|
759
|
-
if ( discontinuous ) polyIndices.push( this.reader.getVariableLengthIndex() );
|
|
760
|
-
|
|
761
|
-
uvs.push( this.reader.getFloat32(), this.reader.getFloat32() );
|
|
762
|
-
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
if ( discontinuous ) {
|
|
766
|
-
|
|
767
|
-
if ( ! this.currentLayer.discontinuousUVs ) this.currentLayer.discontinuousUVs = {};
|
|
768
|
-
|
|
769
|
-
this.currentLayer.discontinuousUVs[ name ] = {
|
|
770
|
-
uvIndices: uvIndices,
|
|
771
|
-
polyIndices: polyIndices,
|
|
772
|
-
uvs: uvs,
|
|
773
|
-
};
|
|
774
|
-
|
|
775
|
-
} else {
|
|
776
|
-
|
|
777
|
-
if ( ! this.currentLayer.uvs ) this.currentLayer.uvs = {};
|
|
778
|
-
|
|
779
|
-
this.currentLayer.uvs[ name ] = {
|
|
780
|
-
uvIndices: uvIndices,
|
|
781
|
-
uvs: uvs,
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
},
|
|
787
|
-
|
|
788
|
-
parseMorphTargets( name, finalOffset, type ) {
|
|
789
|
-
|
|
790
|
-
var indices = [];
|
|
791
|
-
var points = [];
|
|
792
|
-
|
|
793
|
-
type = ( type === 'MORF' ) ? 'relative' : 'absolute';
|
|
794
|
-
|
|
795
|
-
while ( this.reader.offset < finalOffset ) {
|
|
796
|
-
|
|
797
|
-
indices.push( this.reader.getVariableLengthIndex() );
|
|
798
|
-
// z -> -z to match three.js right handed coords
|
|
799
|
-
points.push( this.reader.getFloat32(), this.reader.getFloat32(), - this.reader.getFloat32() );
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if ( ! this.currentLayer.morphTargets ) this.currentLayer.morphTargets = {};
|
|
804
|
-
|
|
805
|
-
this.currentLayer.morphTargets[ name ] = {
|
|
806
|
-
indices: indices,
|
|
807
|
-
points: points,
|
|
808
|
-
type: type,
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
},
|
|
812
|
-
|
|
813
|
-
// A list of polygons for the current layer.
|
|
814
|
-
// POLS { type[ID4], ( numvert+flags[U2], vert[VX] # numvert ) * }
|
|
815
|
-
parsePolygonList( length ) {
|
|
816
|
-
|
|
817
|
-
var finalOffset = this.reader.offset + length;
|
|
818
|
-
var type = this.reader.getIDTag();
|
|
819
|
-
|
|
820
|
-
var indices = [];
|
|
821
|
-
|
|
822
|
-
// hold a list of polygon sizes, to be split up later
|
|
823
|
-
var polygonDimensions = [];
|
|
824
|
-
|
|
825
|
-
while ( this.reader.offset < finalOffset ) {
|
|
826
|
-
|
|
827
|
-
var numverts = this.reader.getUint16();
|
|
828
|
-
|
|
829
|
-
//var flags = numverts & 64512; // 6 high order bits are flags - ignoring for now
|
|
830
|
-
numverts = numverts & 1023; // remaining ten low order bits are vertex num
|
|
831
|
-
polygonDimensions.push( numverts );
|
|
832
|
-
|
|
833
|
-
for ( var j = 0; j < numverts; j ++ ) indices.push( this.reader.getVariableLengthIndex() );
|
|
834
|
-
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
var geometryData = {
|
|
838
|
-
type: type,
|
|
839
|
-
vertexIndices: indices,
|
|
840
|
-
polygonDimensions: polygonDimensions,
|
|
841
|
-
points: this.currentPoints
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
// Note: assuming that all polys will be lines or points if the first is
|
|
845
|
-
if ( polygonDimensions[ 0 ] === 1 ) geometryData.type = 'points';
|
|
846
|
-
else if ( polygonDimensions[ 0 ] === 2 ) geometryData.type = 'lines';
|
|
847
|
-
|
|
848
|
-
this.currentLayer.geometry = geometryData;
|
|
849
|
-
|
|
850
|
-
},
|
|
851
|
-
|
|
852
|
-
// Lists the tag strings that can be associated with polygons by the PTAG chunk.
|
|
853
|
-
// TAGS { tag-string[S0] * }
|
|
854
|
-
parseTagStrings( length ) {
|
|
855
|
-
|
|
856
|
-
this.tree.tags = this.reader.getStringArray( length );
|
|
857
|
-
|
|
858
|
-
},
|
|
859
|
-
|
|
860
|
-
// Associates tags of a given type with polygons in the most recent POLS chunk.
|
|
861
|
-
// PTAG { type[ID4], ( poly[VX], tag[U2] ) * }
|
|
862
|
-
parsePolygonTagMapping( length ) {
|
|
863
|
-
|
|
864
|
-
var finalOffset = this.reader.offset + length;
|
|
865
|
-
var type = this.reader.getIDTag();
|
|
866
|
-
if ( type === 'SURF' ) this.parseMaterialIndices( finalOffset );
|
|
867
|
-
else { //PART, SMGP, COLR not supported
|
|
868
|
-
|
|
869
|
-
this.reader.skip( length - 4 );
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
},
|
|
874
|
-
|
|
875
|
-
parseMaterialIndices( finalOffset ) {
|
|
876
|
-
|
|
877
|
-
// array holds polygon index followed by material index
|
|
878
|
-
this.currentLayer.geometry.materialIndices = [];
|
|
879
|
-
|
|
880
|
-
while ( this.reader.offset < finalOffset ) {
|
|
881
|
-
|
|
882
|
-
var polygonIndex = this.reader.getVariableLengthIndex();
|
|
883
|
-
var materialIndex = this.reader.getUint16();
|
|
884
|
-
|
|
885
|
-
this.currentLayer.geometry.materialIndices.push( polygonIndex, materialIndex );
|
|
886
|
-
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
},
|
|
890
|
-
|
|
891
|
-
parseUnknownCHUNK( blockID, length ) {
|
|
892
|
-
|
|
893
|
-
console.warn( 'LWOLoader: unknown chunk type: ' + blockID + ' length: ' + length );
|
|
894
|
-
|
|
895
|
-
// print the chunk plus some bytes padding either side
|
|
896
|
-
// printBuffer( this.reader.dv.buffer, this.reader.offset - 20, length + 40 );
|
|
897
|
-
|
|
898
|
-
var data = this.reader.getString( length );
|
|
899
|
-
|
|
900
|
-
this.currentForm[ blockID ] = data;
|
|
901
|
-
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
function DataViewReader( buffer ) {
|
|
907
|
-
|
|
908
|
-
this.dv = new DataView( buffer );
|
|
909
|
-
this.offset = 0;
|
|
910
|
-
this._textDecoder = new TextDecoder();
|
|
911
|
-
this._bytes = new Uint8Array( buffer );
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
DataViewReader.prototype = {
|
|
916
|
-
|
|
917
|
-
constructor: DataViewReader,
|
|
918
|
-
|
|
919
|
-
size: function () {
|
|
920
|
-
|
|
921
|
-
return this.dv.buffer.byteLength;
|
|
922
|
-
|
|
923
|
-
},
|
|
924
|
-
|
|
925
|
-
setOffset( offset ) {
|
|
926
|
-
|
|
927
|
-
if ( offset > 0 && offset < this.dv.buffer.byteLength ) {
|
|
928
|
-
|
|
929
|
-
this.offset = offset;
|
|
930
|
-
|
|
931
|
-
} else {
|
|
932
|
-
|
|
933
|
-
console.error( 'LWOLoader: invalid buffer offset' );
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
},
|
|
938
|
-
|
|
939
|
-
endOfFile: function () {
|
|
940
|
-
|
|
941
|
-
if ( this.offset >= this.size() ) return true;
|
|
942
|
-
return false;
|
|
943
|
-
|
|
944
|
-
},
|
|
945
|
-
|
|
946
|
-
skip: function ( length ) {
|
|
947
|
-
|
|
948
|
-
this.offset += length;
|
|
949
|
-
|
|
950
|
-
},
|
|
951
|
-
|
|
952
|
-
getUint8: function () {
|
|
953
|
-
|
|
954
|
-
var value = this.dv.getUint8( this.offset );
|
|
955
|
-
this.offset += 1;
|
|
956
|
-
return value;
|
|
957
|
-
|
|
958
|
-
},
|
|
959
|
-
|
|
960
|
-
getUint16: function () {
|
|
961
|
-
|
|
962
|
-
var value = this.dv.getUint16( this.offset );
|
|
963
|
-
this.offset += 2;
|
|
964
|
-
return value;
|
|
965
|
-
|
|
966
|
-
},
|
|
967
|
-
|
|
968
|
-
getInt32: function () {
|
|
969
|
-
|
|
970
|
-
var value = this.dv.getInt32( this.offset, false );
|
|
971
|
-
this.offset += 4;
|
|
972
|
-
return value;
|
|
973
|
-
|
|
974
|
-
},
|
|
975
|
-
|
|
976
|
-
getUint32: function () {
|
|
977
|
-
|
|
978
|
-
var value = this.dv.getUint32( this.offset, false );
|
|
979
|
-
this.offset += 4;
|
|
980
|
-
return value;
|
|
981
|
-
|
|
982
|
-
},
|
|
983
|
-
|
|
984
|
-
getUint64: function () {
|
|
985
|
-
|
|
986
|
-
var low, high;
|
|
987
|
-
|
|
988
|
-
high = this.getUint32();
|
|
989
|
-
low = this.getUint32();
|
|
990
|
-
return high * 0x100000000 + low;
|
|
991
|
-
|
|
992
|
-
},
|
|
993
|
-
|
|
994
|
-
getFloat32: function () {
|
|
995
|
-
|
|
996
|
-
var value = this.dv.getFloat32( this.offset, false );
|
|
997
|
-
this.offset += 4;
|
|
998
|
-
return value;
|
|
999
|
-
|
|
1000
|
-
},
|
|
1001
|
-
|
|
1002
|
-
getFloat32Array: function ( size ) {
|
|
1003
|
-
|
|
1004
|
-
var a = [];
|
|
1005
|
-
|
|
1006
|
-
for ( var i = 0; i < size; i ++ ) {
|
|
1007
|
-
|
|
1008
|
-
a.push( this.getFloat32() );
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
return a;
|
|
1013
|
-
|
|
1014
|
-
},
|
|
1015
|
-
|
|
1016
|
-
getFloat64: function () {
|
|
1017
|
-
|
|
1018
|
-
var value = this.dv.getFloat64( this.offset, this.littleEndian );
|
|
1019
|
-
this.offset += 8;
|
|
1020
|
-
return value;
|
|
1021
|
-
|
|
1022
|
-
},
|
|
1023
|
-
|
|
1024
|
-
getFloat64Array: function ( size ) {
|
|
1025
|
-
|
|
1026
|
-
var a = [];
|
|
1027
|
-
|
|
1028
|
-
for ( var i = 0; i < size; i ++ ) {
|
|
1029
|
-
|
|
1030
|
-
a.push( this.getFloat64() );
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
return a;
|
|
1035
|
-
|
|
1036
|
-
},
|
|
1037
|
-
|
|
1038
|
-
// get variable-length index data type
|
|
1039
|
-
// VX ::= index[U2] | (index + 0xFF000000)[U4]
|
|
1040
|
-
// If the index value is less than 65,280 (0xFF00),then VX === U2
|
|
1041
|
-
// otherwise VX === U4 with bits 24-31 set
|
|
1042
|
-
// When reading an index, if the first byte encountered is 255 (0xFF), then
|
|
1043
|
-
// the four-byte form is being used and the first byte should be discarded or masked out.
|
|
1044
|
-
getVariableLengthIndex() {
|
|
1045
|
-
|
|
1046
|
-
var firstByte = this.getUint8();
|
|
1047
|
-
|
|
1048
|
-
if ( firstByte === 255 ) {
|
|
1049
|
-
|
|
1050
|
-
return this.getUint8() * 65536 + this.getUint8() * 256 + this.getUint8();
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
return firstByte * 256 + this.getUint8();
|
|
1055
|
-
|
|
1056
|
-
},
|
|
1057
|
-
|
|
1058
|
-
// An ID tag is a sequence of 4 bytes containing 7-bit ASCII values
|
|
1059
|
-
getIDTag() {
|
|
1060
|
-
|
|
1061
|
-
return this.getString( 4 );
|
|
1062
|
-
|
|
1063
|
-
},
|
|
1064
|
-
|
|
1065
|
-
getString: function ( size ) {
|
|
1066
|
-
|
|
1067
|
-
if ( size === 0 ) return;
|
|
1068
|
-
|
|
1069
|
-
const start = this.offset;
|
|
1070
|
-
|
|
1071
|
-
let result;
|
|
1072
|
-
let length;
|
|
1073
|
-
|
|
1074
|
-
if ( size ) {
|
|
1075
|
-
|
|
1076
|
-
length = size;
|
|
1077
|
-
result = this._textDecoder.decode( new Uint8Array( this.dv.buffer, start, size ) );
|
|
1078
|
-
|
|
1079
|
-
} else {
|
|
1080
|
-
|
|
1081
|
-
// use 1:1 mapping of buffer to avoid redundant new array creation.
|
|
1082
|
-
length = this._bytes.indexOf( 0, start ) - start;
|
|
1083
|
-
|
|
1084
|
-
result = this._textDecoder.decode( new Uint8Array( this.dv.buffer, start, length ) );
|
|
1085
|
-
|
|
1086
|
-
// account for null byte in length
|
|
1087
|
-
length ++;
|
|
1088
|
-
|
|
1089
|
-
// if string with terminating nullbyte is uneven, extra nullbyte is added, skip that too
|
|
1090
|
-
length += length % 2;
|
|
1091
|
-
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
this.skip( length );
|
|
1095
|
-
|
|
1096
|
-
return result;
|
|
1097
|
-
|
|
1098
|
-
},
|
|
1099
|
-
|
|
1100
|
-
getStringArray: function ( size ) {
|
|
1101
|
-
|
|
1102
|
-
var a = this.getString( size );
|
|
1103
|
-
a = a.split( '\0' );
|
|
1104
|
-
|
|
1105
|
-
return a.filter( Boolean ); // return array with any empty strings removed
|
|
1106
|
-
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
};
|
|
1110
|
-
|
|
1111
|
-
// ************** DEBUGGER **************
|
|
1112
|
-
|
|
1113
|
-
function Debugger( ) {
|
|
1114
|
-
|
|
1115
|
-
this.active = false;
|
|
1116
|
-
this.depth = 0;
|
|
1117
|
-
this.formList = [];
|
|
1118
|
-
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
Debugger.prototype = {
|
|
1122
|
-
|
|
1123
|
-
constructor: Debugger,
|
|
1124
|
-
|
|
1125
|
-
enable: function () {
|
|
1126
|
-
|
|
1127
|
-
this.active = true;
|
|
1128
|
-
|
|
1129
|
-
},
|
|
1130
|
-
|
|
1131
|
-
log: function () {
|
|
1132
|
-
|
|
1133
|
-
if ( ! this.active ) return;
|
|
1134
|
-
|
|
1135
|
-
var nodeType;
|
|
1136
|
-
|
|
1137
|
-
switch ( this.node ) {
|
|
1138
|
-
|
|
1139
|
-
case 0:
|
|
1140
|
-
nodeType = 'FORM';
|
|
1141
|
-
break;
|
|
1142
|
-
|
|
1143
|
-
case 1:
|
|
1144
|
-
nodeType = 'CHK';
|
|
1145
|
-
break;
|
|
1146
|
-
|
|
1147
|
-
case 2:
|
|
1148
|
-
nodeType = 'S-CHK';
|
|
1149
|
-
break;
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
console.log(
|
|
1154
|
-
'| '.repeat( this.depth ) +
|
|
1155
|
-
nodeType,
|
|
1156
|
-
this.nodeID,
|
|
1157
|
-
`( ${this.offset} ) -> ( ${this.dataOffset + this.length} )`,
|
|
1158
|
-
( ( this.node == 0 ) ? ' {' : '' ),
|
|
1159
|
-
( ( this.skipped ) ? 'SKIPPED' : '' ),
|
|
1160
|
-
( ( this.node == 0 && this.skipped ) ? '}' : '' )
|
|
1161
|
-
);
|
|
1162
|
-
|
|
1163
|
-
if ( this.node == 0 && ! this.skipped ) {
|
|
1164
|
-
|
|
1165
|
-
this.depth += 1;
|
|
1166
|
-
this.formList.push( this.dataOffset + this.length );
|
|
1167
|
-
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
this.skipped = false;
|
|
1171
|
-
|
|
1172
|
-
},
|
|
1173
|
-
|
|
1174
|
-
closeForms: function () {
|
|
1175
|
-
|
|
1176
|
-
if ( ! this.active ) return;
|
|
1177
|
-
|
|
1178
|
-
for ( var i = this.formList.length - 1; i >= 0; i -- ) {
|
|
1179
|
-
|
|
1180
|
-
if ( this.offset >= this.formList[ i ] ) {
|
|
1181
|
-
|
|
1182
|
-
this.depth -= 1;
|
|
1183
|
-
console.log( '| '.repeat( this.depth ) + '}' );
|
|
1184
|
-
this.formList.splice( - 1, 1 );
|
|
1185
|
-
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
|
-
// ************** UTILITY FUNCTIONS **************
|
|
1195
|
-
|
|
1196
|
-
function isEven( num ) {
|
|
1197
|
-
|
|
1198
|
-
return num % 2;
|
|
1199
|
-
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
// calculate the length of the string in the buffer
|
|
1203
|
-
// this will be string.length + nullbyte + optional padbyte to make the length even
|
|
1204
|
-
function stringOffset( string ) {
|
|
1205
|
-
|
|
1206
|
-
return string.length + 1 + ( isEven( string.length + 1 ) ? 1 : 0 );
|
|
1207
|
-
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
// for testing purposes, dump buffer to console
|
|
1211
|
-
// printBuffer( this.reader.dv.buffer, this.reader.offset, length );
|
|
1212
|
-
function printBuffer( buffer, from, to ) {
|
|
1213
|
-
|
|
1214
|
-
console.log( new TextDecoder().decode( new Uint8Array( buffer, from, to ) ) );
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
export { IFFParser };
|