@babylonjs/core 5.0.0-beta.2 → 5.0.0-beta.6
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/Actions/actionManager.d.ts +1 -1
- package/Actions/actionManager.js +5 -1
- package/Actions/actionManager.js.map +1 -1
- package/Audio/analyser.d.ts +2 -1
- package/Audio/analyser.js +5 -0
- package/Audio/analyser.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +1 -1
- package/Audio/audioSceneComponent.js +5 -0
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.d.ts +1 -1
- package/Audio/sound.js +8 -1
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.d.ts +2 -1
- package/Audio/soundTrack.js +5 -0
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +5 -0
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.js +29 -26
- package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.d.ts +2 -1
- package/Bones/bone.js +28 -18
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +3 -3
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.d.ts +4 -0
- package/Buffers/buffer.js +13 -3
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -0
- package/Cameras/Inputs/freeCameraMouseInput.js +6 -3
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +2 -4
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +1 -0
- package/Cameras/VR/vrExperienceHelper.js +1 -0
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/webVRCamera.d.ts +2 -1
- package/Cameras/VR/webVRCamera.js +3 -2
- package/Cameras/VR/webVRCamera.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +1 -1
- package/Cameras/camera.js +1 -1
- package/Cameras/camera.js.map +1 -1
- package/Cameras/deviceOrientationCamera.d.ts +1 -1
- package/Cameras/deviceOrientationCamera.js.map +1 -1
- package/Cameras/flyCamera.d.ts +1 -1
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/followCamera.d.ts +1 -1
- package/Cameras/followCamera.js.map +1 -1
- package/Cameras/freeCamera.d.ts +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +1 -1
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +1 -1
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +1 -1
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Collisions/collider.d.ts +1 -1
- package/Collisions/collider.js +48 -2
- package/Collisions/collider.js.map +1 -1
- package/Compute/computeEffect.js +2 -2
- package/Compute/computeEffect.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.d.ts +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +5 -0
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/ray.d.ts +6 -4
- package/Culling/ray.js +33 -11
- package/Culling/ray.js.map +1 -1
- package/Debug/axesViewer.d.ts +2 -1
- package/Debug/axesViewer.js +6 -0
- package/Debug/axesViewer.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js +6 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/physicsViewer.d.ts +1 -1
- package/Debug/physicsViewer.js +3 -0
- package/Debug/physicsViewer.js.map +1 -1
- package/DeviceInput/Helpers/eventFactory.d.ts +1 -1
- package/DeviceInput/Helpers/eventFactory.js +1 -1
- package/DeviceInput/Helpers/eventFactory.js.map +1 -1
- package/DeviceInput/InputDevices/deviceEnums.d.ts +52 -1
- package/DeviceInput/InputDevices/deviceEnums.js +52 -0
- package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSource.d.ts +35 -0
- package/DeviceInput/InputDevices/deviceSource.js +38 -0
- package/DeviceInput/InputDevices/deviceSource.js.map +1 -0
- package/DeviceInput/InputDevices/deviceSourceManager.d.ts +14 -72
- package/DeviceInput/InputDevices/deviceSourceManager.js +10 -180
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/InputDevices/deviceTypes.d.ts +2 -2
- package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
- package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.d.ts +1 -5
- package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.js +0 -0
- package/DeviceInput/InputDevices/inputInterfaces.js.map +1 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.d.ts +46 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.js +144 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +1 -0
- package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.d.ts +3 -7
- package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.js +9 -15
- package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +1 -0
- package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.d.ts +11 -15
- package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.js +116 -95
- package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -0
- package/DeviceInput/index.d.ts +1 -5
- package/DeviceInput/index.js +1 -5
- package/DeviceInput/index.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +5 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiview.d.ts +5 -0
- package/Engines/Extensions/engine.multiview.js +4 -1
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Processors/Expressions/shaderDefineExpression.js +1 -1
- package/Engines/Processors/Expressions/shaderDefineExpression.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js +13 -13
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +9 -9
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -7
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.d.ts +2 -0
- package/Engines/WebGPU/webgpuCacheSampler.js +23 -2
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +3 -3
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +0 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -8
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +13 -13
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +30 -30
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +0 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +8 -30
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/engine.d.ts +3 -7
- package/Engines/engine.js +2 -6
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +4 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -0
- package/Engines/nativeEngine.js +39 -12
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +3 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +11 -2
- package/Engines/thinEngine.js +34 -21
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +3 -7
- package/Engines/webgpuEngine.js +12 -22
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/Controllers/daydreamController.js +1 -1
- package/Gamepads/Controllers/daydreamController.js.map +1 -1
- package/Gamepads/Controllers/oculusTouchController.js +2 -2
- package/Gamepads/Controllers/oculusTouchController.js.map +1 -1
- package/Gamepads/Controllers/webVRController.d.ts +1 -0
- package/Gamepads/Controllers/webVRController.js +1 -0
- package/Gamepads/Controllers/webVRController.js.map +1 -1
- package/Gamepads/gamepadManager.js +1 -1
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +2 -0
- package/Gizmos/gizmoManager.js +28 -24
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Helpers/sceneHelpers.d.ts +1 -0
- package/Helpers/sceneHelpers.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +2 -2
- package/Inputs/scene.inputManager.js +10 -9
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.js +2 -2
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/effectLayerSceneComponent.d.ts +1 -1
- package/Layers/effectLayerSceneComponent.js +7 -3
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layer.d.ts +2 -2
- package/Layers/layer.js.map +1 -1
- package/Layers/layerSceneComponent.d.ts +1 -1
- package/Layers/layerSceneComponent.js +7 -3
- package/Layers/layerSceneComponent.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +115 -29
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/loadingScreen.js +8 -8
- package/Loading/loadingScreen.js.map +1 -1
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +37 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +117 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -0
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +12 -12
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +5 -5
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +13 -13
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
- package/Materials/Node/Blocks/Dual/index.js +1 -0
- package/Materials/Node/Blocks/Dual/index.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +10 -10
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +28 -28
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -7
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +32 -32
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/discardBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +10 -10
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +7 -7
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +12 -12
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +7 -7
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/twirlBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +2 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +29 -24
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +5 -5
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +5 -5
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +33 -33
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +11 -11
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +11 -11
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +7 -7
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +5 -5
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +16 -16
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/addBlock.js +1 -1
- package/Materials/Node/Blocks/addBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +3 -3
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +7 -7
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +8 -8
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorSplitterBlock.js +5 -5
- package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.js +10 -10
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/crossBlock.js +1 -1
- package/Materials/Node/Blocks/crossBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -1
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/desaturateBlock.js +4 -4
- package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
- package/Materials/Node/Blocks/distanceBlock.js +1 -1
- package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
- package/Materials/Node/Blocks/divideBlock.js +1 -1
- package/Materials/Node/Blocks/divideBlock.js.map +1 -1
- package/Materials/Node/Blocks/dotBlock.js +1 -1
- package/Materials/Node/Blocks/dotBlock.js.map +1 -1
- package/Materials/Node/Blocks/elbowBlock.d.ts +27 -0
- package/Materials/Node/Blocks/elbowBlock.js +60 -0
- package/Materials/Node/Blocks/elbowBlock.js.map +1 -0
- package/Materials/Node/Blocks/fresnelBlock.js +2 -2
- package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.js +8 -8
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/lengthBlock.js +1 -1
- package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
- package/Materials/Node/Blocks/lerpBlock.js +1 -1
- package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/maxBlock.js +1 -1
- package/Materials/Node/Blocks/maxBlock.js.map +1 -1
- package/Materials/Node/Blocks/minBlock.js +1 -1
- package/Materials/Node/Blocks/minBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -1
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/negateBlock.js +1 -1
- package/Materials/Node/Blocks/negateBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalBlendBlock.js +5 -5
- package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/powBlock.js +1 -1
- package/Materials/Node/Blocks/powBlock.js.map +1 -1
- package/Materials/Node/Blocks/randomNumberBlock.js +2 -2
- package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
- package/Materials/Node/Blocks/reflectBlock.js +1 -1
- package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
- package/Materials/Node/Blocks/refractBlock.js +1 -1
- package/Materials/Node/Blocks/refractBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +3 -3
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/replaceColorBlock.js +3 -3
- package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
- package/Materials/Node/Blocks/scaleBlock.js +1 -1
- package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/smoothStepBlock.js +1 -1
- package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
- package/Materials/Node/Blocks/stepBlock.js +1 -1
- package/Materials/Node/Blocks/stepBlock.js.map +1 -1
- package/Materials/Node/Blocks/subtractBlock.js +1 -1
- package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +13 -13
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +2 -2
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +22 -22
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorSplitterBlock.js +8 -8
- package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +5 -5
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.js +3 -3
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +5 -5
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialSystemValues.d.ts +3 -1
- package/Materials/Node/Enums/nodeMaterialSystemValues.js +2 -0
- package/Materials/Node/Enums/nodeMaterialSystemValues.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +4 -0
- package/Materials/Node/nodeMaterial.js +22 -11
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +12 -12
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +24 -24
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
- package/Materials/PBR/pbrBaseMaterial.js +4 -3
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMaterial.js +2 -3
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js +8 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.d.ts +2 -1
- package/Materials/Textures/MultiviewRenderTarget.js +10 -2
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.d.ts +2 -2
- package/Materials/Textures/mirrorTexture.js +7 -3
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/prePassRenderTarget.d.ts +1 -1
- package/Materials/Textures/prePassRenderTarget.js.map +1 -1
- package/Materials/Textures/refractionTexture.d.ts +1 -1
- package/Materials/Textures/refractionTexture.js +2 -2
- package/Materials/Textures/refractionTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +1 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +1 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.js +3 -3
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +3 -1
- package/Materials/material.js +11 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.js +4 -1
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +3 -3
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/multiMaterial.d.ts +3 -1
- package/Materials/multiMaterial.js +13 -11
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/pushMaterial.d.ts +1 -1
- package/Materials/pushMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +8 -4
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +1 -1
- package/Materials/shadowDepthWrapper.js +3 -3
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -6
- package/Materials/standardMaterial.js +5 -10
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.path.d.ts +1 -0
- package/Maths/math.path.js +1 -0
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.size.js +1 -1
- package/Maths/math.size.js.map +1 -1
- package/Maths/math.vector.d.ts +5 -2
- package/Maths/math.vector.js +35 -32
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
- package/Meshes/Builders/cylinderBuilder.js +1 -1
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/geodesicBuilder.d.ts +1 -0
- package/Meshes/Builders/geodesicBuilder.js +1 -0
- package/Meshes/Builders/geodesicBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.d.ts +1 -0
- package/Meshes/Builders/goldbergBuilder.js +1 -0
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +30 -11
- package/Meshes/Builders/tiledBoxBuilder.js +30 -11
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.d.ts +21 -16
- package/Meshes/Builders/tiledPlaneBuilder.js +21 -16
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +3 -0
- package/Meshes/Compression/dracoCompression.js +23 -7
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +6 -0
- package/Meshes/abstractMesh.js +18 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +1 -1
- package/Meshes/geometry.js +7 -3
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.d.ts +1 -1
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/mesh.js +21 -6
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.lts.d.ts +1 -1
- package/Meshes/mesh.lts.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +1 -1
- package/Meshes/mesh.vertexData.js +2 -2
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/polygonMesh.js +2 -2
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -2
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/subMesh.project.js +1 -2
- package/Meshes/subMesh.project.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +5 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/trailMesh.d.ts +1 -1
- package/Meshes/trailMesh.js.map +1 -1
- package/Meshes/transformNode.js +40 -13
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +5 -0
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +13 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +36 -19
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/assetsManager.d.ts +2 -1
- package/Misc/assetsManager.js +15 -1
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +1 -1
- package/Misc/basis.js.map +1 -1
- package/Misc/brdfTextureTools.js +4 -1
- package/Misc/brdfTextureTools.js.map +1 -1
- package/Misc/dds.js +7 -0
- package/Misc/dds.js.map +1 -1
- package/Misc/devTools.js +1 -1
- package/Misc/devTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +4 -4
- package/Misc/fileTools.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +4 -3
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/reflector.js +6 -6
- package/Misc/reflector.js.map +1 -1
- package/Misc/tools.js +15 -13
- package/Misc/tools.js.map +1 -1
- package/Misc/uniqueIdGenerator.js +1 -1
- package/Misc/uniqueIdGenerator.js.map +1 -1
- package/Offline/database.js +1 -1
- package/Offline/database.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +4 -1
- package/Particles/baseParticleSystem.js +20 -5
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +2 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleHelper.js +2 -2
- package/Particles/particleHelper.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +5 -1
- package/Physics/Plugins/ammoJSPlugin.js +16 -11
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/physicsEngine.d.ts +1 -0
- package/Physics/physicsEngine.js +3 -1
- package/Physics/physicsEngine.js.map +1 -1
- package/Physics/physicsImpostor.d.ts +2 -2
- package/Physics/physicsImpostor.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +5 -5
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +1 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.js +2 -2
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +3 -3
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +8 -8
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +4 -0
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/prePassVertex.js +1 -1
- package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
- package/Shaders/color.fragment.js +1 -1
- package/Shaders/color.fragment.js.map +1 -1
- package/Shaders/color.vertex.js +1 -1
- package/Shaders/color.vertex.js.map +1 -1
- package/Shaders/default.fragment.js +1 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +1 -1
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/pbr.vertex.js +1 -1
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/Sprites/spriteManager.js +9 -10
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.js +2 -2
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spriteRenderer.js +1 -1
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +15 -9
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRDOMOverlay.js +1 -1
- package/XR/features/WebXRDOMOverlay.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +30 -30
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRImageTracking.js +2 -2
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.d.ts +28 -5
- package/XR/features/WebXRLayers.js +54 -20
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +35 -3
- package/XR/features/WebXRNearInteraction.js +201 -40
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.js +1 -1
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.js +2 -2
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +1 -1
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +17 -4
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.js +3 -0
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXREnterExitUI.js +2 -2
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +3 -2
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +6 -6
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRInputSource.js +3 -3
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.d.ts +3 -2
- package/XR/webXRRenderTargetTextureProvider.js +37 -18
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +1 -0
- package/XR/webXRSessionManager.js +6 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.d.ts +1 -1
- package/assetContainer.js +4 -0
- package/assetContainer.js.map +1 -1
- package/node.d.ts +1 -1
- package/node.js.map +1 -1
- package/package.json +22 -13
- package/scene.d.ts +5 -2
- package/scene.js +31 -5
- package/scene.js.map +1 -1
- package/DeviceInput/Implementations/nativeDeviceInputSystem.js.map +0 -1
- package/DeviceInput/Implementations/webDeviceInputSystem.js.map +0 -1
- package/DeviceInput/Interfaces/inputInterfaces.js.map +0 -1
- package/DeviceInput/deviceInputSystem.d.ts +0 -60
- package/DeviceInput/deviceInputSystem.js +0 -84
- package/DeviceInput/deviceInputSystem.js.map +0 -1
|
@@ -14,7 +14,7 @@ import { VertexData } from "../mesh.vertexData";
|
|
|
14
14
|
* * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
|
|
15
15
|
* * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
|
|
16
16
|
* * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
|
|
17
|
-
* * hasRings when true makes each subdivision
|
|
17
|
+
* * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false
|
|
18
18
|
* * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake
|
|
19
19
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
20
20
|
* * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
|
|
@@ -16,7 +16,7 @@ import { Axis } from '../../Maths/math.axis.js';
|
|
|
16
16
|
* * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
|
|
17
17
|
* * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
|
|
18
18
|
* * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
|
|
19
|
-
* * hasRings when true makes each subdivision
|
|
19
|
+
* * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false
|
|
20
20
|
* * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake
|
|
21
21
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
22
22
|
* * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAA2T;IAChW,IAAI,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IACzC,IAAI,WAAW,GAAW,CAAC,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IACzG,IAAI,cAAc,GAAW,CAAC,OAAO,CAAC,c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AAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAEpD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC3B,cAAc,gBAAA;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC;AAErD,IAAI,CAAC,cAAc,GAAG,UAAC,IAAY,EAAE,MAAc,EAAE,WAAmB,EAAE,cAAsB,EAAE,YAAoB,EAAE,YAAiB,EAAE,KAAa,EAAE,SAAe,EAAE,eAAwB;IAC/L,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE;QAClD,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,eAAe,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC;YAChD,SAAS,GAAG,KAAK,CAAC;SACrB;QACD,KAAK,GAAU,YAAY,CAAC;QAC5B,YAAY,GAAG,CAAC,CAAC;KACpB;IAED,IAAM,OAAO,GAAG;QACZ,MAAM,QAAA;QACN,WAAW,aAAA;QACX,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,eAAe,iBAAA;QACf,SAAS,WAAA;KACZ,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Nullable } from \"../../types\";\r\nimport { Axis } from '../../Maths/math.axis';\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\nexport function CreateCylinderVertexData(options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }): VertexData {\r\n var height: number = options.height || 2;\r\n var diameterTop: number = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom: number = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation: number = options.tessellation || 24;\r\n var subdivisions: number = options.subdivisions || 1;\r\n var hasRings: boolean = options.hasRings ? true : false;\r\n var enclose: boolean = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation: number = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb: number = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb: number = (hasRings) ? subdivisions : 1;\r\n var surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n var f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n var indices = new Array<number>();\r\n var positions = new Array<number>();\r\n var normals = new Array<number>();\r\n var uvs = new Array<number>();\r\n var colors = new Array<number>();\r\n\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle: number;\r\n var h: number;\r\n var radius: number;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex: Vector3 = Vector3.Zero();\r\n var ringNormal: Vector3 = Vector3.Zero();\r\n var ringFirstVertex: Vector3 = Vector3.Zero();\r\n var ringFirstNormal: Vector3 = Vector3.Zero();\r\n var quadNormal: Vector3 = Vector3.Zero();\r\n var Y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n var i: number;\r\n var j: number;\r\n var r: number;\r\n var ringIdx: number = 1;\r\n var s: number = 1; // surface index\r\n var cs: number = 0;\r\n var v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n // indices\r\n var e: number = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s: number;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n\r\n // Caps\r\n var createCylinderCap = (isTop: boolean) => {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i: number;\r\n var u: Vector4 = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n var vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 } = {}, scene: any): Mesh {\r\n var cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n var vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n CreateCylinder\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};"]}
|
|
1
|
+
{"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE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AAS,WAAA;KACZ,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Nullable } from \"../../types\";\r\nimport { Axis } from '../../Maths/math.axis';\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\nexport function CreateCylinderVertexData(options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }): VertexData {\r\n var height: number = options.height || 2;\r\n var diameterTop: number = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom: number = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation: number = options.tessellation || 24;\r\n var subdivisions: number = options.subdivisions || 1;\r\n var hasRings: boolean = options.hasRings ? true : false;\r\n var enclose: boolean = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation: number = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb: number = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb: number = (hasRings) ? subdivisions : 1;\r\n var surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n var f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n var indices = new Array<number>();\r\n var positions = new Array<number>();\r\n var normals = new Array<number>();\r\n var uvs = new Array<number>();\r\n var colors = new Array<number>();\r\n\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle: number;\r\n var h: number;\r\n var radius: number;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex: Vector3 = Vector3.Zero();\r\n var ringNormal: Vector3 = Vector3.Zero();\r\n var ringFirstVertex: Vector3 = Vector3.Zero();\r\n var ringFirstNormal: Vector3 = Vector3.Zero();\r\n var quadNormal: Vector3 = Vector3.Zero();\r\n var Y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n var i: number;\r\n var j: number;\r\n var r: number;\r\n var ringIdx: number = 1;\r\n var s: number = 1; // surface index\r\n var cs: number = 0;\r\n var v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n // indices\r\n var e: number = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s: number;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n\r\n // Caps\r\n var createCylinderCap = (isTop: boolean) => {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i: number;\r\n var u: Vector4 = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n var vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 } = {}, scene: any): Mesh {\r\n var cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n var vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n CreateCylinder\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};"]}
|
|
@@ -6,6 +6,7 @@ import { Nullable } from '../../types';
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates the Mesh for a Geodesic Polyhedron
|
|
8
8
|
* @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
|
|
9
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
|
|
9
10
|
* @param name defines the name of the mesh
|
|
10
11
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
11
12
|
* * m number of horizontal steps along an isogrid
|
|
@@ -4,6 +4,7 @@ import { _PrimaryIsoTriangle, GeodesicData } from "../geodesicMesh.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates the Mesh for a Geodesic Polyhedron
|
|
6
6
|
* @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
|
|
7
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
|
|
7
8
|
* @param name defines the name of the mesh
|
|
8
9
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
9
10
|
* * m number of horizontal steps along an isogrid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/geodesicBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/geodesicBuilder.ts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,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC;IACF,IAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { CreatePolyhedron } from \"./polyhedronBuilder\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\n\r\n/**\r\n * Creates the Mesh for a Geodesic Polyhedron\r\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * m number of horizontal steps along an isogrid\r\n * * n number of angled steps along an isogrid\r\n * * size the size of the Geodesic, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @param scene defines the hosting scene\r\n * @returns Geodesic mesh\r\n */\r\nexport function CreateGeodesic(name: string, options: { m?: number, n?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Nullable<Scene> = null): Mesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n\r\n const geoOptions: object = {\r\n custom: geodesicData,\r\n size: options.size,\r\n sizeX: options.sizeX,\r\n sizeY: options.sizeY,\r\n sizeZ: options.sizeZ,\r\n faceUV: options.faceUV,\r\n faceColors: options.faceColors,\r\n flat: options.flat,\r\n updatable: options.updatable,\r\n sideOrientation: options.sideOrientation,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs\r\n };\r\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\r\n\r\n return geodesic;\r\n}"]}
|
|
@@ -56,6 +56,7 @@ export declare function CreateGoldbergVertexData(options: GoldbergVertexDataOpti
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
|
|
58
58
|
* @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
|
|
59
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
|
|
59
60
|
* @param name defines the name of the mesh
|
|
60
61
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
61
62
|
* @param scene defines the hosting scene
|
|
@@ -63,6 +63,7 @@ export function CreateGoldbergVertexData(options, goldbergData) {
|
|
|
63
63
|
/**
|
|
64
64
|
* Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
|
|
65
65
|
* @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
|
|
66
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
|
|
66
67
|
* @param name defines the name of the mesh
|
|
67
68
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
68
69
|
* @param scene defines the hosting scene
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,E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AO,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAC/C,IAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAC9C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
|
|
1
|
+
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8C/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IACpG,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,eAAe,GAAG,CAAC,OAAO,CAAC,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,IAAI,UAAU,CAAC,WAAW,CAAC;IAEhH,IAAM,SAAS,GAAG,IAAI,KAAK,EAAU,CAAC;IACtC,IAAM,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC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AAC,CAAC;QACrD,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linesBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/linesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI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,CAAC;AAEF,IAAI,CAAC,iBAAiB,GAAG,UAAC,IAAY,EAAE,MAAiB,EAAE,QAAgB,EAAE,OAAe,EAAE,MAAc,EAAE,KAA6B,EAAE,SAAmB,EAAE,QAAoB;IAAxE,sBAAA,EAAA,YAA6B;IACvI,IAAI,OAAO,GAAG;QACV,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,QAAQ;KACrB,CAAC;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { FloatArray, Nullable } from \"../../types\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\ndeclare type Material = import(\"../../Materials/material\").Material;\r\n\r\n/**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\nexport function CreateLineSystemVertexData(options: { lines: Vector3[][], colors?: Nullable<Color4[][]> }): VertexData {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\nexport function CreateDashedLinesVertexData(options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number }): VertexData {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n\r\n var positions = new Array<number>();\r\n var indices = new Array<number>();\r\n\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\nexport function CreateLineSystem(name: string, options: { lines: Vector3[][], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Nullable<Color4[][]>, useVertexAlpha?: boolean; material?: Material }, scene: Nullable<Scene>): LinesMesh {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind)!;\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind)!;\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha, options.material);\r\n var vertexData = CreateLineSystemVertexData(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n}\r\n\r\n/**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\nexport function CreateLines(name: string, options: { points: Vector3[], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Color4[], useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha, material: options.material }, scene);\r\n return lines;\r\n}\r\n\r\n/**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\nexport function CreateDashedLines(name: string, options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number, updatable?: boolean, instance?: LinesMesh, useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n\r\n if (instance) { // dashed lines update\r\n var positionFunction = (positions: FloatArray): void => {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n let dashSize = instance!._creationDataStorage!.dashSize;\r\n let gapSize = instance!._creationDataStorage!.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha, options.material);\r\n var vertexData = CreateDashedLinesVertexData(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const LinesBuilder = {\r\n CreateDashedLines,\r\n CreateLineSystem,\r\n CreateLines\r\n};\r\n\r\nVertexData.CreateLineSystem = CreateLineSystemVertexData;\r\nVertexData.CreateDashedLines = CreateDashedLinesVertexData;\r\n\r\nMesh.CreateLines = (name: string, points: Vector3[], scene: Nullable<Scene> = null, updatable: boolean = false, instance: Nullable<LinesMesh> = null): LinesMesh => {\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return CreateLines(name, options, scene);\r\n};\r\n\r\nMesh.CreateDashedLines = (name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Nullable<Scene> = null, updatable?: boolean, instance?: LinesMesh): LinesMesh => {\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return CreateDashedLines(name, options, scene);\r\n};"]}
|
|
1
|
+
{"version":3,"file":"linesBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/linesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA8D;IACrG,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,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A,YAA6B;IACvI,IAAI,OAAO,GAAG;QACV,MAAM,QAAA;QACN,QAAQ,UAAA;QACR,OAAO,SAAA;QACP,MAAM,QAAA;QACN,SAAS,WAAA;QACT,QAAQ,UAAA;KACX,CAAC;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { FloatArray, Nullable } from \"../../types\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\ndeclare type Material = import(\"../../Materials/material\").Material;\r\n\r\n/**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\nexport function CreateLineSystemVertexData(options: { lines: Vector3[][], colors?: Nullable<Color4[][]> }): VertexData {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\nexport function CreateDashedLinesVertexData(options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number }): VertexData {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n\r\n var positions = new Array<number>();\r\n var indices = new Array<number>();\r\n\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\nexport function CreateLineSystem(name: string, options: { lines: Vector3[][], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Nullable<Color4[][]>, useVertexAlpha?: boolean; material?: Material }, scene: Nullable<Scene>): LinesMesh {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind)!;\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind)!;\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha, options.material);\r\n var vertexData = CreateLineSystemVertexData(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n}\r\n\r\n/**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\nexport function CreateLines(name: string, options: { points: Vector3[], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Color4[], useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha, material: options.material }, scene);\r\n return lines;\r\n}\r\n\r\n/**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\nexport function CreateDashedLines(name: string, options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number, updatable?: boolean, instance?: LinesMesh, useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n\r\n if (instance) { // dashed lines update\r\n var positionFunction = (positions: FloatArray): void => {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n let dashSize = instance!._creationDataStorage!.dashSize;\r\n let gapSize = instance!._creationDataStorage!.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha, options.material);\r\n var vertexData = CreateDashedLinesVertexData(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const LinesBuilder = {\r\n CreateDashedLines,\r\n CreateLineSystem,\r\n CreateLines\r\n};\r\n\r\nVertexData.CreateLineSystem = CreateLineSystemVertexData;\r\nVertexData.CreateDashedLines = CreateDashedLinesVertexData;\r\n\r\nMesh.CreateLines = (name: string, points: Vector3[], scene: Nullable<Scene> = null, updatable: boolean = false, instance: Nullable<LinesMesh> = null): LinesMesh => {\r\n var options = {\r\n points,\r\n updatable,\r\n instance\r\n };\r\n return CreateLines(name, options, scene);\r\n};\r\n\r\nMesh.CreateDashedLines = (name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Nullable<Scene> = null, updatable?: boolean, instance?: LinesMesh): LinesMesh => {\r\n var options = {\r\n points,\r\n dashSize,\r\n gapSize,\r\n dashNb,\r\n updatable,\r\n instance\r\n };\r\n return CreateDashedLines(name, options, scene);\r\n};"]}
|
|
@@ -6,12 +6,22 @@ import { Mesh } from "../mesh";
|
|
|
6
6
|
import { VertexData } from "../mesh.vertexData";
|
|
7
7
|
/**
|
|
8
8
|
* Creates the VertexData for a tiled box
|
|
9
|
-
* @
|
|
10
|
-
|
|
9
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
10
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
11
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
12
|
+
* * size of the box
|
|
13
|
+
* * width of the box, overwrites size
|
|
14
|
+
* * height of the box, overwrites size
|
|
15
|
+
* * depth of the box, overwrites size
|
|
16
|
+
* * tileSize sets the size of a tile
|
|
17
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
18
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
11
19
|
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
12
20
|
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
21
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
22
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
13
23
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
14
|
-
* @returns the VertexData of the
|
|
24
|
+
* @returns the VertexData of the TiledBox
|
|
15
25
|
*/
|
|
16
26
|
export declare function CreateTiledBoxVertexData(options: {
|
|
17
27
|
pattern?: number;
|
|
@@ -29,14 +39,23 @@ export declare function CreateTiledBoxVertexData(options: {
|
|
|
29
39
|
sideOrientation?: number;
|
|
30
40
|
}): VertexData;
|
|
31
41
|
/**
|
|
32
|
-
* Creates a box mesh
|
|
33
|
-
*
|
|
34
|
-
* * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
|
|
35
|
-
* * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
36
|
-
* * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
|
|
37
|
-
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
42
|
+
* Creates a tiled box mesh
|
|
43
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
38
44
|
* @param name defines the name of the mesh
|
|
39
|
-
* @param options
|
|
45
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
46
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
47
|
+
* * size of the box
|
|
48
|
+
* * width of the box, overwrites size
|
|
49
|
+
* * height of the box, overwrites size
|
|
50
|
+
* * depth of the box, overwrites size
|
|
51
|
+
* * tileSize sets the size of a tile
|
|
52
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
53
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
54
|
+
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
55
|
+
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
56
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
57
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
58
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
40
59
|
* @param scene defines the hosting scene
|
|
41
60
|
* @returns the box mesh
|
|
42
61
|
*/
|
|
@@ -57,7 +76,7 @@ export declare function CreateTiledBox(name: string, options: {
|
|
|
57
76
|
}, scene?: Nullable<Scene>): Mesh;
|
|
58
77
|
/**
|
|
59
78
|
* Class containing static functions to help procedurally build meshes
|
|
60
|
-
* @deprecated use
|
|
79
|
+
* @deprecated use CreateTiledBox instead
|
|
61
80
|
*/
|
|
62
81
|
export declare const TiledBoxBuilder: {
|
|
63
82
|
CreateTiledBox: typeof CreateTiledBox;
|
|
@@ -5,12 +5,22 @@ import { VertexData } from "../mesh.vertexData.js";
|
|
|
5
5
|
import { CreateTiledPlaneVertexData } from "./tiledPlaneBuilder.js";
|
|
6
6
|
/**
|
|
7
7
|
* Creates the VertexData for a tiled box
|
|
8
|
-
* @
|
|
9
|
-
|
|
8
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
9
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
10
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
11
|
+
* * size of the box
|
|
12
|
+
* * width of the box, overwrites size
|
|
13
|
+
* * height of the box, overwrites size
|
|
14
|
+
* * depth of the box, overwrites size
|
|
15
|
+
* * tileSize sets the size of a tile
|
|
16
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
17
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
10
18
|
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
11
19
|
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
20
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
21
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
12
22
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
13
|
-
* @returns the VertexData of the
|
|
23
|
+
* @returns the VertexData of the TiledBox
|
|
14
24
|
*/
|
|
15
25
|
export function CreateTiledBoxVertexData(options) {
|
|
16
26
|
var nbFaces = 6;
|
|
@@ -151,14 +161,23 @@ export function CreateTiledBoxVertexData(options) {
|
|
|
151
161
|
return vertexData;
|
|
152
162
|
}
|
|
153
163
|
/**
|
|
154
|
-
* Creates a box mesh
|
|
155
|
-
*
|
|
156
|
-
* * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
|
|
157
|
-
* * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
158
|
-
* * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
|
|
159
|
-
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
164
|
+
* Creates a tiled box mesh
|
|
165
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
160
166
|
* @param name defines the name of the mesh
|
|
161
|
-
* @param options
|
|
167
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
168
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
169
|
+
* * size of the box
|
|
170
|
+
* * width of the box, overwrites size
|
|
171
|
+
* * height of the box, overwrites size
|
|
172
|
+
* * depth of the box, overwrites size
|
|
173
|
+
* * tileSize sets the size of a tile
|
|
174
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
175
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
176
|
+
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
177
|
+
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
178
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
179
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
180
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
162
181
|
* @param scene defines the hosting scene
|
|
163
182
|
* @returns the box mesh
|
|
164
183
|
*/
|
|
@@ -173,7 +192,7 @@ export function CreateTiledBox(name, options, scene) {
|
|
|
173
192
|
}
|
|
174
193
|
/**
|
|
175
194
|
* Class containing static functions to help procedurally build meshes
|
|
176
|
-
* @deprecated use
|
|
195
|
+
* @deprecated use CreateTiledBox instead
|
|
177
196
|
*/
|
|
178
197
|
export var TiledBoxBuilder = {
|
|
179
198
|
CreateTiledBox: CreateTiledBox
|