@onerjs/core 8.42.7 → 8.42.9
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/Animations/animatable.core.js +1 -1
- package/Animations/animatable.core.js.map +1 -1
- package/Animations/animatorAvatar.js +2 -2
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js +1 -2
- package/Audio/audioSceneComponent.js.map +1 -1
- package/AudioV2/audioUtils.d.ts +23 -0
- package/AudioV2/audioUtils.js +37 -0
- package/AudioV2/audioUtils.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +3 -3
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +1 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +3 -2
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +10 -3
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +1 -1
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/boneLookController.js +1 -1
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/buffer.js +1 -1
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +2 -2
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.renderPass.js +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js.map +1 -1
- package/Engines/Extensions/engine.query.js +1 -1
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +2 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.d.ts +87 -0
- package/Engines/WebGPU/Extensions/engine.debugging.js +123 -31
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +20 -6
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.common.js +2 -2
- package/Engines/engine.common.js.map +1 -1
- package/Engines/engine.js +0 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.functions.js +1 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +4 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinNativeEngine.js +2 -5
- package/Engines/thinNativeEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +6 -4
- package/Engines/thinWebGPUEngine.js +49 -25
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -1
- package/Engines/webgpuEngine.js +18 -16
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +1 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +1 -0
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +1 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +1 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +12 -1
- package/FrameGraph/Node/nodeRenderGraph.js +36 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +3 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +14 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +20 -14
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +3 -2
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +38 -14
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/Layers/glowLayer.js +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +1 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/selectionOutlineLayer.js +8 -0
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.js +15 -0
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +0 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +28 -1
- package/Lights/Shadows/shadowGenerator.js +77 -11
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/lightingVolume.d.ts +1 -0
- package/Lights/lightingVolume.js +10 -2
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +2 -3
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.js +3 -5
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +2 -3
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +0 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +1 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.js +2 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +13 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/effect.js +2 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/materialHelper.functions.js +1 -1
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/multiMaterial.js +1 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +1 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.geospatial.d.ts +17 -2
- package/Maths/math.geospatial.functions.d.ts +16 -2
- package/Maths/math.geospatial.functions.js +37 -4
- package/Maths/math.geospatial.functions.js.map +1 -1
- package/Maths/math.geospatial.js.map +1 -1
- package/Maths/math.path.js +1 -1
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.scalar.functions.js +3 -3
- package/Maths/math.scalar.functions.js.map +1 -1
- package/Maths/math.vector.js +1 -1
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.js +1 -2
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +2 -2
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.js +2 -2
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js +11 -15
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.js +6 -6
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +2 -2
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.js +6 -6
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.js +2 -3
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.js +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +1 -2
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/extrudeGeometryBlock.d.ts +61 -0
- package/Meshes/Node/Blocks/extrudeGeometryBlock.js +297 -0
- package/Meshes/Node/Blocks/extrudeGeometryBlock.js.map +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +4 -0
- package/Meshes/abstractMesh.js +14 -10
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +1 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geodesicMesh.js +11 -13
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/geometry.js +2 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.js +7 -7
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -0
- package/Meshes/mesh.js +21 -7
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +22 -22
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshSimplification.js +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/polygonMesh.js +1 -1
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/trailMesh.js +1 -1
- package/Meshes/trailMesh.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.js +4 -6
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/basisWorker.js +1 -1
- package/Misc/basisWorker.js.map +1 -1
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/meshExploder.js +1 -2
- package/Misc/meshExploder.js.map +1 -1
- package/Misc/tga.js +2 -2
- package/Misc/tga.js.map +1 -1
- package/Misc/timer.js +4 -2
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.d.ts +7 -0
- package/Misc/tools.js +25 -7
- package/Misc/tools.js.map +1 -1
- package/Misc/webRequest.d.ts +34 -3
- package/Misc/webRequest.js +107 -24
- package/Misc/webRequest.js.map +1 -1
- package/Morph/morphTargetManager.js +1 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +11 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +25 -11
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +3 -3
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +2 -0
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +14 -0
- package/Particles/gpuParticleSystem.js +94 -12
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +4 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/pointsCloudSystem.js +46 -47
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticleSystem.js +5 -6
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.js +3 -4
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js +2 -1
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js +0 -8
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v2/characterController.js +4 -8
- package/Physics/v2/characterController.js.map +1 -1
- package/Physics/v2/ragdoll.js +1 -2
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/postProcess.js +3 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinDepthOfFieldEffect.js +2 -2
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
- package/Probes/reflectionProbe.js +0 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -5
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/depthRenderer.js +0 -11
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/depthRendererSceneComponent.js +1 -1
- package/Rendering/depthRendererSceneComponent.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +0 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/objectRenderer.js +7 -5
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.js +1 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +1 -1
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js +18 -8
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +4 -0
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js +15 -3
- package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js +18 -7
- package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +16 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +1 -1
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/Sprites/spriteManager.js +4 -4
- package/Sprites/spriteManager.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +2 -2
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +1 -1
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +1 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
- package/XR/webXRFeaturesManager.js +1 -1
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/assetContainer.js +1 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +16 -0
- package/scene.js +28 -0
- package/scene.js.map +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instantiateOnVolumeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateOnV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CAAC;QAC3I,UAAU,IAAI,GAAG,IAAI,CAAC,iBAAiB,eAAe,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC5F,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC/D,CAAC;QAED,IAAI,mBAAmB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QACjD,CAAC;IACL,CAAC;CACJ;AAxUU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iEAC3F;AAMvB;IADN,sBAAsB,CAAC,WAAW,0CAAkC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DACvF;AAoU5B,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData> = null;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions, 0, this._vertexData.positions.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const offset = state.adaptInput(this.offset, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.ZeroReadOnly);\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n this._currentPosition.addInPlace(offset);\r\n\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"instantiateOnVolumeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,O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AAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC/D,CAAC;QAED,IAAI,mBAAmB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QACjD,CAAC;IACL,CAAC;CACJ;AAxUU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iEAC3F;AAMvB;IADN,sBAAsB,CAAC,WAAW,0CAAkC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DACvF;AAoU5B,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData>;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions, 0, this._vertexData.positions.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const offset = state.adaptInput(this.offset, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.ZeroReadOnly);\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n this._currentPosition.addInPlace(offset);\r\n\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint.js";
|
|
3
|
+
import type { NodeGeometryBuildState } from "../nodeGeometryBuildState.js";
|
|
4
|
+
/**
|
|
5
|
+
* Cap mode for the extrusion
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ExtrudeGeometryCap {
|
|
8
|
+
/** No caps — only the extruded side walls are generated */
|
|
9
|
+
NoCap = 0,
|
|
10
|
+
/** Cap the bottom face (the original input geometry face) */
|
|
11
|
+
CapStart = 1,
|
|
12
|
+
/** Cap the top face (the offset/extruded geometry face) */
|
|
13
|
+
CapEnd = 2,
|
|
14
|
+
/** Cap both the bottom and top faces (default). Creates a solid */
|
|
15
|
+
CapAll = 3
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Block used to extrude a geometry along its face normals
|
|
19
|
+
*/
|
|
20
|
+
export declare class ExtrudeGeometryBlock extends NodeGeometryBlock {
|
|
21
|
+
/**
|
|
22
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
23
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
24
|
+
*/
|
|
25
|
+
evaluateContext: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Gets or sets the cap mode for the extrusion
|
|
28
|
+
*/
|
|
29
|
+
cap: ExtrudeGeometryCap;
|
|
30
|
+
/**
|
|
31
|
+
* Create a new ExtrudeGeometryBlock
|
|
32
|
+
* @param name defines the block name
|
|
33
|
+
*/
|
|
34
|
+
constructor(name: string);
|
|
35
|
+
/**
|
|
36
|
+
* Gets the current class name
|
|
37
|
+
* @returns the class name
|
|
38
|
+
*/
|
|
39
|
+
getClassName(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the geometry input component
|
|
42
|
+
*/
|
|
43
|
+
get geometry(): NodeGeometryConnectionPoint;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the depth input component
|
|
46
|
+
*/
|
|
47
|
+
get depth(): NodeGeometryConnectionPoint;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the geometry output component
|
|
50
|
+
*/
|
|
51
|
+
get output(): NodeGeometryConnectionPoint;
|
|
52
|
+
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
53
|
+
protected _dumpPropertiesCode(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Serializes this block in a JSON representation
|
|
56
|
+
* @returns the serialized block object
|
|
57
|
+
*/
|
|
58
|
+
serialize(): any;
|
|
59
|
+
/** @internal */
|
|
60
|
+
_deserialize(serializationObject: any): void;
|
|
61
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { __decorate } from "../../../tslib.es6.js";
|
|
2
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
3
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
4
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
|
+
import { Vector3 } from "../../../Maths/math.vector.js";
|
|
7
|
+
import { VertexData } from "../../mesh.vertexData.js";
|
|
8
|
+
/**
|
|
9
|
+
* Cap mode for the extrusion
|
|
10
|
+
*/
|
|
11
|
+
export var ExtrudeGeometryCap;
|
|
12
|
+
(function (ExtrudeGeometryCap) {
|
|
13
|
+
/** No caps — only the extruded side walls are generated */
|
|
14
|
+
ExtrudeGeometryCap[ExtrudeGeometryCap["NoCap"] = 0] = "NoCap";
|
|
15
|
+
/** Cap the bottom face (the original input geometry face) */
|
|
16
|
+
ExtrudeGeometryCap[ExtrudeGeometryCap["CapStart"] = 1] = "CapStart";
|
|
17
|
+
/** Cap the top face (the offset/extruded geometry face) */
|
|
18
|
+
ExtrudeGeometryCap[ExtrudeGeometryCap["CapEnd"] = 2] = "CapEnd";
|
|
19
|
+
/** Cap both the bottom and top faces (default). Creates a solid */
|
|
20
|
+
ExtrudeGeometryCap[ExtrudeGeometryCap["CapAll"] = 3] = "CapAll";
|
|
21
|
+
})(ExtrudeGeometryCap || (ExtrudeGeometryCap = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Block used to extrude a geometry along its face normals
|
|
24
|
+
*/
|
|
25
|
+
export class ExtrudeGeometryBlock extends NodeGeometryBlock {
|
|
26
|
+
/**
|
|
27
|
+
* Create a new ExtrudeGeometryBlock
|
|
28
|
+
* @param name defines the block name
|
|
29
|
+
*/
|
|
30
|
+
constructor(name) {
|
|
31
|
+
super(name);
|
|
32
|
+
/**
|
|
33
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
34
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
35
|
+
*/
|
|
36
|
+
this.evaluateContext = false;
|
|
37
|
+
/**
|
|
38
|
+
* Gets or sets the cap mode for the extrusion
|
|
39
|
+
*/
|
|
40
|
+
this.cap = ExtrudeGeometryCap.CapAll;
|
|
41
|
+
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
42
|
+
this.registerInput("depth", NodeGeometryBlockConnectionPointTypes.Float, true, 1.0);
|
|
43
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current class name
|
|
47
|
+
* @returns the class name
|
|
48
|
+
*/
|
|
49
|
+
getClassName() {
|
|
50
|
+
return "ExtrudeGeometryBlock";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the geometry input component
|
|
54
|
+
*/
|
|
55
|
+
get geometry() {
|
|
56
|
+
return this._inputs[0];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the depth input component
|
|
60
|
+
*/
|
|
61
|
+
get depth() {
|
|
62
|
+
return this._inputs[1];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets the geometry output component
|
|
66
|
+
*/
|
|
67
|
+
get output() {
|
|
68
|
+
return this._outputs[0];
|
|
69
|
+
}
|
|
70
|
+
_buildBlock(state) {
|
|
71
|
+
const func = (state) => {
|
|
72
|
+
const inputGeometry = this.geometry.getConnectedValue(state);
|
|
73
|
+
if (!inputGeometry || !inputGeometry.positions || !inputGeometry.indices) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const vertexData = inputGeometry.clone();
|
|
77
|
+
const positions = vertexData.positions;
|
|
78
|
+
const indices = vertexData.indices;
|
|
79
|
+
const depthValue = this.depth.getConnectedValue(state) ?? 1.0;
|
|
80
|
+
if (depthValue === 0) {
|
|
81
|
+
return vertexData;
|
|
82
|
+
}
|
|
83
|
+
// Step 2: Compute average face normal
|
|
84
|
+
const normal = new Vector3(0, 0, 0);
|
|
85
|
+
const v0 = new Vector3();
|
|
86
|
+
const v1 = new Vector3();
|
|
87
|
+
const v2 = new Vector3();
|
|
88
|
+
const edge1 = new Vector3();
|
|
89
|
+
const edge2 = new Vector3();
|
|
90
|
+
const faceNormal = new Vector3();
|
|
91
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
92
|
+
const i0 = indices[i];
|
|
93
|
+
const i1 = indices[i + 1];
|
|
94
|
+
const i2 = indices[i + 2];
|
|
95
|
+
v0.set(positions[i0 * 3], positions[i0 * 3 + 1], positions[i0 * 3 + 2]);
|
|
96
|
+
v1.set(positions[i1 * 3], positions[i1 * 3 + 1], positions[i1 * 3 + 2]);
|
|
97
|
+
v2.set(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2]);
|
|
98
|
+
v1.subtractToRef(v0, edge1);
|
|
99
|
+
v2.subtractToRef(v0, edge2);
|
|
100
|
+
Vector3.CrossToRef(edge1, edge2, faceNormal);
|
|
101
|
+
normal.addInPlace(faceNormal);
|
|
102
|
+
}
|
|
103
|
+
if (normal.lengthSquared() < 1e-10) {
|
|
104
|
+
normal.set(0, 1, 0);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
normal.normalize();
|
|
108
|
+
}
|
|
109
|
+
// Step 3: Create offset positions
|
|
110
|
+
const offset = normal.scale(depthValue);
|
|
111
|
+
const vertexCount = positions.length / 3;
|
|
112
|
+
const bottomPositions = new Float32Array(positions);
|
|
113
|
+
const topPositions = new Float32Array(vertexCount * 3);
|
|
114
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
115
|
+
topPositions[i * 3] = positions[i * 3] + offset.x;
|
|
116
|
+
topPositions[i * 3 + 1] = positions[i * 3 + 1] + offset.y;
|
|
117
|
+
topPositions[i * 3 + 2] = positions[i * 3 + 2] + offset.z;
|
|
118
|
+
}
|
|
119
|
+
// Step 4: Detect boundary edges
|
|
120
|
+
const edgeCount = new Map();
|
|
121
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
122
|
+
const triIdx = i;
|
|
123
|
+
const triVerts = [indices[i], indices[i + 1], indices[i + 2]];
|
|
124
|
+
for (let e = 0; e < 3; e++) {
|
|
125
|
+
const a = triVerts[e];
|
|
126
|
+
const b = triVerts[(e + 1) % 3];
|
|
127
|
+
const key = Math.min(a, b) + "_" + Math.max(a, b);
|
|
128
|
+
const existing = edgeCount.get(key);
|
|
129
|
+
if (existing) {
|
|
130
|
+
existing.count++;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
edgeCount.set(key, { count: 1, triIndex: triIdx });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Collect boundary edges with winding info
|
|
138
|
+
const boundaryEdges = [];
|
|
139
|
+
for (const [key, value] of Array.from(edgeCount)) {
|
|
140
|
+
if (value.count === 1) {
|
|
141
|
+
const parts = key.split("_");
|
|
142
|
+
const minV = parseInt(parts[0]);
|
|
143
|
+
const maxV = parseInt(parts[1]);
|
|
144
|
+
// Check original winding order in the triangle
|
|
145
|
+
const ti = value.triIndex;
|
|
146
|
+
const t0 = indices[ti];
|
|
147
|
+
const t1 = indices[ti + 1];
|
|
148
|
+
const t2 = indices[ti + 2];
|
|
149
|
+
// Determine if edge (minV, maxV) appears in order or reversed in the triangle
|
|
150
|
+
let inOrder = false;
|
|
151
|
+
if ((t0 === minV && t1 === maxV) || (t1 === minV && t2 === maxV) || (t2 === minV && t0 === maxV)) {
|
|
152
|
+
inOrder = true;
|
|
153
|
+
}
|
|
154
|
+
boundaryEdges.push({ a: minV, b: maxV, orderedAb: inOrder });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Step 5: Generate side wall faces
|
|
158
|
+
const sideIndices = [];
|
|
159
|
+
for (const edge of boundaryEdges) {
|
|
160
|
+
const a = edge.a;
|
|
161
|
+
const b = edge.b;
|
|
162
|
+
const aTop = a + vertexCount;
|
|
163
|
+
const bTop = b + vertexCount;
|
|
164
|
+
if (edge.orderedAb) {
|
|
165
|
+
// Edge appears as (a, b) in triangle — outward normals
|
|
166
|
+
sideIndices.push(a, b, bTop);
|
|
167
|
+
sideIndices.push(a, bTop, aTop);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// Edge appears as (b, a) in triangle — reverse winding
|
|
171
|
+
sideIndices.push(b, a, aTop);
|
|
172
|
+
sideIndices.push(b, aTop, bTop);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Step 6: Assemble final VertexData
|
|
176
|
+
const capStart = (this.cap & ExtrudeGeometryCap.CapStart) !== 0;
|
|
177
|
+
const capEnd = (this.cap & ExtrudeGeometryCap.CapEnd) !== 0;
|
|
178
|
+
// Build indices
|
|
179
|
+
const finalIndices = [];
|
|
180
|
+
// Bottom cap: original indices
|
|
181
|
+
if (capStart) {
|
|
182
|
+
for (let i = 0; i < indices.length; i++) {
|
|
183
|
+
finalIndices.push(indices[i]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Top cap: original indices offset by vertexCount, reversed winding
|
|
187
|
+
if (capEnd) {
|
|
188
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
189
|
+
finalIndices.push(indices[i] + vertexCount);
|
|
190
|
+
finalIndices.push(indices[i + 2] + vertexCount);
|
|
191
|
+
finalIndices.push(indices[i + 1] + vertexCount);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// Side walls
|
|
195
|
+
for (let i = 0; i < sideIndices.length; i++) {
|
|
196
|
+
finalIndices.push(sideIndices[i]);
|
|
197
|
+
}
|
|
198
|
+
// Build positions: [bottom, top]
|
|
199
|
+
const finalPositions = new Float32Array(vertexCount * 2 * 3);
|
|
200
|
+
finalPositions.set(bottomPositions, 0);
|
|
201
|
+
finalPositions.set(topPositions, vertexCount * 3);
|
|
202
|
+
// Build the result VertexData
|
|
203
|
+
const result = new VertexData();
|
|
204
|
+
result.positions = Array.from(finalPositions);
|
|
205
|
+
result.indices = finalIndices;
|
|
206
|
+
// Duplicate UVs if present
|
|
207
|
+
if (vertexData.uvs) {
|
|
208
|
+
const uvs = vertexData.uvs;
|
|
209
|
+
const finalUVs = new Float32Array(vertexCount * 2 * 2);
|
|
210
|
+
finalUVs.set(new Float32Array(uvs), 0);
|
|
211
|
+
finalUVs.set(new Float32Array(uvs), vertexCount * 2);
|
|
212
|
+
result.uvs = Array.from(finalUVs);
|
|
213
|
+
}
|
|
214
|
+
// Duplicate colors if present
|
|
215
|
+
if (vertexData.colors) {
|
|
216
|
+
const colors = vertexData.colors;
|
|
217
|
+
const finalColors = new Float32Array(vertexCount * 2 * 4);
|
|
218
|
+
finalColors.set(new Float32Array(colors), 0);
|
|
219
|
+
finalColors.set(new Float32Array(colors), vertexCount * 4);
|
|
220
|
+
result.colors = Array.from(finalColors);
|
|
221
|
+
}
|
|
222
|
+
// Duplicate tangents if present
|
|
223
|
+
if (vertexData.tangents) {
|
|
224
|
+
const tangents = vertexData.tangents;
|
|
225
|
+
const finalTangents = new Float32Array(vertexCount * 2 * 4);
|
|
226
|
+
finalTangents.set(new Float32Array(tangents), 0);
|
|
227
|
+
finalTangents.set(new Float32Array(tangents), vertexCount * 4);
|
|
228
|
+
result.tangents = Array.from(finalTangents);
|
|
229
|
+
}
|
|
230
|
+
// Duplicate UV2-UV6 if present
|
|
231
|
+
const uvSets = ["uvs2", "uvs3", "uvs4", "uvs5", "uvs6"];
|
|
232
|
+
for (const uvSet of uvSets) {
|
|
233
|
+
const uvData = vertexData[uvSet];
|
|
234
|
+
if (uvData) {
|
|
235
|
+
const finalUV = new Float32Array(vertexCount * 2 * 2);
|
|
236
|
+
finalUV.set(new Float32Array(uvData), 0);
|
|
237
|
+
finalUV.set(new Float32Array(uvData), vertexCount * 2);
|
|
238
|
+
result[uvSet] = Array.from(finalUV);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Compute normals using the simplified approach
|
|
242
|
+
const normals = [];
|
|
243
|
+
VertexData.ComputeNormals(result.positions, result.indices, normals);
|
|
244
|
+
result.normals = normals;
|
|
245
|
+
return result;
|
|
246
|
+
};
|
|
247
|
+
if (this.evaluateContext) {
|
|
248
|
+
this.output._storedFunction = func;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.output._storedFunction = null;
|
|
252
|
+
this.output._storedValue = func(state);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_dumpPropertiesCode() {
|
|
256
|
+
let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
257
|
+
codeString += `${this._codeVariableName}.cap = BABYLON.ExtrudeGeometryCap.${ExtrudeGeometryCap[this.cap]};\n`;
|
|
258
|
+
return codeString;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Serializes this block in a JSON representation
|
|
262
|
+
* @returns the serialized block object
|
|
263
|
+
*/
|
|
264
|
+
serialize() {
|
|
265
|
+
const serializationObject = super.serialize();
|
|
266
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
267
|
+
serializationObject.cap = this.cap;
|
|
268
|
+
return serializationObject;
|
|
269
|
+
}
|
|
270
|
+
/** @internal */
|
|
271
|
+
_deserialize(serializationObject) {
|
|
272
|
+
super._deserialize(serializationObject);
|
|
273
|
+
if (serializationObject.evaluateContext !== undefined) {
|
|
274
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
275
|
+
}
|
|
276
|
+
if (serializationObject.cap !== undefined) {
|
|
277
|
+
this.cap = serializationObject.cap;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
__decorate([
|
|
282
|
+
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
283
|
+
], ExtrudeGeometryBlock.prototype, "evaluateContext", void 0);
|
|
284
|
+
__decorate([
|
|
285
|
+
editableInPropertyPage("Cap", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
286
|
+
notifiers: { rebuild: true },
|
|
287
|
+
embedded: true,
|
|
288
|
+
options: [
|
|
289
|
+
{ label: "No Cap", value: ExtrudeGeometryCap.NoCap },
|
|
290
|
+
{ label: "Cap Start", value: ExtrudeGeometryCap.CapStart },
|
|
291
|
+
{ label: "Cap End", value: ExtrudeGeometryCap.CapEnd },
|
|
292
|
+
{ label: "Cap All", value: ExtrudeGeometryCap.CapAll },
|
|
293
|
+
],
|
|
294
|
+
})
|
|
295
|
+
], ExtrudeGeometryBlock.prototype, "cap", void 0);
|
|
296
|
+
RegisterClass("BABYLON.ExtrudeGeometryBlock", ExtrudeGeometryBlock);
|
|
297
|
+
//# sourceMappingURL=extrudeGeometryBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extrudeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/extrudeGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC1B,2DAA2D;IAC3D,6DAAS,CAAA;IACT,6DAA6D;IAC7D,mEAAY,CAAA;IACZ,2DAA2D;IAC3D,+DAAU,CAAA;IACV,mEAAmE;IACnE,+DAAU,CAAA;AACd,CAAC,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AkB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC,MAAM,EAAE;YACtD,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC,MAAM,EAAE;SACzD;KACJ,CAAC;iDACqC;AAoS3C,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector3 } from \"../../../Maths/math.vector\";\r\nimport { VertexData } from \"../../mesh.vertexData\";\r\n\r\n/**\r\n * Cap mode for the extrusion\r\n */\r\nexport enum ExtrudeGeometryCap {\r\n /** No caps — only the extruded side walls are generated */\r\n NoCap = 0,\r\n /** Cap the bottom face (the original input geometry face) */\r\n CapStart = 1,\r\n /** Cap the top face (the offset/extruded geometry face) */\r\n CapEnd = 2,\r\n /** Cap both the bottom and top faces (default). Creates a solid */\r\n CapAll = 3,\r\n}\r\n\r\n/**\r\n * Block used to extrude a geometry along its face normals\r\n */\r\nexport class ExtrudeGeometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Gets or sets the cap mode for the extrusion\r\n */\r\n @editableInPropertyPage(\"Cap\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"No Cap\", value: ExtrudeGeometryCap.NoCap },\r\n { label: \"Cap Start\", value: ExtrudeGeometryCap.CapStart },\r\n { label: \"Cap End\", value: ExtrudeGeometryCap.CapEnd },\r\n { label: \"Cap All\", value: ExtrudeGeometryCap.CapAll },\r\n ],\r\n })\r\n public cap = ExtrudeGeometryCap.CapAll;\r\n\r\n /**\r\n * Create a new ExtrudeGeometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"depth\", NodeGeometryBlockConnectionPointTypes.Float, true, 1.0);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ExtrudeGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the depth input component\r\n */\r\n public get depth(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const inputGeometry = this.geometry.getConnectedValue(state) as VertexData;\r\n\r\n if (!inputGeometry || !inputGeometry.positions || !inputGeometry.indices) {\r\n return null;\r\n }\r\n\r\n const vertexData = inputGeometry.clone();\r\n const positions = vertexData.positions!;\r\n const indices = vertexData.indices!;\r\n const depthValue: number = this.depth.getConnectedValue(state) ?? 1.0;\r\n\r\n if (depthValue === 0) {\r\n return vertexData;\r\n }\r\n\r\n // Step 2: Compute average face normal\r\n const normal = new Vector3(0, 0, 0);\r\n const v0 = new Vector3();\r\n const v1 = new Vector3();\r\n const v2 = new Vector3();\r\n const edge1 = new Vector3();\r\n const edge2 = new Vector3();\r\n const faceNormal = new Vector3();\r\n\r\n for (let i = 0; i < indices.length; i += 3) {\r\n const i0 = indices[i];\r\n const i1 = indices[i + 1];\r\n const i2 = indices[i + 2];\r\n\r\n v0.set(positions[i0 * 3], positions[i0 * 3 + 1], positions[i0 * 3 + 2]);\r\n v1.set(positions[i1 * 3], positions[i1 * 3 + 1], positions[i1 * 3 + 2]);\r\n v2.set(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2]);\r\n\r\n v1.subtractToRef(v0, edge1);\r\n v2.subtractToRef(v0, edge2);\r\n Vector3.CrossToRef(edge1, edge2, faceNormal);\r\n\r\n normal.addInPlace(faceNormal);\r\n }\r\n\r\n if (normal.lengthSquared() < 1e-10) {\r\n normal.set(0, 1, 0);\r\n } else {\r\n normal.normalize();\r\n }\r\n\r\n // Step 3: Create offset positions\r\n const offset = normal.scale(depthValue);\r\n const vertexCount = positions.length / 3;\r\n const bottomPositions = new Float32Array(positions);\r\n const topPositions = new Float32Array(vertexCount * 3);\r\n\r\n for (let i = 0; i < vertexCount; i++) {\r\n topPositions[i * 3] = positions[i * 3] + offset.x;\r\n topPositions[i * 3 + 1] = positions[i * 3 + 1] + offset.y;\r\n topPositions[i * 3 + 2] = positions[i * 3 + 2] + offset.z;\r\n }\r\n\r\n // Step 4: Detect boundary edges\r\n const edgeCount = new Map<string, { count: number; triIndex: number }>();\r\n for (let i = 0; i < indices.length; i += 3) {\r\n const triIdx = i;\r\n const triVerts = [indices[i], indices[i + 1], indices[i + 2]];\r\n\r\n for (let e = 0; e < 3; e++) {\r\n const a = triVerts[e];\r\n const b = triVerts[(e + 1) % 3];\r\n const key = Math.min(a, b) + \"_\" + Math.max(a, b);\r\n\r\n const existing = edgeCount.get(key);\r\n if (existing) {\r\n existing.count++;\r\n } else {\r\n edgeCount.set(key, { count: 1, triIndex: triIdx });\r\n }\r\n }\r\n }\r\n\r\n // Collect boundary edges with winding info\r\n const boundaryEdges: { a: number; b: number; orderedAb: boolean }[] = [];\r\n for (const [key, value] of Array.from(edgeCount)) {\r\n if (value.count === 1) {\r\n const parts = key.split(\"_\");\r\n const minV = parseInt(parts[0]);\r\n const maxV = parseInt(parts[1]);\r\n\r\n // Check original winding order in the triangle\r\n const ti = value.triIndex;\r\n const t0 = indices[ti];\r\n const t1 = indices[ti + 1];\r\n const t2 = indices[ti + 2];\r\n\r\n // Determine if edge (minV, maxV) appears in order or reversed in the triangle\r\n let inOrder = false;\r\n if ((t0 === minV && t1 === maxV) || (t1 === minV && t2 === maxV) || (t2 === minV && t0 === maxV)) {\r\n inOrder = true;\r\n }\r\n\r\n boundaryEdges.push({ a: minV, b: maxV, orderedAb: inOrder });\r\n }\r\n }\r\n\r\n // Step 5: Generate side wall faces\r\n const sideIndices: number[] = [];\r\n for (const edge of boundaryEdges) {\r\n const a = edge.a;\r\n const b = edge.b;\r\n const aTop = a + vertexCount;\r\n const bTop = b + vertexCount;\r\n\r\n if (edge.orderedAb) {\r\n // Edge appears as (a, b) in triangle — outward normals\r\n sideIndices.push(a, b, bTop);\r\n sideIndices.push(a, bTop, aTop);\r\n } else {\r\n // Edge appears as (b, a) in triangle — reverse winding\r\n sideIndices.push(b, a, aTop);\r\n sideIndices.push(b, aTop, bTop);\r\n }\r\n }\r\n\r\n // Step 6: Assemble final VertexData\r\n const capStart = (this.cap & ExtrudeGeometryCap.CapStart) !== 0;\r\n const capEnd = (this.cap & ExtrudeGeometryCap.CapEnd) !== 0;\r\n\r\n // Build indices\r\n const finalIndices: number[] = [];\r\n\r\n // Bottom cap: original indices\r\n if (capStart) {\r\n for (let i = 0; i < indices.length; i++) {\r\n finalIndices.push(indices[i]);\r\n }\r\n }\r\n\r\n // Top cap: original indices offset by vertexCount, reversed winding\r\n if (capEnd) {\r\n for (let i = 0; i < indices.length; i += 3) {\r\n finalIndices.push(indices[i] + vertexCount);\r\n finalIndices.push(indices[i + 2] + vertexCount);\r\n finalIndices.push(indices[i + 1] + vertexCount);\r\n }\r\n }\r\n\r\n // Side walls\r\n for (let i = 0; i < sideIndices.length; i++) {\r\n finalIndices.push(sideIndices[i]);\r\n }\r\n\r\n // Build positions: [bottom, top]\r\n const finalPositions = new Float32Array(vertexCount * 2 * 3);\r\n finalPositions.set(bottomPositions, 0);\r\n finalPositions.set(topPositions, vertexCount * 3);\r\n\r\n // Build the result VertexData\r\n const result = new VertexData();\r\n result.positions = Array.from(finalPositions);\r\n result.indices = finalIndices;\r\n\r\n // Duplicate UVs if present\r\n if (vertexData.uvs) {\r\n const uvs = vertexData.uvs;\r\n const finalUVs = new Float32Array(vertexCount * 2 * 2);\r\n finalUVs.set(new Float32Array(uvs), 0);\r\n finalUVs.set(new Float32Array(uvs), vertexCount * 2);\r\n result.uvs = Array.from(finalUVs);\r\n }\r\n\r\n // Duplicate colors if present\r\n if (vertexData.colors) {\r\n const colors = vertexData.colors;\r\n const finalColors = new Float32Array(vertexCount * 2 * 4);\r\n finalColors.set(new Float32Array(colors), 0);\r\n finalColors.set(new Float32Array(colors), vertexCount * 4);\r\n result.colors = Array.from(finalColors);\r\n }\r\n\r\n // Duplicate tangents if present\r\n if (vertexData.tangents) {\r\n const tangents = vertexData.tangents;\r\n const finalTangents = new Float32Array(vertexCount * 2 * 4);\r\n finalTangents.set(new Float32Array(tangents), 0);\r\n finalTangents.set(new Float32Array(tangents), vertexCount * 4);\r\n result.tangents = Array.from(finalTangents);\r\n }\r\n\r\n // Duplicate UV2-UV6 if present\r\n const uvSets = [\"uvs2\", \"uvs3\", \"uvs4\", \"uvs5\", \"uvs6\"] as const;\r\n for (const uvSet of uvSets) {\r\n const uvData = (vertexData as any)[uvSet];\r\n if (uvData) {\r\n const finalUV = new Float32Array(vertexCount * 2 * 2);\r\n finalUV.set(new Float32Array(uvData), 0);\r\n finalUV.set(new Float32Array(uvData), vertexCount * 2);\r\n (result as any)[uvSet] = Array.from(finalUV);\r\n }\r\n }\r\n\r\n // Compute normals using the simplified approach\r\n const normals: number[] = [];\r\n VertexData.ComputeNormals(result.positions, result.indices, normals);\r\n result.normals = normals;\r\n\r\n return result;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.cap = BABYLON.ExtrudeGeometryCap.${ExtrudeGeometryCap[this.cap]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.cap = this.cap;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n if (serializationObject.cap !== undefined) {\r\n this.cap = serializationObject.cap;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ExtrudeGeometryBlock\", ExtrudeGeometryBlock);\r\n"]}
|
|
@@ -105,7 +105,7 @@ export class MappingBlock extends NodeGeometryBlock {
|
|
|
105
105
|
const absY = Math.abs(normal.y);
|
|
106
106
|
const absZ = Math.abs(normal.z);
|
|
107
107
|
const maxDim = Math.max(Math.abs(position.x), Math.abs(position.y), Math.abs(position.z));
|
|
108
|
-
let u
|
|
108
|
+
let u, v;
|
|
109
109
|
if (absX >= absY && absX >= absZ) {
|
|
110
110
|
u = position.y / maxDim - center.y;
|
|
111
111
|
v = position.z / max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;QACd,CAAC,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YAChC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACN,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,mCAAmC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE3C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AA9IU;IATN,sBAAsB,CAAC,SAAS,uCAA+B,UAAU,EAAE;QACxE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE;YACrD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE;YACzD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE;SAChD;KACJ,CAAC;6CACsC;AAgJ5C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Type of mappings supported by the mapping block\r\n */\r\nexport enum MappingTypes {\r\n /** Spherical */\r\n Spherical,\r\n /** Cylindrical */\r\n Cylindrical,\r\n /** Cubic */\r\n Cubic,\r\n}\r\n\r\n/**\r\n * Block used to generate UV coordinates\r\n */\r\nexport class MappingBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the mapping type used by the block\r\n */\r\n @editableInPropertyPage(\"Mapping\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Spherical\", value: MappingTypes.Spherical },\r\n { label: \"Cylindrical\", value: MappingTypes.Cylindrical },\r\n { label: \"Cubic\", value: MappingTypes.Cubic },\r\n ],\r\n })\r\n public mapping = MappingTypes.Spherical;\r\n\r\n /**\r\n * Create a new MappingBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"normal\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"center\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerOutput(\"uv\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"MappingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the normal input component\r\n */\r\n public get normal(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the center input component\r\n */\r\n public get center(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get uv(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.position.isConnected) {\r\n this.uv._storedFunction = null;\r\n this.uv._storedValue = null;\r\n return;\r\n }\r\n const tempDirection = Vector3.Zero();\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const position = (this.position.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const normal = (this.normal.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const center = this.center.getConnectedValue(state) as Vector3;\r\n const uv = Vector2.Zero();\r\n\r\n switch (this.mapping) {\r\n case MappingTypes.Spherical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.acos(tempDirection.y / len) / Math.PI;\r\n if (tempDirection.x !== 0 || tempDirection.z !== 0) {\r\n uv.y = Math.atan2(tempDirection.x, tempDirection.z) / (Math.PI * 2);\r\n }\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cylindrical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.atan2(tempDirection.x / len, tempDirection.z / len) / (Math.PI * 2);\r\n uv.y = (tempDirection.y + 1.0) / 2.0;\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cubic: {\r\n // Find the largest component of the normal vector\r\n const absX = Math.abs(normal.x);\r\n const absY = Math.abs(normal.y);\r\n const absZ = Math.abs(normal.z);\r\n const maxDim = Math.max(Math.abs(position.x), Math.abs(position.y), Math.abs(position.z));\r\n\r\n let u = 0,\r\n v = 0;\r\n\r\n if (absX >= absY && absX >= absZ) {\r\n u = position.y / maxDim - center.y;\r\n v = position.z / maxDim - center.z;\r\n } else if (absY >= absX && absY >= absZ) {\r\n u = position.x / maxDim - center.x;\r\n v = position.z / maxDim - center.z;\r\n } else {\r\n u = position.x / maxDim - center.x;\r\n v = position.y / maxDim - center.y;\r\n }\r\n\r\n uv.x = (u + 1) / 2;\r\n uv.y = (v + 1) / 2;\r\n }\r\n }\r\n return uv;\r\n };\r\n\r\n this.uv._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.mapping = BABYLON.MappingTypes.${MappingTypes[this.mapping]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mapping = this.mapping;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.mapping = serializationObject.mapping;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MappingBlock\", MappingBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"mappingBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mappingBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACpB,gBAAgB;IAChB,yDAAS,CAAA;IACT,kBAAkB;IAClB,6DAAW,CAAA;IACX,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jD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AA7IU;IATN,sBAAsB,CAAC,SAAS,uCAA+B,UAAU,EAAE;QACxE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE;YACrD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE;YACzD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE;SAChD;KACJ,CAAC;6CACsC;AA+I5C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Type of mappings supported by the mapping block\r\n */\r\nexport enum MappingTypes {\r\n /** Spherical */\r\n Spherical,\r\n /** Cylindrical */\r\n Cylindrical,\r\n /** Cubic */\r\n Cubic,\r\n}\r\n\r\n/**\r\n * Block used to generate UV coordinates\r\n */\r\nexport class MappingBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the mapping type used by the block\r\n */\r\n @editableInPropertyPage(\"Mapping\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Spherical\", value: MappingTypes.Spherical },\r\n { label: \"Cylindrical\", value: MappingTypes.Cylindrical },\r\n { label: \"Cubic\", value: MappingTypes.Cubic },\r\n ],\r\n })\r\n public mapping = MappingTypes.Spherical;\r\n\r\n /**\r\n * Create a new MappingBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"normal\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"center\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerOutput(\"uv\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"MappingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the normal input component\r\n */\r\n public get normal(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the center input component\r\n */\r\n public get center(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get uv(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.position.isConnected) {\r\n this.uv._storedFunction = null;\r\n this.uv._storedValue = null;\r\n return;\r\n }\r\n const tempDirection = Vector3.Zero();\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const position = (this.position.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const normal = (this.normal.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const center = this.center.getConnectedValue(state) as Vector3;\r\n const uv = Vector2.Zero();\r\n\r\n switch (this.mapping) {\r\n case MappingTypes.Spherical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.acos(tempDirection.y / len) / Math.PI;\r\n if (tempDirection.x !== 0 || tempDirection.z !== 0) {\r\n uv.y = Math.atan2(tempDirection.x, tempDirection.z) / (Math.PI * 2);\r\n }\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cylindrical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.atan2(tempDirection.x / len, tempDirection.z / len) / (Math.PI * 2);\r\n uv.y = (tempDirection.y + 1.0) / 2.0;\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cubic: {\r\n // Find the largest component of the normal vector\r\n const absX = Math.abs(normal.x);\r\n const absY = Math.abs(normal.y);\r\n const absZ = Math.abs(normal.z);\r\n const maxDim = Math.max(Math.abs(position.x), Math.abs(position.y), Math.abs(position.z));\r\n\r\n let u: number, v: number;\r\n\r\n if (absX >= absY && absX >= absZ) {\r\n u = position.y / maxDim - center.y;\r\n v = position.z / maxDim - center.z;\r\n } else if (absY >= absX && absY >= absZ) {\r\n u = position.x / maxDim - center.x;\r\n v = position.z / maxDim - center.z;\r\n } else {\r\n u = position.x / maxDim - center.x;\r\n v = position.y / maxDim - center.y;\r\n }\r\n\r\n uv.x = (u + 1) / 2;\r\n uv.y = (v + 1) / 2;\r\n }\r\n }\r\n return uv;\r\n };\r\n\r\n this.uv._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.mapping = BABYLON.MappingTypes.${MappingTypes[this.mapping]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mapping = this.mapping;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.mapping = serializationObject.mapping;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MappingBlock\", MappingBlock);\r\n"]}
|
package/Meshes/Node/index.d.ts
CHANGED
package/Meshes/Node/index.js
CHANGED
|
@@ -85,4 +85,5 @@ export * from "./Blocks/geometryInterceptorBlock.js";
|
|
|
85
85
|
export * from "./Blocks/geometryEaseBlock.js";
|
|
86
86
|
export * from "./Blocks/Set/aggregatorBlock.js";
|
|
87
87
|
export * from "./Blocks/subdivideBlock.js";
|
|
88
|
+
export * from "./Blocks/extrudeGeometryBlock.js";
|
|
88
89
|
//# sourceMappingURL=index.js.map
|