@babylonjs/core 6.24.0 → 6.25.1
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/Buffers/buffer.align.d.ts +25 -0
- package/Buffers/buffer.align.js +120 -0
- package/Buffers/buffer.align.js.map +1 -0
- package/Buffers/buffer.d.ts +15 -3
- package/Buffers/buffer.js +27 -7
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/index.d.ts +1 -0
- package/Buffers/index.js +1 -0
- package/Buffers/index.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +0 -3
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +1 -4
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +0 -6
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/RigModes/index.d.ts +0 -1
- package/Cameras/RigModes/index.js +0 -1
- package/Cameras/RigModes/index.js.map +1 -1
- package/Cameras/RigModes/vrRigMode.js +1 -1
- package/Cameras/RigModes/vrRigMode.js.map +1 -1
- package/Cameras/VR/index.d.ts +0 -1
- package/Cameras/VR/index.js +0 -1
- package/Cameras/VR/index.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +7 -66
- package/Cameras/VR/vrExperienceHelper.js +17 -702
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/camera.d.ts +15 -20
- package/Cameras/camera.js +41 -36
- package/Cameras/camera.js.map +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/index.d.ts +0 -1
- package/Engines/Extensions/index.js +0 -1
- package/Engines/Extensions/index.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +4 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +8 -7
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +4 -10
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/constants.d.ts +0 -4
- package/Engines/constants.js +0 -4
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +38 -258
- package/Engines/engine.js +0 -65
- package/Engines/engine.js.map +1 -1
- package/Engines/engineFactory.js +9 -14
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/engineFeatures.d.ts +2 -0
- package/Engines/engineFeatures.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +22 -5
- package/Engines/thinEngine.js +55 -22
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +9 -14
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +9 -8
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +34 -16
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +4 -3
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +14 -6
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +19 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +64 -27
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +39 -41
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +152 -74
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +13 -12
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +42 -21
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +17 -13
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +62 -26
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +13 -9
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +46 -18
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +10 -5
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +6 -2
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -3
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +11 -6
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +7 -2
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +7 -2
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +6 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +22 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +7 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +15 -10
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +7 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +14 -7
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +9 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +41 -3
- package/FlowGraph/flowGraph.js +135 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +2 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -2
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +15 -3
- package/FlowGraph/flowGraphBlock.js +50 -7
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +34 -4
- package/FlowGraph/flowGraphConnection.js +49 -3
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +25 -5
- package/FlowGraph/flowGraphContext.js +86 -4
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +7 -1
- package/FlowGraph/flowGraphCoordinator.js +18 -2
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +4 -11
- package/FlowGraph/flowGraphDataConnection.js +16 -14
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.d.ts +8 -3
- package/FlowGraph/flowGraphExecutionBlock.js +37 -6
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +5 -9
- package/FlowGraph/flowGraphRichTypes.js +29 -44
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +2 -0
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/flowGraphVariableDefinitions.d.ts +22 -2
- package/FlowGraph/flowGraphVariableDefinitions.js +29 -0
- package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -1
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +2 -1
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +2 -2
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
- package/Gamepads/gamepadManager.js +0 -5
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gamepads/index.d.ts +0 -1
- package/Gamepads/index.js +0 -2
- package/Gamepads/index.js.map +1 -1
- package/Gizmos/gizmo.js +1 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +24 -0
- package/Materials/GreasedLine/greasedLineMaterialDefaults.js +19 -0
- package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +243 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +55 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +253 -0
- package/Materials/{greasedLinePluginMaterial.js → GreasedLine/greasedLinePluginMaterial.js} +148 -205
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -0
- package/Materials/{greasedLineSimpleMaterial.d.ts → GreasedLine/greasedLineSimpleMaterial.d.ts} +20 -48
- package/Materials/{greasedLineSimpleMaterial.js → GreasedLine/greasedLineSimpleMaterial.js} +74 -91
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +2 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Textures/texture.js +1 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/index.d.ts +4 -1
- package/Materials/index.js +4 -1
- package/Materials/index.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +1 -0
- package/Materials/shadowDepthWrapper.js +17 -4
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Maths/math.vector.d.ts +32 -22
- package/Maths/math.vector.js +54 -43
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +7 -6
- package/Meshes/Builders/greasedLineBuilder.js +65 -31
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompression.js +7 -7
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +2 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +216 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +247 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineMesh.d.ts +93 -0
- package/Meshes/{greasedLineMesh.js → GreasedLine/greasedLineMesh.js} +29 -223
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +107 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +462 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +9 -2
- package/Meshes/Node/Blocks/Sources/meshBlock.js +17 -5
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +15 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +50 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +5 -5
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +1 -2
- package/Meshes/Node/nodeGeometry.js +5 -6
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +1 -2
- package/Meshes/Node/nodeGeometryBlock.js +1 -2
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/geometry.js +6 -12
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/index.d.ts +3 -1
- package/Meshes/index.js +3 -1
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.js +9 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +4 -0
- package/Meshes/mesh.js +10 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/basis.js +4 -4
- package/Misc/basis.js.map +1 -1
- package/Misc/deepCopier.js +3 -0
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/fileTools.d.ts +2 -0
- package/Misc/fileTools.js +12 -3
- package/Misc/fileTools.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +52 -5
- package/Misc/greasedLineTools.js +180 -10
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +21 -24
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/tools.d.ts +42 -2
- package/Misc/tools.js +102 -2
- package/Misc/tools.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +1 -1
- package/Particles/solidParticleSystem.js +2 -2
- package/Particles/solidParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +4 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +1 -6
- package/PostProcesses/postProcess.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +4 -0
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +1 -2
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
- package/Shaders/greasedLine.fragment.js +2 -5
- package/Shaders/greasedLine.fragment.js.map +1 -1
- package/Shaders/greasedLine.vertex.js +15 -4
- package/Shaders/greasedLine.vertex.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +1 -1
- package/XR/webXRDefaultExperience.js +1 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +17 -10
- package/scene.js +25 -30
- package/scene.js.map +1 -1
- package/Cameras/RigModes/webVRRigMode.d.ts +0 -5
- package/Cameras/RigModes/webVRRigMode.js +0 -34
- package/Cameras/RigModes/webVRRigMode.js.map +0 -1
- package/Cameras/VR/webVRCamera.d.ts +0 -316
- package/Cameras/VR/webVRCamera.js +0 -618
- package/Cameras/VR/webVRCamera.js.map +0 -1
- package/Engines/Extensions/engine.webVR.d.ts +0 -91
- package/Engines/Extensions/engine.webVR.js +0 -195
- package/Engines/Extensions/engine.webVR.js.map +0 -1
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +0 -23
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +0 -18
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +0 -1
- package/Gamepads/Controllers/daydreamController.d.ts +0 -38
- package/Gamepads/Controllers/daydreamController.js +0 -70
- package/Gamepads/Controllers/daydreamController.js.map +0 -1
- package/Gamepads/Controllers/gearVRController.d.ts +0 -39
- package/Gamepads/Controllers/gearVRController.js +0 -79
- package/Gamepads/Controllers/gearVRController.js.map +0 -1
- package/Gamepads/Controllers/genericController.d.ts +0 -34
- package/Gamepads/Controllers/genericController.js +0 -48
- package/Gamepads/Controllers/genericController.js.map +0 -1
- package/Gamepads/Controllers/index.d.ts +0 -8
- package/Gamepads/Controllers/index.js +0 -9
- package/Gamepads/Controllers/index.js.map +0 -1
- package/Gamepads/Controllers/oculusTouchController.d.ts +0 -78
- package/Gamepads/Controllers/oculusTouchController.js +0 -196
- package/Gamepads/Controllers/oculusTouchController.js.map +0 -1
- package/Gamepads/Controllers/poseEnabledController.d.ts +0 -219
- package/Gamepads/Controllers/poseEnabledController.js +0 -293
- package/Gamepads/Controllers/poseEnabledController.js.map +0 -1
- package/Gamepads/Controllers/viveController.d.ts +0 -52
- package/Gamepads/Controllers/viveController.js +0 -115
- package/Gamepads/Controllers/viveController.js.map +0 -1
- package/Gamepads/Controllers/webVRController.d.ts +0 -85
- package/Gamepads/Controllers/webVRController.js +0 -122
- package/Gamepads/Controllers/webVRController.js.map +0 -1
- package/Gamepads/Controllers/windowsMotionController.d.ts +0 -212
- package/Gamepads/Controllers/windowsMotionController.js +0 -519
- package/Gamepads/Controllers/windowsMotionController.js.map +0 -1
- package/Materials/greasedLinePluginMaterial.d.ts +0 -496
- package/Materials/greasedLinePluginMaterial.js.map +0 -1
- package/Materials/greasedLineSimpleMaterial.js.map +0 -1
- package/Meshes/greasedLineMesh.d.ts +0 -204
- package/Meshes/greasedLineMesh.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Nullable } from "../types.js";
|
|
2
|
+
import type { DataBuffer } from "./dataBuffer";
|
|
3
|
+
declare module "./buffer" {
|
|
4
|
+
interface VertexBuffer {
|
|
5
|
+
/**
|
|
6
|
+
* Gets the effective byte stride, that is the byte stride of the buffer that is actually sent to the GPU.
|
|
7
|
+
* It could be different from VertexBuffer.byteStride if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.
|
|
8
|
+
*/
|
|
9
|
+
effectiveByteStride: number;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the effective byte offset, that is the byte offset of the buffer that is actually sent to the GPU.
|
|
12
|
+
* It could be different from VertexBuffer.byteOffset if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.
|
|
13
|
+
*/
|
|
14
|
+
effectiveByteOffset: number;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the effective buffer, that is the buffer that is actually sent to the GPU.
|
|
17
|
+
* It could be different from VertexBuffer.getBuffer() if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.
|
|
18
|
+
*/
|
|
19
|
+
effectiveBuffer: Nullable<DataBuffer>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
_alignBuffer(): void;
|
|
22
|
+
/** @internal */
|
|
23
|
+
_alignedBuffer?: Buffer;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Buffer, VertexBuffer } from "./buffer.js";
|
|
2
|
+
const isLittleEndian = (() => {
|
|
3
|
+
const array = new Uint8Array(4);
|
|
4
|
+
const view = new Uint32Array(array.buffer);
|
|
5
|
+
return !!((view[0] = 1) & array[0]);
|
|
6
|
+
})();
|
|
7
|
+
Object.defineProperty(VertexBuffer.prototype, "effectiveByteStride", {
|
|
8
|
+
get: function () {
|
|
9
|
+
return (this._alignedBuffer && this._alignedBuffer.byteStride) || this.byteStride;
|
|
10
|
+
},
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(VertexBuffer.prototype, "effectiveByteOffset", {
|
|
15
|
+
get: function () {
|
|
16
|
+
return this._alignedBuffer ? 0 : this.byteOffset;
|
|
17
|
+
},
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(VertexBuffer.prototype, "effectiveBuffer", {
|
|
22
|
+
get: function () {
|
|
23
|
+
return (this._alignedBuffer && this._alignedBuffer.getBuffer()) || this._buffer.getBuffer();
|
|
24
|
+
},
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
});
|
|
28
|
+
VertexBuffer.prototype._rebuild = function () {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
(_a = this._buffer) === null || _a === void 0 ? void 0 : _a._rebuild();
|
|
31
|
+
(_b = this._alignedBuffer) === null || _b === void 0 ? void 0 : _b._rebuild();
|
|
32
|
+
};
|
|
33
|
+
VertexBuffer.prototype.dispose = function () {
|
|
34
|
+
var _a;
|
|
35
|
+
if (this._ownsBuffer) {
|
|
36
|
+
this._buffer.dispose();
|
|
37
|
+
}
|
|
38
|
+
(_a = this._alignedBuffer) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
39
|
+
this._alignedBuffer = undefined;
|
|
40
|
+
this._isDisposed = true;
|
|
41
|
+
};
|
|
42
|
+
VertexBuffer.prototype._alignBuffer = function () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const data = this._buffer.getData();
|
|
45
|
+
if (!this.engine._features.forceVertexBufferStrideMultiple4Bytes || this.byteStride % 4 === 0 || !data) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const typeByteLength = VertexBuffer.GetTypeByteLength(this.type);
|
|
49
|
+
const alignedByteStride = (this.byteStride + 3) & ~3;
|
|
50
|
+
const alignedSize = alignedByteStride / typeByteLength;
|
|
51
|
+
const totalVertices = this.totalVertices;
|
|
52
|
+
const totalByteLength = totalVertices * alignedByteStride;
|
|
53
|
+
const totalLength = totalByteLength / typeByteLength;
|
|
54
|
+
let sourceData;
|
|
55
|
+
if (Array.isArray(data)) {
|
|
56
|
+
const sourceDataAsFloat = new Float32Array(data);
|
|
57
|
+
sourceData = new DataView(sourceDataAsFloat.buffer, sourceDataAsFloat.byteOffset, sourceDataAsFloat.byteLength);
|
|
58
|
+
}
|
|
59
|
+
else if (data instanceof ArrayBuffer) {
|
|
60
|
+
sourceData = new DataView(data, 0, data.byteLength);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
sourceData = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
64
|
+
}
|
|
65
|
+
let alignedData;
|
|
66
|
+
if (this.type === VertexBuffer.BYTE) {
|
|
67
|
+
alignedData = new Int8Array(totalLength);
|
|
68
|
+
}
|
|
69
|
+
else if (this.type === VertexBuffer.UNSIGNED_BYTE) {
|
|
70
|
+
alignedData = new Uint8Array(totalLength);
|
|
71
|
+
}
|
|
72
|
+
else if (this.type === VertexBuffer.SHORT) {
|
|
73
|
+
alignedData = new Int16Array(totalLength);
|
|
74
|
+
}
|
|
75
|
+
else if (this.type === VertexBuffer.UNSIGNED_SHORT) {
|
|
76
|
+
alignedData = new Uint16Array(totalLength);
|
|
77
|
+
}
|
|
78
|
+
else if (this.type === VertexBuffer.INT) {
|
|
79
|
+
alignedData = new Int32Array(totalLength);
|
|
80
|
+
}
|
|
81
|
+
else if (this.type === VertexBuffer.UNSIGNED_INT) {
|
|
82
|
+
alignedData = new Uint32Array(totalLength);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
alignedData = new Float32Array(totalLength);
|
|
86
|
+
}
|
|
87
|
+
const numComponents = this.getSize();
|
|
88
|
+
let sourceOffset = this.byteOffset;
|
|
89
|
+
for (let i = 0; i < totalVertices; ++i) {
|
|
90
|
+
for (let j = 0; j < numComponents; ++j) {
|
|
91
|
+
switch (this.type) {
|
|
92
|
+
case VertexBuffer.BYTE:
|
|
93
|
+
alignedData[i * alignedSize + j] = sourceData.getInt8(sourceOffset + j);
|
|
94
|
+
break;
|
|
95
|
+
case VertexBuffer.UNSIGNED_BYTE:
|
|
96
|
+
alignedData[i * alignedSize + j] = sourceData.getUint8(sourceOffset + j);
|
|
97
|
+
break;
|
|
98
|
+
case VertexBuffer.SHORT:
|
|
99
|
+
alignedData[i * alignedSize + j] = sourceData.getInt16(sourceOffset + j * 2, isLittleEndian);
|
|
100
|
+
break;
|
|
101
|
+
case VertexBuffer.UNSIGNED_SHORT:
|
|
102
|
+
alignedData[i * alignedSize + j] = sourceData.getUint16(sourceOffset + j * 2, isLittleEndian);
|
|
103
|
+
break;
|
|
104
|
+
case VertexBuffer.INT:
|
|
105
|
+
alignedData[i * alignedSize + j] = sourceData.getInt32(sourceOffset + j * 4, isLittleEndian);
|
|
106
|
+
break;
|
|
107
|
+
case VertexBuffer.UNSIGNED_INT:
|
|
108
|
+
alignedData[i * alignedSize + j] = sourceData.getUint32(sourceOffset + j * 4, isLittleEndian);
|
|
109
|
+
break;
|
|
110
|
+
case VertexBuffer.FLOAT:
|
|
111
|
+
alignedData[i * alignedSize + j] = sourceData.getFloat32(sourceOffset + j * 4, isLittleEndian);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
sourceOffset += this.byteStride;
|
|
116
|
+
}
|
|
117
|
+
(_a = this._alignedBuffer) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
118
|
+
this._alignedBuffer = new Buffer(this.engine, alignedData, false, alignedByteStride, false, this.getIsInstanced(), true, this.instanceDivisor, ((_b = this._label) !== null && _b !== void 0 ? _b : "VertexBuffer") + "_aligned");
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=buffer.align.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer.align.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/buffer.align.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IACzB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC,EAAE,CAAC;AA8BL,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,SAAS,EAAE,qBAAqB,EAAE;IACjE,GAAG,EAAE;QACD,OAAO,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC;IACtF,CAAC;IACD,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,SAAS,EAAE,qBAAqB,EAAE;IACjE,GAAG,EAAE;QACD,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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,cAAc;oBAC5B,WAAW,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC;oBAC9F,MAAM;gBACV,KAAK,YAAY,CAAC,GAAG;oBACjB,WAAW,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC;oBAC7F,MAAM;gBACV,KAAK,YAAY,CAAC,YAAY;oBAC1B,WAAW,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC;oBAC9F,MAAM;gBACV,KAAK,YAAY,CAAC,KAAK;oBACnB,WAAW,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC;oBAC/F,MAAM;aACb;SACJ;QACD,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC;KACnC;IAED,MAAA,IAAI,CAAC,cAAc,0CAAE,OAAO,EAAE,CAAC;IAC/B,IAAI,CAAC,cAAc,GAAG,IAAI,MAAM,CAC5B,IAAI,CAAC,MAAM,EACX,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,KAAK,EACL,IAAI,CAAC,cAAc,EAAE,EACrB,IAAI,EACJ,IAAI,CAAC,eAAe,EACpB,CAAC,MAAA,IAAI,CAAC,MAAM,mCAAI,cAAc,CAAC,GAAG,UAAU,CAC/C,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { DataBuffer } from \"./dataBuffer\";\r\nimport { Buffer, VertexBuffer } from \"./buffer\";\r\n\r\nconst isLittleEndian = (() => {\r\n const array = new Uint8Array(4);\r\n const view = new Uint32Array(array.buffer);\r\n\r\n return !!((view[0] = 1) & array[0]);\r\n})();\r\n\r\ndeclare module \"./buffer\" {\r\n export interface VertexBuffer {\r\n /**\r\n * Gets the effective byte stride, that is the byte stride of the buffer that is actually sent to the GPU.\r\n * It could be different from VertexBuffer.byteStride if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.\r\n */\r\n effectiveByteStride: number;\r\n\r\n /**\r\n * Gets the effective byte offset, that is the byte offset of the buffer that is actually sent to the GPU.\r\n * It could be different from VertexBuffer.byteOffset if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.\r\n */\r\n effectiveByteOffset: number;\r\n\r\n /**\r\n * Gets the effective buffer, that is the buffer that is actually sent to the GPU.\r\n * It could be different from VertexBuffer.getBuffer() if a new buffer must be created under the hood because of the forceVertexBufferStrideMultiple4Bytes engine flag.\r\n */\r\n effectiveBuffer: Nullable<DataBuffer>;\r\n\r\n /** @internal */\r\n _alignBuffer(): void;\r\n\r\n /** @internal */\r\n _alignedBuffer?: Buffer;\r\n }\r\n}\r\n\r\nObject.defineProperty(VertexBuffer.prototype, \"effectiveByteStride\", {\r\n get: function (this: VertexBuffer) {\r\n return (this._alignedBuffer && this._alignedBuffer.byteStride) || this.byteStride;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(VertexBuffer.prototype, \"effectiveByteOffset\", {\r\n get: function (this: VertexBuffer) {\r\n return this._alignedBuffer ? 0 : this.byteOffset;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(VertexBuffer.prototype, \"effectiveBuffer\", {\r\n get: function (this: VertexBuffer) {\r\n return (this._alignedBuffer && this._alignedBuffer.getBuffer()) || this._buffer.getBuffer();\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nVertexBuffer.prototype._rebuild = function (): void {\r\n this._buffer?._rebuild();\r\n this._alignedBuffer?._rebuild();\r\n};\r\n\r\nVertexBuffer.prototype.dispose = function (): void {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n\r\n this._alignedBuffer?.dispose();\r\n this._alignedBuffer = undefined;\r\n\r\n this._isDisposed = true;\r\n};\r\n\r\nVertexBuffer.prototype._alignBuffer = function (): void {\r\n const data = this._buffer.getData();\r\n\r\n if (!this.engine._features.forceVertexBufferStrideMultiple4Bytes || this.byteStride % 4 === 0 || !data) {\r\n return;\r\n }\r\n\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n const alignedByteStride = (this.byteStride + 3) & ~3;\r\n const alignedSize = alignedByteStride / typeByteLength;\r\n const totalVertices = this.totalVertices;\r\n const totalByteLength = totalVertices * alignedByteStride;\r\n const totalLength = totalByteLength / typeByteLength;\r\n\r\n let sourceData: DataView;\r\n\r\n if (Array.isArray(data)) {\r\n const sourceDataAsFloat = new Float32Array(data);\r\n sourceData = new DataView(sourceDataAsFloat.buffer, sourceDataAsFloat.byteOffset, sourceDataAsFloat.byteLength);\r\n } else if (data instanceof ArrayBuffer) {\r\n sourceData = new DataView(data, 0, data.byteLength);\r\n } else {\r\n sourceData = new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n }\r\n\r\n let alignedData: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array;\r\n\r\n if (this.type === VertexBuffer.BYTE) {\r\n alignedData = new Int8Array(totalLength);\r\n } else if (this.type === VertexBuffer.UNSIGNED_BYTE) {\r\n alignedData = new Uint8Array(totalLength);\r\n } else if (this.type === VertexBuffer.SHORT) {\r\n alignedData = new Int16Array(totalLength);\r\n } else if (this.type === VertexBuffer.UNSIGNED_SHORT) {\r\n alignedData = new Uint16Array(totalLength);\r\n } else if (this.type === VertexBuffer.INT) {\r\n alignedData = new Int32Array(totalLength);\r\n } else if (this.type === VertexBuffer.UNSIGNED_INT) {\r\n alignedData = new Uint32Array(totalLength);\r\n } else {\r\n alignedData = new Float32Array(totalLength);\r\n }\r\n\r\n const numComponents = this.getSize();\r\n\r\n let sourceOffset = this.byteOffset;\r\n\r\n for (let i = 0; i < totalVertices; ++i) {\r\n for (let j = 0; j < numComponents; ++j) {\r\n switch (this.type) {\r\n case VertexBuffer.BYTE:\r\n alignedData[i * alignedSize + j] = sourceData.getInt8(sourceOffset + j);\r\n break;\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n alignedData[i * alignedSize + j] = sourceData.getUint8(sourceOffset + j);\r\n break;\r\n case VertexBuffer.SHORT:\r\n alignedData[i * alignedSize + j] = sourceData.getInt16(sourceOffset + j * 2, isLittleEndian);\r\n break;\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n alignedData[i * alignedSize + j] = sourceData.getUint16(sourceOffset + j * 2, isLittleEndian);\r\n break;\r\n case VertexBuffer.INT:\r\n alignedData[i * alignedSize + j] = sourceData.getInt32(sourceOffset + j * 4, isLittleEndian);\r\n break;\r\n case VertexBuffer.UNSIGNED_INT:\r\n alignedData[i * alignedSize + j] = sourceData.getUint32(sourceOffset + j * 4, isLittleEndian);\r\n break;\r\n case VertexBuffer.FLOAT:\r\n alignedData[i * alignedSize + j] = sourceData.getFloat32(sourceOffset + j * 4, isLittleEndian);\r\n break;\r\n }\r\n }\r\n sourceOffset += this.byteStride;\r\n }\r\n\r\n this._alignedBuffer?.dispose();\r\n this._alignedBuffer = new Buffer(\r\n this.engine,\r\n alignedData,\r\n false,\r\n alignedByteStride,\r\n false,\r\n this.getIsInstanced(),\r\n true,\r\n this.instanceDivisor,\r\n (this._label ?? \"VertexBuffer\") + \"_aligned\"\r\n );\r\n};\r\n"]}
|
package/Buffers/buffer.d.ts
CHANGED
|
@@ -162,10 +162,14 @@ export declare class VertexBuffer {
|
|
|
162
162
|
_validOffsetRange: boolean;
|
|
163
163
|
private _kind;
|
|
164
164
|
private _size;
|
|
165
|
-
|
|
165
|
+
/** @internal */
|
|
166
|
+
_ownsBuffer: boolean;
|
|
166
167
|
private _instanced;
|
|
167
168
|
private _instanceDivisor;
|
|
168
|
-
|
|
169
|
+
/** @internal */
|
|
170
|
+
_isDisposed: boolean;
|
|
171
|
+
/** @internal */
|
|
172
|
+
_label?: string;
|
|
169
173
|
/**
|
|
170
174
|
* The byte type.
|
|
171
175
|
*/
|
|
@@ -228,6 +232,14 @@ export declare class VertexBuffer {
|
|
|
228
232
|
* All buffers with the same format will have the same hash code
|
|
229
233
|
*/
|
|
230
234
|
readonly hashCode: number;
|
|
235
|
+
/**
|
|
236
|
+
* Gets the engine associated with the buffer
|
|
237
|
+
*/
|
|
238
|
+
readonly engine: ThinEngine;
|
|
239
|
+
/**
|
|
240
|
+
* Gets the number of vertices in the buffer
|
|
241
|
+
*/
|
|
242
|
+
get totalVertices(): number;
|
|
231
243
|
/**
|
|
232
244
|
* Constructor
|
|
233
245
|
* @param engine the engine
|
|
@@ -278,7 +290,7 @@ export declare class VertexBuffer {
|
|
|
278
290
|
* @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
|
|
279
291
|
* @returns a float array containing vertex data
|
|
280
292
|
*/
|
|
281
|
-
getFloatData(totalVertices
|
|
293
|
+
getFloatData(totalVertices?: number, forceCopy?: boolean): Nullable<FloatArray>;
|
|
282
294
|
/**
|
|
283
295
|
* Gets underlying native buffer
|
|
284
296
|
* @returns underlying native buffer
|
package/Buffers/buffer.js
CHANGED
|
@@ -213,12 +213,27 @@ export class VertexBuffer {
|
|
|
213
213
|
this._computeHashCode();
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets the number of vertices in the buffer
|
|
218
|
+
*/
|
|
219
|
+
get totalVertices() {
|
|
220
|
+
const data = this.getData();
|
|
221
|
+
if (!data) {
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
if (Array.isArray(data)) {
|
|
225
|
+
// data is a regular number[] with float values
|
|
226
|
+
return data.length / (this.byteStride / 4) - this.byteOffset / 4;
|
|
227
|
+
}
|
|
228
|
+
return (data.byteLength - this.byteOffset) / this.byteStride;
|
|
229
|
+
}
|
|
216
230
|
/** @internal */
|
|
217
231
|
constructor(engine, data, kind, updatableOrOptions, postponeInternalCreation, stride, instanced, offset, size, type, normalized = false, useBytes = false, divisor = 1, takeBufferOwnership = false) {
|
|
218
232
|
var _a, _b, _c, _d, _e;
|
|
233
|
+
/** @internal */
|
|
219
234
|
this._isDisposed = false;
|
|
220
235
|
let updatable = false;
|
|
221
|
-
|
|
236
|
+
this.engine = engine;
|
|
222
237
|
if (typeof updatableOrOptions === "object" && updatableOrOptions !== null) {
|
|
223
238
|
updatable = (_a = updatableOrOptions.updatable) !== null && _a !== void 0 ? _a : false;
|
|
224
239
|
postponeInternalCreation = updatableOrOptions.postponeInternalCreation;
|
|
@@ -231,7 +246,7 @@ export class VertexBuffer {
|
|
|
231
246
|
useBytes = (_c = updatableOrOptions.useBytes) !== null && _c !== void 0 ? _c : false;
|
|
232
247
|
divisor = (_d = updatableOrOptions.divisor) !== null && _d !== void 0 ? _d : 1;
|
|
233
248
|
takeBufferOwnership = (_e = updatableOrOptions.takeBufferOwnership) !== null && _e !== void 0 ? _e : false;
|
|
234
|
-
|
|
249
|
+
this._label = updatableOrOptions.label;
|
|
235
250
|
}
|
|
236
251
|
else {
|
|
237
252
|
updatable = !!updatableOrOptions;
|
|
@@ -241,7 +256,7 @@ export class VertexBuffer {
|
|
|
241
256
|
this._ownsBuffer = takeBufferOwnership;
|
|
242
257
|
}
|
|
243
258
|
else {
|
|
244
|
-
this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor,
|
|
259
|
+
this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor, this._label);
|
|
245
260
|
this._ownsBuffer = true;
|
|
246
261
|
}
|
|
247
262
|
this.uniqueId = VertexBuffer._Counter++;
|
|
@@ -267,6 +282,7 @@ export class VertexBuffer {
|
|
|
267
282
|
this.normalized = normalized;
|
|
268
283
|
this._instanced = instanced !== undefined ? instanced : false;
|
|
269
284
|
this._instanceDivisor = instanced ? divisor : 0;
|
|
285
|
+
this._alignBuffer();
|
|
270
286
|
this._computeHashCode();
|
|
271
287
|
}
|
|
272
288
|
_computeHashCode() {
|
|
@@ -281,10 +297,8 @@ export class VertexBuffer {
|
|
|
281
297
|
}
|
|
282
298
|
/** @internal */
|
|
283
299
|
_rebuild() {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
this._buffer._rebuild();
|
|
300
|
+
var _a;
|
|
301
|
+
(_a = this._buffer) === null || _a === void 0 ? void 0 : _a._rebuild();
|
|
288
302
|
}
|
|
289
303
|
/**
|
|
290
304
|
* Returns the kind of the VertexBuffer (string)
|
|
@@ -319,6 +333,7 @@ export class VertexBuffer {
|
|
|
319
333
|
if (!data) {
|
|
320
334
|
return null;
|
|
321
335
|
}
|
|
336
|
+
totalVertices = totalVertices !== null && totalVertices !== void 0 ? totalVertices : this.totalVertices;
|
|
322
337
|
return VertexBuffer.GetFloatData(data, this._size, this.type, this.byteOffset, this.byteStride, this.normalized, totalVertices, forceCopy);
|
|
323
338
|
}
|
|
324
339
|
/**
|
|
@@ -374,6 +389,7 @@ export class VertexBuffer {
|
|
|
374
389
|
*/
|
|
375
390
|
create(data) {
|
|
376
391
|
this._buffer.create(data);
|
|
392
|
+
this._alignBuffer();
|
|
377
393
|
}
|
|
378
394
|
/**
|
|
379
395
|
* Updates the underlying buffer according to the passed numeric array or Float32Array.
|
|
@@ -382,6 +398,7 @@ export class VertexBuffer {
|
|
|
382
398
|
*/
|
|
383
399
|
update(data) {
|
|
384
400
|
this._buffer.update(data);
|
|
401
|
+
this._alignBuffer();
|
|
385
402
|
}
|
|
386
403
|
/**
|
|
387
404
|
* Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.
|
|
@@ -392,6 +409,7 @@ export class VertexBuffer {
|
|
|
392
409
|
*/
|
|
393
410
|
updateDirectly(data, offset, useBytes = false) {
|
|
394
411
|
this._buffer.updateDirectly(data, offset, undefined, useBytes);
|
|
412
|
+
this._alignBuffer();
|
|
395
413
|
}
|
|
396
414
|
/**
|
|
397
415
|
* Disposes the VertexBuffer and the underlying WebGLBuffer.
|
|
@@ -410,6 +428,8 @@ export class VertexBuffer {
|
|
|
410
428
|
forEach(count, callback) {
|
|
411
429
|
VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);
|
|
412
430
|
}
|
|
431
|
+
/** @internal */
|
|
432
|
+
_alignBuffer() { }
|
|
413
433
|
/**
|
|
414
434
|
* Deduces the stride given a kind.
|
|
415
435
|
* @param kind The kind string to deduce
|
package/Buffers/buffer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/buffer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,MAAM,OAAO,MAAM;IAYf;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAOD;;;;;;;;;;;OAWG;IACH,YACI,MAAkB,EAClB,IAA4B,EAC5B,SAAkB,EAClB,MAAM,GAAG,CAAC,EACV,wBAAwB,GAAG,KAAK,EAChC,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,OAAgB,EAChB,KAAc;QArCV,oBAAe,GAAG,KAAK,CAAC;QACxB,gBAAW,GAAG,KAAK,CAAC;QAsCxB,IAAI,MAAM,IAAK,MAA0B,CAAC,QAAQ,EAAE;YAChD,mEAAmE;YACnE,IAAI,CAAC,OAAO,GAAI,MAA0B,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;SACrE;aAAM;YACH,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;SACzB;QAED,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,C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yBAAY,GAAG,UAAU,AAAb,CAAc;AACjD;;GAEG;AACoB,uBAAU,GAAG,QAAQ,AAAX,CAAY;AAC7C;;GAEG;AACoB,wBAAW,GAAG,SAAS,AAAZ,CAAa;AAC/C;;GAEG;AACoB,mBAAM,GAAG,IAAI,AAAP,CAAQ;AACrC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,sBAAS,GAAG,OAAO,AAAV,CAAW;AAC3C;;GAEG;AACoB,8BAAiB,GAAG,eAAe,AAAlB,CAAmB;AAC3D;;GAEG;AACoB,gCAAmB,GAAG,iBAAiB,AAApB,CAAqB;AAC/D;;GAEG;AACoB,gCAAmB,GAAG,iBAAiB,AAApB,CAAqB;AAC/D;;GAEG;AACoB,qCAAwB,GAAG,sBAAsB,AAAzB,CAA0B;AACzE;;GAEG;AACoB,qCAAwB,GAAG,sBAAsB,AAAzB,CAA0B","sourcesContent":["import type { Nullable, DataArray, FloatArray } from \"../types\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { DataBuffer } from \"./dataBuffer\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\n\r\n/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nexport class Buffer {\r\n private _engine: ThinEngine;\r\n private _buffer: Nullable<DataBuffer>;\r\n /** @internal */\r\n public _data: Nullable<DataArray>;\r\n private _updatable: boolean;\r\n private _instanced: boolean;\r\n private _divisor: number;\r\n private _isAlreadyOwned = false;\r\n private _isDisposed = false;\r\n private _label?: string;\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is disposed\r\n */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets the byte stride.\r\n */\r\n public readonly byteStride: number;\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @param label defines the label of the buffer (for debug purpose)\r\n */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | DataBuffer,\r\n updatable: boolean,\r\n stride = 0,\r\n postponeInternalCreation = false,\r\n instanced = false,\r\n useBytes = false,\r\n divisor?: number,\r\n label?: string\r\n ) {\r\n if (engine && (engine as unknown as Mesh).getScene) {\r\n // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = (engine as unknown as Mesh).getScene().getEngine();\r\n } else {\r\n this._engine = engine;\r\n }\r\n\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._divisor = divisor || 1;\r\n this._label = label;\r\n\r\n if (data instanceof DataBuffer) {\r\n this._data = null;\r\n this._buffer = data;\r\n } else {\r\n this._data = data;\r\n this._buffer = null;\r\n }\r\n\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n\r\n if (!postponeInternalCreation) {\r\n // by default\r\n this.create();\r\n }\r\n }\r\n\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes *\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @returns the new vertex buffer\r\n */\r\n public createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean, useBytes = false, divisor?: number): VertexBuffer {\r\n const byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n const byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n\r\n // a lot of these parameters are ignored as they are overridden by the buffer\r\n return new VertexBuffer(\r\n this._engine,\r\n this,\r\n kind,\r\n this._updatable,\r\n true,\r\n byteStride,\r\n instanced === undefined ? this._instanced : instanced,\r\n byteOffset,\r\n size,\r\n undefined,\r\n undefined,\r\n true,\r\n this._divisor || divisor\r\n );\r\n }\r\n\r\n // Properties\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n public isUpdatable(): boolean {\r\n return this._updatable;\r\n }\r\n\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n public getData(): Nullable<DataArray> {\r\n return this._data;\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n public getStrideSize(): number {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Store data into the buffer. Creates the buffer if not used already.\r\n * If the buffer was already used, it will be updated only if it is updatable, otherwise it will do nothing.\r\n * @param data defines the data to store\r\n */\r\n public create(data: Nullable<DataArray> = null): void {\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n\r\n data = data || this._data;\r\n\r\n if (!data) {\r\n return;\r\n }\r\n\r\n if (!this._buffer) {\r\n // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data, this._label);\r\n this._data = data;\r\n } else {\r\n this._buffer = this._engine.createVertexBuffer(data, undefined, this._label);\r\n }\r\n } else if (this._updatable) {\r\n // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this._buffer = null;\r\n this.create(this._data);\r\n }\r\n\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n public update(data: DataArray): void {\r\n this.create(data);\r\n }\r\n\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateDirectly(data: DataArray, offset: number, vertexCount?: number, useBytes: boolean = false): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n if (this._updatable) {\r\n // update buffer\r\n this._engine.updateDynamicVertexBuffer(\r\n this._buffer,\r\n data,\r\n useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT,\r\n vertexCount ? vertexCount * this.byteStride : undefined\r\n );\r\n if (offset === 0 && vertexCount === undefined) {\r\n // Keep the data if we easily can\r\n this._data = data;\r\n } else {\r\n this._data = null;\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _increaseReferences() {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n if (!this._isAlreadyOwned) {\r\n this._isAlreadyOwned = true;\r\n return;\r\n }\r\n\r\n this._buffer.references++;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n // The data buffer has an internal counter as this buffer can be used by several VertexBuffer objects\r\n // This means that we only flag it as disposed when all references are released (when _releaseBuffer will return true)\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._isDisposed = true;\r\n this._data = null;\r\n this._buffer = null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Options to be used when creating a vertex buffer\r\n */\r\nexport interface IVertexBufferOptions {\r\n /**\r\n * whether the data is updatable (default: false)\r\n */\r\n updatable?: boolean;\r\n /**\r\n * whether to postpone creating the internal WebGL buffer (default: false)\r\n */\r\n postponeInternalCreation?: boolean;\r\n /**\r\n * the stride (will be automatically computed from the kind parameter if not specified)\r\n */\r\n stride?: number;\r\n /**\r\n * whether the buffer is instanced (default: false)\r\n */\r\n instanced?: boolean;\r\n /**\r\n * the offset of the data (default: 0)\r\n */\r\n offset?: number;\r\n /**\r\n * the number of components (will be automatically computed from the kind parameter if not specified)\r\n */\r\n size?: number;\r\n /**\r\n * the type of the component (will be deduce from the data parameter if not specified)\r\n */\r\n type?: number;\r\n /**\r\n * whether the data contains normalized data (default: false)\r\n */\r\n normalized?: boolean;\r\n /**\r\n * set to true if stride and offset are in bytes (default: false)\r\n */\r\n useBytes?: boolean;\r\n /**\r\n * defines the instance divisor to use (default: 1, only used if instanced is true)\r\n */\r\n divisor?: number;\r\n /**\r\n * defines if the buffer should be released when the vertex buffer is disposed (default: false)\r\n */\r\n takeBufferOwnership?: boolean;\r\n /**\r\n * label to use for this vertex buffer (debugging purpose)\r\n */\r\n label?: string;\r\n}\r\n\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nexport class VertexBuffer {\r\n private static _Counter = 0;\r\n\r\n /** @internal */\r\n public _buffer: Buffer;\r\n /** @internal */\r\n public _validOffsetRange: boolean; // used internally by the engine\r\n private _kind: string;\r\n private _size: number;\r\n private _ownsBuffer: boolean;\r\n private _instanced: boolean;\r\n private _instanceDivisor: number;\r\n private _isDisposed = false;\r\n\r\n /**\r\n * The byte type.\r\n */\r\n public static readonly BYTE = 5120;\r\n\r\n /**\r\n * The unsigned byte type.\r\n */\r\n public static readonly UNSIGNED_BYTE = 5121;\r\n\r\n /**\r\n * The short type.\r\n */\r\n public static readonly SHORT = 5122;\r\n\r\n /**\r\n * The unsigned short type.\r\n */\r\n public static readonly UNSIGNED_SHORT = 5123;\r\n\r\n /**\r\n * The integer type.\r\n */\r\n public static readonly INT = 5124;\r\n\r\n /**\r\n * The unsigned integer type.\r\n */\r\n public static readonly UNSIGNED_INT = 5125;\r\n\r\n /**\r\n * The float type.\r\n */\r\n public static readonly FLOAT = 5126;\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is disposed\r\n */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n public get instanceDivisor(): number {\r\n return this._instanceDivisor;\r\n }\r\n\r\n public set instanceDivisor(value: number) {\r\n const isInstanced = value != 0;\r\n this._instanceDivisor = value;\r\n\r\n if (isInstanced !== this._instanced) {\r\n this._instanced = isInstanced;\r\n this._computeHashCode();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the byte stride.\r\n */\r\n public readonly byteStride: number;\r\n\r\n /**\r\n * Gets the byte offset.\r\n */\r\n public readonly byteOffset: number;\r\n\r\n /**\r\n * Gets whether integer data values should be normalized into a certain range when being casted to a float.\r\n */\r\n public readonly normalized: boolean;\r\n\r\n /**\r\n * Gets the data type of each component in the array.\r\n */\r\n public readonly type: number;\r\n\r\n /**\r\n * Gets the unique id of this vertex buffer\r\n */\r\n public readonly uniqueId: number;\r\n\r\n /**\r\n * Gets a hash code representing the format (type, normalized, size, instanced, stride) of this buffer\r\n * All buffers with the same format will have the same hash code\r\n */\r\n public readonly hashCode: number;\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n * @param divisor defines the instance divisor to use (1 by default)\r\n * @param takeBufferOwnership defines if the buffer should be released when the vertex buffer is disposed\r\n */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | Buffer | DataBuffer,\r\n kind: string,\r\n updatable: boolean,\r\n postponeInternalCreation?: boolean,\r\n stride?: number,\r\n instanced?: boolean,\r\n offset?: number,\r\n size?: number,\r\n type?: number,\r\n normalized?: boolean,\r\n useBytes?: boolean,\r\n divisor?: number,\r\n takeBufferOwnership?: boolean\r\n );\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param options defines the rest of the options used to create the buffer\r\n */\r\n constructor(engine: ThinEngine, data: DataArray | Buffer | DataBuffer, kind: string, options?: IVertexBufferOptions);\r\n\r\n /** @internal */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | Buffer | DataBuffer,\r\n kind: string,\r\n updatableOrOptions?: boolean | IVertexBufferOptions,\r\n postponeInternalCreation?: boolean,\r\n stride?: number,\r\n instanced?: boolean,\r\n offset?: number,\r\n size?: number,\r\n type?: number,\r\n normalized = false,\r\n useBytes = false,\r\n divisor = 1,\r\n takeBufferOwnership = false\r\n ) {\r\n let updatable = false;\r\n let label: string | undefined;\r\n\r\n if (typeof updatableOrOptions === \"object\" && updatableOrOptions !== null) {\r\n updatable = updatableOrOptions.updatable ?? false;\r\n postponeInternalCreation = updatableOrOptions.postponeInternalCreation;\r\n stride = updatableOrOptions.stride;\r\n instanced = updatableOrOptions.instanced;\r\n offset = updatableOrOptions.offset;\r\n size = updatableOrOptions.size;\r\n type = updatableOrOptions.type;\r\n normalized = updatableOrOptions.normalized ?? false;\r\n useBytes = updatableOrOptions.useBytes ?? false;\r\n divisor = updatableOrOptions.divisor ?? 1;\r\n takeBufferOwnership = updatableOrOptions.takeBufferOwnership ?? false;\r\n label = updatableOrOptions.label;\r\n } else {\r\n updatable = !!updatableOrOptions;\r\n }\r\n\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = takeBufferOwnership;\r\n } else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor, label);\r\n this._ownsBuffer = true;\r\n }\r\n\r\n this.uniqueId = VertexBuffer._Counter++;\r\n this._kind = kind;\r\n\r\n if (type === undefined) {\r\n const vertexData = this.getData();\r\n this.type = vertexData ? VertexBuffer.GetDataType(vertexData) : VertexBuffer.FLOAT;\r\n } else {\r\n this.type = type;\r\n }\r\n\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n\r\n if (useBytes) {\r\n this._size = size || (stride ? stride / typeByteLength : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || this._size * typeByteLength;\r\n this.byteOffset = offset || 0;\r\n } else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? stride * typeByteLength : this._buffer.byteStride || this._size * typeByteLength;\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n\r\n this.normalized = normalized;\r\n\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? divisor : 0;\r\n\r\n this._computeHashCode();\r\n }\r\n\r\n private _computeHashCode(): void {\r\n // note: cast to any because the property is declared readonly\r\n (this.hashCode as any) =\r\n ((this.type - 5120) << 0) +\r\n ((this.normalized ? 1 : 0) << 3) +\r\n (this._size << 4) +\r\n ((this._instanced ? 1 : 0) << 6) +\r\n /* keep 5 bits free */\r\n (this.byteStride << 12);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n this._buffer._rebuild();\r\n }\r\n\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n public getKind(): string {\r\n return this._kind;\r\n }\r\n\r\n // Properties\r\n\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n public isUpdatable(): boolean {\r\n return this._buffer.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n public getData(): Nullable<DataArray> {\r\n return this._buffer.getData();\r\n }\r\n\r\n /**\r\n * Gets current buffer's data as a float array. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param totalVertices number of vertices in the buffer to take into account\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getFloatData(totalVertices: number, forceCopy?: boolean): Nullable<FloatArray> {\r\n const data = this.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return VertexBuffer.GetFloatData(data, this._size, this.type, this.byteOffset, this.byteStride, this.normalized, totalVertices, forceCopy);\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer.getBuffer();\r\n }\r\n\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n public getStrideSize(): number {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n }\r\n\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * @returns the offset in bytes\r\n * @deprecated Please use byteOffset instead.\r\n */\r\n public getOffset(): number {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n }\r\n\r\n /**\r\n * Returns the number of components or the byte size per vertex attribute\r\n * @param sizeInBytes If true, returns the size in bytes or else the size in number of components of the vertex attribute (default: false)\r\n * @returns the number of components\r\n */\r\n public getSize(sizeInBytes = false): number {\r\n return sizeInBytes ? this._size * VertexBuffer.GetTypeByteLength(this.type) : this._size;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n public getIsInstanced(): boolean {\r\n return this._instanced;\r\n }\r\n\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n public getInstanceDivisor(): number {\r\n return this._instanceDivisor;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n public create(data?: DataArray): void {\r\n this._buffer.create(data);\r\n }\r\n\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n public update(data: DataArray): void {\r\n this._buffer.update(data);\r\n }\r\n\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateDirectly(data: DataArray, offset: number, useBytes: boolean = false): void {\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n }\r\n\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n public dispose(): void {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n public forEach(count: number, callback: (value: number, index: number) => void): void {\r\n VertexBuffer.ForEach(this._buffer.getData()!, this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n }\r\n\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n public static readonly PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n public static readonly NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n public static readonly TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n public static readonly UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n public static readonly UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n public static readonly UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n public static readonly UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n public static readonly UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n public static readonly UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n public static readonly ColorKind = \"color\";\r\n /**\r\n * Instance Colors\r\n */\r\n public static readonly ColorInstanceKind = \"instanceColor\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n public static readonly MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n public static readonly MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n public static readonly MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n public static readonly MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n public static DeduceStride(kind: string): number {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.ColorInstanceKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n }\r\n\r\n /**\r\n * Gets the vertex buffer type of the given data array.\r\n * @param data the data array\r\n * @returns the vertex buffer type\r\n */\r\n public static GetDataType(data: DataArray): number {\r\n if (data instanceof Int8Array) {\r\n return VertexBuffer.BYTE;\r\n } else if (data instanceof Uint8Array) {\r\n return VertexBuffer.UNSIGNED_BYTE;\r\n } else if (data instanceof Int16Array) {\r\n return VertexBuffer.SHORT;\r\n } else if (data instanceof Uint16Array) {\r\n return VertexBuffer.UNSIGNED_SHORT;\r\n } else if (data instanceof Int32Array) {\r\n return VertexBuffer.INT;\r\n } else if (data instanceof Uint32Array) {\r\n return VertexBuffer.UNSIGNED_INT;\r\n } else {\r\n return VertexBuffer.FLOAT;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n public static GetTypeByteLength(type: number): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(`Invalid type '${type}'`);\r\n }\r\n }\r\n\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n public static ForEach(\r\n data: DataArray,\r\n byteOffset: number,\r\n byteStride: number,\r\n componentCount: number,\r\n componentType: number,\r\n count: number,\r\n normalized: boolean,\r\n callback: (value: number, index: number) => void\r\n ): void {\r\n if (data instanceof Array) {\r\n let offset = byteOffset / 4;\r\n const stride = byteStride / 4;\r\n for (let index = 0; index < count; index += componentCount) {\r\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n } else {\r\n const dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n const componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (let index = 0; index < count; index += componentCount) {\r\n let componentByteOffset = byteOffset;\r\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n const value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n }\r\n\r\n private static _GetFloatValue(dataView: DataView, type: number, byteOffset: number, normalized: boolean): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n let value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n let value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n let value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n let value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(`Invalid component type ${type}`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the given data array as a float array. Float data is constructed if the data array cannot be returned directly.\r\n * @param data the input data array\r\n * @param size the number of components\r\n * @param type the component type\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param normalized whether the data is normalized\r\n * @param totalVertices number of vertices in the buffer to take into account\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public static GetFloatData(\r\n data: DataArray,\r\n size: number,\r\n type: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n normalized: boolean,\r\n totalVertices: number,\r\n forceCopy?: boolean\r\n ): FloatArray {\r\n const tightlyPackedByteStride = size * VertexBuffer.GetTypeByteLength(type);\r\n const count = totalVertices * size;\r\n\r\n if (type !== VertexBuffer.FLOAT || byteStride !== tightlyPackedByteStride) {\r\n const copy = new Float32Array(count);\r\n VertexBuffer.ForEach(data, byteOffset, byteStride, size, type, count, normalized, (value, index) => (copy[index] = value));\r\n return copy;\r\n }\r\n\r\n if (!(data instanceof Array || data instanceof Float32Array) || byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n const offset = byteOffset / 4;\r\n return data.slice(offset, offset + count);\r\n } else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, byteOffset, count);\r\n } else {\r\n let offset = data.byteOffset + byteOffset;\r\n if (forceCopy) {\r\n const result = new Float32Array(count);\r\n const source = new Float32Array(data.buffer, offset, count);\r\n\r\n result.set(source);\r\n\r\n return result;\r\n }\r\n\r\n // Protect against bad data\r\n const remainder = offset % 4;\r\n\r\n if (remainder) {\r\n offset = Math.max(0, offset - remainder);\r\n }\r\n\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n\r\n if (forceCopy) {\r\n return data.slice();\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/buffer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAA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CAAQ;AAElC;;GAEG;AACoB,yBAAY,GAAG,IAAI,AAAP,CAAQ;AAE3C;;GAEG;AACoB,kBAAK,GAAG,IAAI,AAAP,CAAQ;AA8WpC,QAAQ;AACR;;GAEG;AACoB,yBAAY,GAAG,UAAU,AAAb,CAAc;AACjD;;GAEG;AACoB,uBAAU,GAAG,QAAQ,AAAX,CAAY;AAC7C;;GAEG;AACoB,wBAAW,GAAG,SAAS,AAAZ,CAAa;AAC/C;;GAEG;AACoB,mBAAM,GAAG,IAAI,AAAP,CAAQ;AACrC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,oBAAO,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACoB,sBAAS,GAAG,OAAO,AAAV,CAAW;AAC3C;;GAEG;AACoB,8BAAiB,GAAG,eAAe,AAAlB,CAAmB;AAC3D;;GAEG;AACoB,gCAAmB,GAAG,iBAAiB,AAApB,CAAqB;AAC/D;;GAEG;AACoB,gCAAmB,GAAG,iBAAiB,AAApB,CAAqB;AAC/D;;GAEG;AACoB,qCAAwB,GAAG,sBAAsB,AAAzB,CAA0B;AACzE;;GAEG;AACoB,qCAAwB,GAAG,sBAAsB,AAAzB,CAA0B","sourcesContent":["import type { Nullable, DataArray, FloatArray } from \"../types\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { DataBuffer } from \"./dataBuffer\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\n\r\n/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nexport class Buffer {\r\n private _engine: ThinEngine;\r\n private _buffer: Nullable<DataBuffer>;\r\n /** @internal */\r\n public _data: Nullable<DataArray>;\r\n private _updatable: boolean;\r\n private _instanced: boolean;\r\n private _divisor: number;\r\n private _isAlreadyOwned = false;\r\n private _isDisposed = false;\r\n private _label?: string;\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is disposed\r\n */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets the byte stride.\r\n */\r\n public readonly byteStride: number;\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @param label defines the label of the buffer (for debug purpose)\r\n */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | DataBuffer,\r\n updatable: boolean,\r\n stride = 0,\r\n postponeInternalCreation = false,\r\n instanced = false,\r\n useBytes = false,\r\n divisor?: number,\r\n label?: string\r\n ) {\r\n if (engine && (engine as unknown as Mesh).getScene) {\r\n // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = (engine as unknown as Mesh).getScene().getEngine();\r\n } else {\r\n this._engine = engine;\r\n }\r\n\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._divisor = divisor || 1;\r\n this._label = label;\r\n\r\n if (data instanceof DataBuffer) {\r\n this._data = null;\r\n this._buffer = data;\r\n } else {\r\n this._data = data;\r\n this._buffer = null;\r\n }\r\n\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n\r\n if (!postponeInternalCreation) {\r\n // by default\r\n this.create();\r\n }\r\n }\r\n\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes *\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @returns the new vertex buffer\r\n */\r\n public createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean, useBytes = false, divisor?: number): VertexBuffer {\r\n const byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n const byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n\r\n // a lot of these parameters are ignored as they are overridden by the buffer\r\n return new VertexBuffer(\r\n this._engine,\r\n this,\r\n kind,\r\n this._updatable,\r\n true,\r\n byteStride,\r\n instanced === undefined ? this._instanced : instanced,\r\n byteOffset,\r\n size,\r\n undefined,\r\n undefined,\r\n true,\r\n this._divisor || divisor\r\n );\r\n }\r\n\r\n // Properties\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n public isUpdatable(): boolean {\r\n return this._updatable;\r\n }\r\n\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n public getData(): Nullable<DataArray> {\r\n return this._data;\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n public getStrideSize(): number {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Store data into the buffer. Creates the buffer if not used already.\r\n * If the buffer was already used, it will be updated only if it is updatable, otherwise it will do nothing.\r\n * @param data defines the data to store\r\n */\r\n public create(data: Nullable<DataArray> = null): void {\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n\r\n data = data || this._data;\r\n\r\n if (!data) {\r\n return;\r\n }\r\n\r\n if (!this._buffer) {\r\n // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data, this._label);\r\n this._data = data;\r\n } else {\r\n this._buffer = this._engine.createVertexBuffer(data, undefined, this._label);\r\n }\r\n } else if (this._updatable) {\r\n // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this._buffer = null;\r\n this.create(this._data);\r\n }\r\n\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n public update(data: DataArray): void {\r\n this.create(data);\r\n }\r\n\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateDirectly(data: DataArray, offset: number, vertexCount?: number, useBytes: boolean = false): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n if (this._updatable) {\r\n // update buffer\r\n this._engine.updateDynamicVertexBuffer(\r\n this._buffer,\r\n data,\r\n useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT,\r\n vertexCount ? vertexCount * this.byteStride : undefined\r\n );\r\n if (offset === 0 && vertexCount === undefined) {\r\n // Keep the data if we easily can\r\n this._data = data;\r\n } else {\r\n this._data = null;\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _increaseReferences() {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n if (!this._isAlreadyOwned) {\r\n this._isAlreadyOwned = true;\r\n return;\r\n }\r\n\r\n this._buffer.references++;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n // The data buffer has an internal counter as this buffer can be used by several VertexBuffer objects\r\n // This means that we only flag it as disposed when all references are released (when _releaseBuffer will return true)\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._isDisposed = true;\r\n this._data = null;\r\n this._buffer = null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Options to be used when creating a vertex buffer\r\n */\r\nexport interface IVertexBufferOptions {\r\n /**\r\n * whether the data is updatable (default: false)\r\n */\r\n updatable?: boolean;\r\n /**\r\n * whether to postpone creating the internal WebGL buffer (default: false)\r\n */\r\n postponeInternalCreation?: boolean;\r\n /**\r\n * the stride (will be automatically computed from the kind parameter if not specified)\r\n */\r\n stride?: number;\r\n /**\r\n * whether the buffer is instanced (default: false)\r\n */\r\n instanced?: boolean;\r\n /**\r\n * the offset of the data (default: 0)\r\n */\r\n offset?: number;\r\n /**\r\n * the number of components (will be automatically computed from the kind parameter if not specified)\r\n */\r\n size?: number;\r\n /**\r\n * the type of the component (will be deduce from the data parameter if not specified)\r\n */\r\n type?: number;\r\n /**\r\n * whether the data contains normalized data (default: false)\r\n */\r\n normalized?: boolean;\r\n /**\r\n * set to true if stride and offset are in bytes (default: false)\r\n */\r\n useBytes?: boolean;\r\n /**\r\n * defines the instance divisor to use (default: 1, only used if instanced is true)\r\n */\r\n divisor?: number;\r\n /**\r\n * defines if the buffer should be released when the vertex buffer is disposed (default: false)\r\n */\r\n takeBufferOwnership?: boolean;\r\n /**\r\n * label to use for this vertex buffer (debugging purpose)\r\n */\r\n label?: string;\r\n}\r\n\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nexport class VertexBuffer {\r\n private static _Counter = 0;\r\n\r\n /** @internal */\r\n public _buffer: Buffer;\r\n /** @internal */\r\n public _validOffsetRange: boolean; // used internally by the engine\r\n private _kind: string;\r\n private _size: number;\r\n /** @internal */\r\n public _ownsBuffer: boolean;\r\n private _instanced: boolean;\r\n private _instanceDivisor: number;\r\n /** @internal */\r\n public _isDisposed = false;\r\n /** @internal */\r\n public _label?: string;\r\n\r\n /**\r\n * The byte type.\r\n */\r\n public static readonly BYTE = 5120;\r\n\r\n /**\r\n * The unsigned byte type.\r\n */\r\n public static readonly UNSIGNED_BYTE = 5121;\r\n\r\n /**\r\n * The short type.\r\n */\r\n public static readonly SHORT = 5122;\r\n\r\n /**\r\n * The unsigned short type.\r\n */\r\n public static readonly UNSIGNED_SHORT = 5123;\r\n\r\n /**\r\n * The integer type.\r\n */\r\n public static readonly INT = 5124;\r\n\r\n /**\r\n * The unsigned integer type.\r\n */\r\n public static readonly UNSIGNED_INT = 5125;\r\n\r\n /**\r\n * The float type.\r\n */\r\n public static readonly FLOAT = 5126;\r\n\r\n /**\r\n * Gets a boolean indicating if the Buffer is disposed\r\n */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n public get instanceDivisor(): number {\r\n return this._instanceDivisor;\r\n }\r\n\r\n public set instanceDivisor(value: number) {\r\n const isInstanced = value != 0;\r\n this._instanceDivisor = value;\r\n\r\n if (isInstanced !== this._instanced) {\r\n this._instanced = isInstanced;\r\n this._computeHashCode();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the byte stride.\r\n */\r\n public readonly byteStride: number;\r\n\r\n /**\r\n * Gets the byte offset.\r\n */\r\n public readonly byteOffset: number;\r\n\r\n /**\r\n * Gets whether integer data values should be normalized into a certain range when being casted to a float.\r\n */\r\n public readonly normalized: boolean;\r\n\r\n /**\r\n * Gets the data type of each component in the array.\r\n */\r\n public readonly type: number;\r\n\r\n /**\r\n * Gets the unique id of this vertex buffer\r\n */\r\n public readonly uniqueId: number;\r\n\r\n /**\r\n * Gets a hash code representing the format (type, normalized, size, instanced, stride) of this buffer\r\n * All buffers with the same format will have the same hash code\r\n */\r\n public readonly hashCode: number;\r\n\r\n /**\r\n * Gets the engine associated with the buffer\r\n */\r\n public readonly engine: ThinEngine;\r\n\r\n /**\r\n * Gets the number of vertices in the buffer\r\n */\r\n public get totalVertices() {\r\n const data = this.getData();\r\n if (!data) {\r\n return 0;\r\n }\r\n\r\n if (Array.isArray(data)) {\r\n // data is a regular number[] with float values\r\n return data.length / (this.byteStride / 4) - this.byteOffset / 4;\r\n }\r\n\r\n return (data.byteLength - this.byteOffset) / this.byteStride;\r\n }\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n * @param divisor defines the instance divisor to use (1 by default)\r\n * @param takeBufferOwnership defines if the buffer should be released when the vertex buffer is disposed\r\n */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | Buffer | DataBuffer,\r\n kind: string,\r\n updatable: boolean,\r\n postponeInternalCreation?: boolean,\r\n stride?: number,\r\n instanced?: boolean,\r\n offset?: number,\r\n size?: number,\r\n type?: number,\r\n normalized?: boolean,\r\n useBytes?: boolean,\r\n divisor?: number,\r\n takeBufferOwnership?: boolean\r\n );\r\n\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param options defines the rest of the options used to create the buffer\r\n */\r\n constructor(engine: ThinEngine, data: DataArray | Buffer | DataBuffer, kind: string, options?: IVertexBufferOptions);\r\n\r\n /** @internal */\r\n constructor(\r\n engine: ThinEngine,\r\n data: DataArray | Buffer | DataBuffer,\r\n kind: string,\r\n updatableOrOptions?: boolean | IVertexBufferOptions,\r\n postponeInternalCreation?: boolean,\r\n stride?: number,\r\n instanced?: boolean,\r\n offset?: number,\r\n size?: number,\r\n type?: number,\r\n normalized = false,\r\n useBytes = false,\r\n divisor = 1,\r\n takeBufferOwnership = false\r\n ) {\r\n let updatable = false;\r\n\r\n this.engine = engine;\r\n\r\n if (typeof updatableOrOptions === \"object\" && updatableOrOptions !== null) {\r\n updatable = updatableOrOptions.updatable ?? false;\r\n postponeInternalCreation = updatableOrOptions.postponeInternalCreation;\r\n stride = updatableOrOptions.stride;\r\n instanced = updatableOrOptions.instanced;\r\n offset = updatableOrOptions.offset;\r\n size = updatableOrOptions.size;\r\n type = updatableOrOptions.type;\r\n normalized = updatableOrOptions.normalized ?? false;\r\n useBytes = updatableOrOptions.useBytes ?? false;\r\n divisor = updatableOrOptions.divisor ?? 1;\r\n takeBufferOwnership = updatableOrOptions.takeBufferOwnership ?? false;\r\n this._label = updatableOrOptions.label;\r\n } else {\r\n updatable = !!updatableOrOptions;\r\n }\r\n\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = takeBufferOwnership;\r\n } else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor, this._label);\r\n this._ownsBuffer = true;\r\n }\r\n\r\n this.uniqueId = VertexBuffer._Counter++;\r\n this._kind = kind;\r\n\r\n if (type === undefined) {\r\n const vertexData = this.getData();\r\n this.type = vertexData ? VertexBuffer.GetDataType(vertexData) : VertexBuffer.FLOAT;\r\n } else {\r\n this.type = type;\r\n }\r\n\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n\r\n if (useBytes) {\r\n this._size = size || (stride ? stride / typeByteLength : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || this._size * typeByteLength;\r\n this.byteOffset = offset || 0;\r\n } else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? stride * typeByteLength : this._buffer.byteStride || this._size * typeByteLength;\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n\r\n this.normalized = normalized;\r\n\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? divisor : 0;\r\n\r\n this._alignBuffer();\r\n this._computeHashCode();\r\n }\r\n\r\n private _computeHashCode(): void {\r\n // note: cast to any because the property is declared readonly\r\n (this.hashCode as any) =\r\n ((this.type - 5120) << 0) +\r\n ((this.normalized ? 1 : 0) << 3) +\r\n (this._size << 4) +\r\n ((this._instanced ? 1 : 0) << 6) +\r\n /* keep 5 bits free */\r\n (this.byteStride << 12);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this._buffer?._rebuild();\r\n }\r\n\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n public getKind(): string {\r\n return this._kind;\r\n }\r\n\r\n // Properties\r\n\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n public isUpdatable(): boolean {\r\n return this._buffer.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n public getData(): Nullable<DataArray> {\r\n return this._buffer.getData();\r\n }\r\n\r\n /**\r\n * Gets current buffer's data as a float array. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param totalVertices number of vertices in the buffer to take into account\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getFloatData(totalVertices?: number, forceCopy?: boolean): Nullable<FloatArray> {\r\n const data = this.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n totalVertices = totalVertices ?? this.totalVertices;\r\n\r\n return VertexBuffer.GetFloatData(data, this._size, this.type, this.byteOffset, this.byteStride, this.normalized, totalVertices, forceCopy);\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer.getBuffer();\r\n }\r\n\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n public getStrideSize(): number {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n }\r\n\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * @returns the offset in bytes\r\n * @deprecated Please use byteOffset instead.\r\n */\r\n public getOffset(): number {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n }\r\n\r\n /**\r\n * Returns the number of components or the byte size per vertex attribute\r\n * @param sizeInBytes If true, returns the size in bytes or else the size in number of components of the vertex attribute (default: false)\r\n * @returns the number of components\r\n */\r\n public getSize(sizeInBytes = false): number {\r\n return sizeInBytes ? this._size * VertexBuffer.GetTypeByteLength(this.type) : this._size;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n public getIsInstanced(): boolean {\r\n return this._instanced;\r\n }\r\n\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n public getInstanceDivisor(): number {\r\n return this._instanceDivisor;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n public create(data?: DataArray): void {\r\n this._buffer.create(data);\r\n this._alignBuffer();\r\n }\r\n\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n public update(data: DataArray): void {\r\n this._buffer.update(data);\r\n this._alignBuffer();\r\n }\r\n\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateDirectly(data: DataArray, offset: number, useBytes: boolean = false): void {\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n this._alignBuffer();\r\n }\r\n\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n public dispose(): void {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n public forEach(count: number, callback: (value: number, index: number) => void): void {\r\n VertexBuffer.ForEach(this._buffer.getData()!, this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n }\r\n\r\n /** @internal */\r\n public _alignBuffer() {}\r\n\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n public static readonly PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n public static readonly NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n public static readonly TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n public static readonly UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n public static readonly UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n public static readonly UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n public static readonly UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n public static readonly UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n public static readonly UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n public static readonly ColorKind = \"color\";\r\n /**\r\n * Instance Colors\r\n */\r\n public static readonly ColorInstanceKind = \"instanceColor\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n public static readonly MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n public static readonly MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n public static readonly MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n public static readonly MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n public static DeduceStride(kind: string): number {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.ColorInstanceKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n }\r\n\r\n /**\r\n * Gets the vertex buffer type of the given data array.\r\n * @param data the data array\r\n * @returns the vertex buffer type\r\n */\r\n public static GetDataType(data: DataArray): number {\r\n if (data instanceof Int8Array) {\r\n return VertexBuffer.BYTE;\r\n } else if (data instanceof Uint8Array) {\r\n return VertexBuffer.UNSIGNED_BYTE;\r\n } else if (data instanceof Int16Array) {\r\n return VertexBuffer.SHORT;\r\n } else if (data instanceof Uint16Array) {\r\n return VertexBuffer.UNSIGNED_SHORT;\r\n } else if (data instanceof Int32Array) {\r\n return VertexBuffer.INT;\r\n } else if (data instanceof Uint32Array) {\r\n return VertexBuffer.UNSIGNED_INT;\r\n } else {\r\n return VertexBuffer.FLOAT;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n public static GetTypeByteLength(type: number): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(`Invalid type '${type}'`);\r\n }\r\n }\r\n\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n public static ForEach(\r\n data: DataArray,\r\n byteOffset: number,\r\n byteStride: number,\r\n componentCount: number,\r\n componentType: number,\r\n count: number,\r\n normalized: boolean,\r\n callback: (value: number, index: number) => void\r\n ): void {\r\n if (data instanceof Array) {\r\n let offset = byteOffset / 4;\r\n const stride = byteStride / 4;\r\n for (let index = 0; index < count; index += componentCount) {\r\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n } else {\r\n const dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n const componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (let index = 0; index < count; index += componentCount) {\r\n let componentByteOffset = byteOffset;\r\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n const value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n }\r\n\r\n private static _GetFloatValue(dataView: DataView, type: number, byteOffset: number, normalized: boolean): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n let value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n let value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n let value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n let value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(`Invalid component type ${type}`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the given data array as a float array. Float data is constructed if the data array cannot be returned directly.\r\n * @param data the input data array\r\n * @param size the number of components\r\n * @param type the component type\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param normalized whether the data is normalized\r\n * @param totalVertices number of vertices in the buffer to take into account\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public static GetFloatData(\r\n data: DataArray,\r\n size: number,\r\n type: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n normalized: boolean,\r\n totalVertices: number,\r\n forceCopy?: boolean\r\n ): FloatArray {\r\n const tightlyPackedByteStride = size * VertexBuffer.GetTypeByteLength(type);\r\n const count = totalVertices * size;\r\n\r\n if (type !== VertexBuffer.FLOAT || byteStride !== tightlyPackedByteStride) {\r\n const copy = new Float32Array(count);\r\n VertexBuffer.ForEach(data, byteOffset, byteStride, size, type, count, normalized, (value, index) => (copy[index] = value));\r\n return copy;\r\n }\r\n\r\n if (!(data instanceof Array || data instanceof Float32Array) || byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n const offset = byteOffset / 4;\r\n return data.slice(offset, offset + count);\r\n } else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, byteOffset, count);\r\n } else {\r\n let offset = data.byteOffset + byteOffset;\r\n if (forceCopy) {\r\n const result = new Float32Array(count);\r\n const source = new Float32Array(data.buffer, offset, count);\r\n\r\n result.set(source);\r\n\r\n return result;\r\n }\r\n\r\n // Protect against bad data\r\n const remainder = offset % 4;\r\n\r\n if (remainder) {\r\n offset = Math.max(0, offset - remainder);\r\n }\r\n\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n\r\n if (forceCopy) {\r\n return data.slice();\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n"]}
|
package/Buffers/index.d.ts
CHANGED
package/Buffers/index.js
CHANGED
package/Buffers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./buffer\";\r\nexport * from \"./dataBuffer\";\r\nexport * from \"./storageBuffer\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,gBAAgB,CAAC","sourcesContent":["export * from \"./buffer\";\r\nexport * from \"./dataBuffer\";\r\nexport * from \"./storageBuffer\";\r\nimport \"./buffer.align\";\r\n"]}
|
|
@@ -37,9 +37,6 @@ export class BaseCameraPointersInput {
|
|
|
37
37
|
var _a, _b;
|
|
38
38
|
const evt = p.event;
|
|
39
39
|
const isTouch = evt.pointerType === "touch";
|
|
40
|
-
if (engine.isInVRExclusivePointerMode) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
40
|
if (p.type !== PointerEventTypes.POINTERMOVE && this.buttons.indexOf(evt.button) === -1) {
|
|
44
41
|
return;
|
|
45
42
|
}
|