@babylonjs/core 8.9.1 → 8.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/runtimeAnimation.js +3 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +26 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/staticSoundBuffer.d.ts +19 -0
- package/AudioV2/abstractAudio/staticSoundBuffer.js +5 -0
- package/AudioV2/abstractAudio/staticSoundBuffer.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +6 -2
- package/AudioV2/webAudio/webAudioStaticSound.js +21 -0
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/Cameras/arcRotateCamera.js +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +12 -21
- package/Cameras/targetCamera.js +16 -37
- package/Cameras/targetCamera.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +4 -4
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +3 -3
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +5 -6
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.d.ts +1 -0
- package/Lights/Shadows/cascadedShadowGenerator.js +12 -0
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -4
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +14 -8
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +15 -10
- package/Materials/Node/Blocks/Dual/currentScreenBlock.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/smartFilterTextureBlock.d.ts +32 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +99 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +4 -12
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.d.ts +8 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +23 -3
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +13 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +44 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +3 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +1 -3
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +8 -2
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +7 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +4 -0
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +11 -9
- package/Materials/Node/nodeMaterialBuildState.js +27 -38
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.js +10 -3
- package/Materials/Node/nodeMaterialDefault.js.map +1 -1
- package/Materials/Textures/thinTexture.js +3 -0
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Maths/math.vector.d.ts +6 -0
- package/Maths/math.vector.js +10 -4
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/transformNode.d.ts +0 -8
- package/Meshes/transformNode.js +66 -88
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/depthReducer.js +2 -6
- package/Misc/depthReducer.js.map +1 -1
- package/Misc/observable.d.ts +34 -3
- package/Misc/observable.js +1 -1
- package/Misc/observable.js.map +1 -1
- package/Physics/v2/characterController.d.ts +9 -0
- package/Physics/v2/characterController.js +17 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +8 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +21 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +4 -4
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +2 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/background.fragment.js +1 -1
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js +5 -4
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +4 -2
- package/scene.js.map +1 -1
|
@@ -47,10 +47,11 @@ class DecalVertex {
|
|
|
47
47
|
*/
|
|
48
48
|
export function CreateDecal(name, sourceMesh, options) {
|
|
49
49
|
const hasSkeleton = !!sourceMesh.skeleton;
|
|
50
|
+
const hasMorphTargets = !!sourceMesh.morphTargetManager?.numTargets;
|
|
50
51
|
const useLocalComputation = options.localMode || hasSkeleton;
|
|
51
52
|
const indices = sourceMesh.getIndices();
|
|
52
|
-
const positions = hasSkeleton ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);
|
|
53
|
-
const normals = hasSkeleton ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);
|
|
53
|
+
const positions = hasSkeleton || hasMorphTargets ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);
|
|
54
|
+
const normals = hasSkeleton || hasMorphTargets ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);
|
|
54
55
|
const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;
|
|
55
56
|
const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;
|
|
56
57
|
const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AM,CAAC;QACJ,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,KAAK,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/B,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,gEAAgE;IAChE,WAAW;CACd,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,CAAC,IAAY,EAAE,UAAwB,EAAE,QAAiB,EAAE,MAAe,EAAE,IAAa,EAAE,KAAa,EAAQ,EAAE;IAClI,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,MAAM;QACN,IAAI;QACJ,KAAK;KACR,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Nullable, IndicesArray, FloatArray } from \"../../types\";\r\nimport { Vector3, Matrix, Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { Lerp } from \"../../Maths/math.scalar.functions\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { AbstractMesh } from \"../abstractMesh\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\nconst XpAxis = new Vector3(1, 0, 0);\r\nconst XnAxis = new Vector3(-1, 0, 0);\r\nconst YpAxis = new Vector3(0, 1, 0);\r\nconst YnAxis = new Vector3(0, -1, 0);\r\nconst ZpAxis = new Vector3(0, 0, 1);\r\nconst ZnAxis = new Vector3(0, 0, -1);\r\n\r\n/** @internal */\r\nclass DecalVertex {\r\n constructor(\r\n public position: Vector3 = Vector3.Zero(),\r\n public normal: Vector3 = Vector3.Up(),\r\n public uv: Vector2 = Vector2.Zero(),\r\n public vertexIdx: number = 0,\r\n public vertexIdxForBones: number = 0,\r\n public localPositionOverride: Nullable<number[]> = null,\r\n public localNormalOverride: Nullable<number[]> = null,\r\n public matrixIndicesOverride: Nullable<number[]> = null,\r\n public matrixWeightsOverride: Nullable<number[]> = null\r\n ) {}\r\n public clone(): DecalVertex {\r\n return new DecalVertex(\r\n this.position.clone(),\r\n this.normal.clone(),\r\n this.uv.clone(),\r\n this.vertexIdx,\r\n this.vertexIdxForBones,\r\n this.localPositionOverride?.slice(),\r\n this.localNormalOverride?.slice(),\r\n this.matrixIndicesOverride?.slice(),\r\n this.matrixWeightsOverride?.slice()\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * * The parameter `captureUVS` defines if we need to capture the uvs or compute them\r\n * * The parameter `cullBackFaces` defines if the back faces should be removed from the decal mesh\r\n * * The parameter `localMode` defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.\r\n * * Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it.\r\n * Note: Meshes with morph targets are not supported!\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/decals\r\n */\r\nexport function CreateDecal(\r\n name: string,\r\n sourceMesh: AbstractMesh,\r\n options: { position?: Vector3; normal?: Vector3; size?: Vector3; angle?: number; captureUVS?: boolean; cullBackFaces?: boolean; localMode?: boolean }\r\n): Mesh {\r\n const hasSkeleton = !!sourceMesh.skeleton;\r\n const useLocalComputation = options.localMode || hasSkeleton;\r\n\r\n const indices = <IndicesArray>sourceMesh.getIndices();\r\n const positions = hasSkeleton ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = hasSkeleton ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);\r\n const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;\r\n const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;\r\n const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);\r\n const matIndices = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\r\n const matWeights = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\r\n const matIndicesExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matWeightsExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n\r\n const position = options.position || Vector3.Zero();\r\n let normal = options.normal || Vector3.Up();\r\n const size = options.size || Vector3.One();\r\n const angle = options.angle || 0;\r\n\r\n // Getting correct rotation\r\n if (!normal) {\r\n const target = new Vector3(0, 0, 1);\r\n const camera = <Camera>sourceMesh.getScene().activeCamera;\r\n const cameraWorldTarget = Vector3.TransformCoordinates(target, camera.getWorldMatrix());\r\n\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n\r\n const yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n const len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n const pitch = Math.atan2(normal.y, len);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n vertexData.matricesIndices = hasSkeleton ? [] : null;\r\n vertexData.matricesWeights = hasSkeleton ? [] : null;\r\n vertexData.matricesIndicesExtra = matIndicesExtra ? [] : null;\r\n vertexData.matricesWeightsExtra = matWeightsExtra ? [] : null;\r\n\r\n let currentVertexDataIndex = 0;\r\n\r\n const extractDecalVector3 = (indexId: number, transformMatrix: Matrix): DecalVertex => {\r\n const result = new DecalVertex();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n\r\n const vertexId = indices[indexId];\r\n\r\n result.vertexIdx = vertexId * 3;\r\n result.vertexIdxForBones = vertexId * 4;\r\n\r\n // Send vector to decal local world\r\n result.position = new Vector3(positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n Vector3.TransformCoordinatesToRef(result.position, transformMatrix, result.position);\r\n\r\n // Get normal\r\n result.normal = new Vector3(normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n Vector3.TransformNormalToRef(result.normal, transformMatrix, result.normal);\r\n\r\n if (options.captureUVS && uvs) {\r\n const v = uvs[vertexId * 2 + 1];\r\n result.uv = new Vector2(uvs[vertexId * 2], useOpenGLOrientationForUV ? 1 - v : v);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const emptyArray = [0, 0, 0, 0];\r\n\r\n // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n const clip = (vertices: DecalVertex[], axis: Vector3): Nullable<DecalVertex[]> => {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n\r\n const clipSize = 0.5 * Math.abs(Vector3.Dot(size, axis));\r\n\r\n const indexOf = (arr: FloatArray | number[], val: number, start: number, num: number) => {\r\n for (let i = 0; i < num; ++i) {\r\n if (arr[start + i] === val) {\r\n return start + i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const clipVertices = (v0: DecalVertex, v1: DecalVertex): DecalVertex => {\r\n const clipFactor = Vector3.GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n\r\n let indices = emptyArray;\r\n let weights = emptyArray;\r\n\r\n if (matIndices && matWeights) {\r\n const mat0Index = v0.matrixIndicesOverride ? 0 : v0.vertexIdxForBones;\r\n const v0Indices = v0.matrixIndicesOverride ?? matIndices;\r\n const v0Weights = v0.matrixWeightsOverride ?? matWeights;\r\n\r\n const mat1Index = v1.matrixIndicesOverride ? 0 : v1.vertexIdxForBones;\r\n const v1Indices = v1.matrixIndicesOverride ?? matIndices;\r\n const v1Weights = v1.matrixWeightsOverride ?? matWeights;\r\n\r\n indices = [0, 0, 0, 0];\r\n weights = [0, 0, 0, 0];\r\n\r\n let index = 0;\r\n for (let i = 0; i < 4; ++i) {\r\n if (v0Weights[mat0Index + i] > 0) {\r\n const idx = indexOf(v1Indices, v0Indices[mat0Index + i], mat1Index, 4);\r\n indices[index] = v0Indices[mat0Index + i];\r\n weights[index] = Lerp(v0Weights[mat0Index + i], idx >= 0 ? v1Weights[idx] : 0, clipFactor);\r\n index++;\r\n }\r\n }\r\n\r\n for (let i = 0; i < 4 && index < 4; ++i) {\r\n const ind = v1Indices[mat1Index + i];\r\n if (indexOf(v0Indices, ind, mat0Index, 4) !== -1) {\r\n continue;\r\n }\r\n\r\n indices[index] = ind;\r\n weights[index] = Lerp(0, v1Weights[mat1Index + i], clipFactor);\r\n index++;\r\n }\r\n\r\n const sumw = weights[0] + weights[1] + weights[2] + weights[3];\r\n\r\n weights[0] /= sumw;\r\n weights[1] /= sumw;\r\n weights[2] /= sumw;\r\n weights[3] /= sumw;\r\n }\r\n\r\n const v0LocalPositionX = v0.localPositionOverride ? v0.localPositionOverride[0] : (localPositions?.[v0.vertexIdx] ?? 0);\r\n const v0LocalPositionY = v0.localPositionOverride ? v0.localPositionOverride[1] : (localPositions?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalPositionZ = v0.localPositionOverride ? v0.localPositionOverride[2] : (localPositions?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalPositionX = v1.localPositionOverride ? v1.localPositionOverride[0] : (localPositions?.[v1.vertexIdx] ?? 0);\r\n const v1LocalPositionY = v1.localPositionOverride ? v1.localPositionOverride[1] : (localPositions?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalPositionZ = v1.localPositionOverride ? v1.localPositionOverride[2] : (localPositions?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const v0LocalNormalX = v0.localNormalOverride ? v0.localNormalOverride[0] : (localNormals?.[v0.vertexIdx] ?? 0);\r\n const v0LocalNormalY = v0.localNormalOverride ? v0.localNormalOverride[1] : (localNormals?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalNormalZ = v0.localNormalOverride ? v0.localNormalOverride[2] : (localNormals?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalNormalX = v1.localNormalOverride ? v1.localNormalOverride[0] : (localNormals?.[v1.vertexIdx] ?? 0);\r\n const v1LocalNormalY = v1.localNormalOverride ? v1.localNormalOverride[1] : (localNormals?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalNormalZ = v1.localNormalOverride ? v1.localNormalOverride[2] : (localNormals?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const interpNormalX = v0LocalNormalX + (v1LocalNormalX - v0LocalNormalX) * clipFactor;\r\n const interpNormalY = v0LocalNormalY + (v1LocalNormalY - v0LocalNormalY) * clipFactor;\r\n const interpNormalZ = v0LocalNormalZ + (v1LocalNormalZ - v0LocalNormalZ) * clipFactor;\r\n\r\n const norm = Math.sqrt(interpNormalX * interpNormalX + interpNormalY * interpNormalY + interpNormalZ * interpNormalZ);\r\n\r\n return new DecalVertex(\r\n Vector3.Lerp(v0.position, v1.position, clipFactor),\r\n Vector3.Lerp(v0.normal, v1.normal, clipFactor).normalize(),\r\n Vector2.Lerp(v0.uv, v1.uv, clipFactor),\r\n -1,\r\n -1,\r\n localPositions\r\n ? [\r\n v0LocalPositionX + (v1LocalPositionX - v0LocalPositionX) * clipFactor,\r\n v0LocalPositionY + (v1LocalPositionY - v0LocalPositionY) * clipFactor,\r\n v0LocalPositionZ + (v1LocalPositionZ - v0LocalPositionZ) * clipFactor,\r\n ]\r\n : null,\r\n localNormals ? [interpNormalX / norm, interpNormalY / norm, interpNormalZ / norm] : null,\r\n indices,\r\n weights\r\n );\r\n };\r\n\r\n let clipResult: Nullable<DecalVertex[]> = null;\r\n\r\n if (vertices.length > 3) {\r\n clipResult = [] as DecalVertex[];\r\n }\r\n\r\n for (let index = 0; index < vertices.length; index += 3) {\r\n let total = 0;\r\n let nV1: Nullable<DecalVertex> = null;\r\n let nV2: Nullable<DecalVertex> = null;\r\n let nV3: Nullable<DecalVertex> = null;\r\n let nV4: Nullable<DecalVertex> = null;\r\n\r\n const d1 = Vector3.Dot(vertices[index].position, axis) - clipSize;\r\n const d2 = Vector3.Dot(vertices[index + 1].position, axis) - clipSize;\r\n const d3 = Vector3.Dot(vertices[index + 2].position, axis) - clipSize;\r\n\r\n const v1Out = d1 > 0;\r\n const v2Out = d2 > 0;\r\n const v3Out = d3 > 0;\r\n\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n\r\n switch (total) {\r\n case 0:\r\n if (vertices.length > 3) {\r\n clipResult!.push(vertices[index]);\r\n clipResult!.push(vertices[index + 1]);\r\n clipResult!.push(vertices[index + 2]);\r\n } else {\r\n clipResult = vertices;\r\n }\r\n break;\r\n case 1:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n\r\n clipResult.push(nV3);\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV1.clone());\r\n\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n clipResult.push(nV1.clone());\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3);\r\n\r\n clipResult.push(nV4);\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n\r\n return clipResult;\r\n };\r\n\r\n const sourceMeshAsMesh = sourceMesh instanceof Mesh ? sourceMesh : null;\r\n const matrixData = sourceMeshAsMesh?._thinInstanceDataStorage.matrixData;\r\n\r\n const numMatrices = sourceMeshAsMesh?.thinInstanceCount || 1;\r\n const thinInstanceMatrix = TmpVectors.Matrix[0];\r\n\r\n thinInstanceMatrix.copyFrom(Matrix.IdentityReadOnly);\r\n\r\n for (let m = 0; m < numMatrices; ++m) {\r\n if (sourceMeshAsMesh?.hasThinInstances && matrixData) {\r\n const ofst = m * 16;\r\n\r\n thinInstanceMatrix.setRowFromFloats(0, matrixData[ofst + 0], matrixData[ofst + 1], matrixData[ofst + 2], matrixData[ofst + 3]);\r\n thinInstanceMatrix.setRowFromFloats(1, matrixData[ofst + 4], matrixData[ofst + 5], matrixData[ofst + 6], matrixData[ofst + 7]);\r\n thinInstanceMatrix.setRowFromFloats(2, matrixData[ofst + 8], matrixData[ofst + 9], matrixData[ofst + 10], matrixData[ofst + 11]);\r\n thinInstanceMatrix.setRowFromFloats(3, matrixData[ofst + 12], matrixData[ofst + 13], matrixData[ofst + 14], matrixData[ofst + 15]);\r\n }\r\n\r\n // Matrix\r\n const decalWorldMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, angle).multiply(Matrix.Translation(position.x, position.y, position.z));\r\n const inverseDecalWorldMatrix = Matrix.Invert(decalWorldMatrix);\r\n const meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n const transformMatrix = thinInstanceMatrix.multiply(meshWorldMatrix).multiply(inverseDecalWorldMatrix);\r\n\r\n const oneFaceVertices = new Array<DecalVertex>(3);\r\n\r\n for (let index = 0; index < indices.length; index += 3) {\r\n let faceVertices: Nullable<DecalVertex[]> = oneFaceVertices;\r\n\r\n faceVertices[0] = extractDecalVector3(index, transformMatrix);\r\n faceVertices[1] = extractDecalVector3(index + 1, transformMatrix);\r\n faceVertices[2] = extractDecalVector3(index + 2, transformMatrix);\r\n\r\n if (options.cullBackFaces) {\r\n // If all the normals of the vertices of the face are pointing away from the view direction we discard the face.\r\n // As computations are done in the decal coordinate space, the viewDirection is (0,0,1), so when dot(vertexNormal, -viewDirection) <= 0 the vertex is culled\r\n if (-faceVertices[0].normal.z <= 0 && -faceVertices[1].normal.z <= 0 && -faceVertices[2].normal.z <= 0) {\r\n continue;\r\n }\r\n }\r\n\r\n // Clip\r\n faceVertices = clip(faceVertices, XpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, XnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n\r\n // Add UVs and get back to world\r\n for (let vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n const vertex = faceVertices[vIndex];\r\n\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n if (useLocalComputation) {\r\n if (vertex.localPositionOverride) {\r\n vertexData.positions[currentVertexDataIndex * 3] = vertex.localPositionOverride[0];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = vertex.localPositionOverride[1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = vertex.localPositionOverride[2];\r\n } else if (localPositions) {\r\n vertexData.positions[currentVertexDataIndex * 3] = localPositions[vertex.vertexIdx];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = localPositions[vertex.vertexIdx + 1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = localPositions[vertex.vertexIdx + 2];\r\n }\r\n if (vertex.localNormalOverride) {\r\n vertexData.normals[currentVertexDataIndex * 3] = vertex.localNormalOverride[0];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = vertex.localNormalOverride[1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = vertex.localNormalOverride[2];\r\n } else if (localNormals) {\r\n vertexData.normals[currentVertexDataIndex * 3] = localNormals[vertex.vertexIdx];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = localNormals[vertex.vertexIdx + 1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = localNormals[vertex.vertexIdx + 2];\r\n }\r\n } else {\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n }\r\n if (vertexData.matricesIndices && vertexData.matricesWeights) {\r\n if (vertex.matrixIndicesOverride) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = vertex.matrixIndicesOverride[0];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = vertex.matrixIndicesOverride[1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = vertex.matrixIndicesOverride[2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = vertex.matrixIndicesOverride[3];\r\n } else {\r\n if (matIndices) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = matIndices[vertex.vertexIdxForBones];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = matIndices[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = matIndices[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = matIndices[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matIndicesExtra && vertexData.matricesIndicesExtra) {\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4] = matIndicesExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 1] = matIndicesExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 2] = matIndicesExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 3] = matIndicesExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n if (vertex.matrixWeightsOverride) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = vertex.matrixWeightsOverride[0];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = vertex.matrixWeightsOverride[1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = vertex.matrixWeightsOverride[2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = vertex.matrixWeightsOverride[3];\r\n } else {\r\n if (matWeights) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = matWeights[vertex.vertexIdxForBones];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = matWeights[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = matWeights[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = matWeights[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matWeightsExtra && vertexData.matricesWeightsExtra) {\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4] = matWeightsExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 1] = matWeightsExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 2] = matWeightsExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 3] = matWeightsExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n }\r\n\r\n if (!options.captureUVS) {\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n vertexData.uvs.push(useOpenGLOrientationForUV ? 1 - v : v);\r\n } else {\r\n vertex.uv.toArray(vertexData.uvs, currentVertexDataIndex * 2);\r\n }\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n }\r\n\r\n // Avoid the \"Setting vertex data kind 'XXX' with an empty array\" warning when calling vertexData.applyToMesh\r\n if (vertexData.indices.length === 0) {\r\n vertexData.indices = null;\r\n }\r\n if (vertexData.positions.length === 0) {\r\n vertexData.positions = null;\r\n }\r\n if (vertexData.normals.length === 0) {\r\n vertexData.normals = null;\r\n }\r\n if (vertexData.uvs.length === 0) {\r\n vertexData.uvs = null;\r\n }\r\n if (vertexData.matricesIndices?.length === 0) {\r\n vertexData.matricesIndices = null;\r\n }\r\n if (vertexData.matricesWeights?.length === 0) {\r\n vertexData.matricesWeights = null;\r\n }\r\n if (vertexData.matricesIndicesExtra?.length === 0) {\r\n vertexData.matricesIndicesExtra = null;\r\n }\r\n if (vertexData.matricesWeightsExtra?.length === 0) {\r\n vertexData.matricesWeightsExtra = null;\r\n }\r\n\r\n // Return mesh\r\n const decal = new Mesh(name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n\r\n if (useLocalComputation) {\r\n decal.skeleton = sourceMesh.skeleton;\r\n decal.parent = sourceMesh;\r\n } else {\r\n decal.position = position.clone();\r\n decal.rotation = new Vector3(pitch, yaw, angle);\r\n }\r\n\r\n decal.computeWorldMatrix(true);\r\n decal.refreshBoundingInfo(true, true);\r\n\r\n return decal;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the function directly from the module\r\n */\r\nexport const DecalBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateDecal,\r\n};\r\n\r\nMesh.CreateDecal = (name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh => {\r\n const options = {\r\n position,\r\n normal,\r\n size,\r\n angle,\r\n };\r\n\r\n return CreateDecal(name, sourceMesh, options);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"decalBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/decalBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC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AAK,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/B,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,gEAAgE;IAChE,WAAW;CACd,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,CAAC,IAAY,EAAE,UAAwB,EAAE,QAAiB,EAAE,MAAe,EAAE,IAAa,EAAE,KAAa,EAAQ,EAAE;IAClI,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,MAAM;QACN,IAAI;QACJ,KAAK;KACR,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Nullable, IndicesArray, FloatArray } from \"../../types\";\r\nimport { Vector3, Matrix, Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { Lerp } from \"../../Maths/math.scalar.functions\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { AbstractMesh } from \"../abstractMesh\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\nconst XpAxis = new Vector3(1, 0, 0);\r\nconst XnAxis = new Vector3(-1, 0, 0);\r\nconst YpAxis = new Vector3(0, 1, 0);\r\nconst YnAxis = new Vector3(0, -1, 0);\r\nconst ZpAxis = new Vector3(0, 0, 1);\r\nconst ZnAxis = new Vector3(0, 0, -1);\r\n\r\n/** @internal */\r\nclass DecalVertex {\r\n constructor(\r\n public position: Vector3 = Vector3.Zero(),\r\n public normal: Vector3 = Vector3.Up(),\r\n public uv: Vector2 = Vector2.Zero(),\r\n public vertexIdx: number = 0,\r\n public vertexIdxForBones: number = 0,\r\n public localPositionOverride: Nullable<number[]> = null,\r\n public localNormalOverride: Nullable<number[]> = null,\r\n public matrixIndicesOverride: Nullable<number[]> = null,\r\n public matrixWeightsOverride: Nullable<number[]> = null\r\n ) {}\r\n public clone(): DecalVertex {\r\n return new DecalVertex(\r\n this.position.clone(),\r\n this.normal.clone(),\r\n this.uv.clone(),\r\n this.vertexIdx,\r\n this.vertexIdxForBones,\r\n this.localPositionOverride?.slice(),\r\n this.localNormalOverride?.slice(),\r\n this.matrixIndicesOverride?.slice(),\r\n this.matrixWeightsOverride?.slice()\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * * The parameter `captureUVS` defines if we need to capture the uvs or compute them\r\n * * The parameter `cullBackFaces` defines if the back faces should be removed from the decal mesh\r\n * * The parameter `localMode` defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.\r\n * * Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it.\r\n * Note: Meshes with morph targets are not supported!\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/decals\r\n */\r\nexport function CreateDecal(\r\n name: string,\r\n sourceMesh: AbstractMesh,\r\n options: { position?: Vector3; normal?: Vector3; size?: Vector3; angle?: number; captureUVS?: boolean; cullBackFaces?: boolean; localMode?: boolean }\r\n): Mesh {\r\n const hasSkeleton = !!sourceMesh.skeleton;\r\n const hasMorphTargets = !!sourceMesh.morphTargetManager?.numTargets;\r\n const useLocalComputation = options.localMode || hasSkeleton;\r\n\r\n const indices = <IndicesArray>sourceMesh.getIndices();\r\n const positions = hasSkeleton || hasMorphTargets ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = hasSkeleton || hasMorphTargets ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);\r\n const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;\r\n const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;\r\n const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);\r\n const matIndices = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\r\n const matWeights = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\r\n const matIndicesExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matWeightsExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n\r\n const position = options.position || Vector3.Zero();\r\n let normal = options.normal || Vector3.Up();\r\n const size = options.size || Vector3.One();\r\n const angle = options.angle || 0;\r\n\r\n // Getting correct rotation\r\n if (!normal) {\r\n const target = new Vector3(0, 0, 1);\r\n const camera = <Camera>sourceMesh.getScene().activeCamera;\r\n const cameraWorldTarget = Vector3.TransformCoordinates(target, camera.getWorldMatrix());\r\n\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n\r\n const yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n const len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n const pitch = Math.atan2(normal.y, len);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n vertexData.matricesIndices = hasSkeleton ? [] : null;\r\n vertexData.matricesWeights = hasSkeleton ? [] : null;\r\n vertexData.matricesIndicesExtra = matIndicesExtra ? [] : null;\r\n vertexData.matricesWeightsExtra = matWeightsExtra ? [] : null;\r\n\r\n let currentVertexDataIndex = 0;\r\n\r\n const extractDecalVector3 = (indexId: number, transformMatrix: Matrix): DecalVertex => {\r\n const result = new DecalVertex();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n\r\n const vertexId = indices[indexId];\r\n\r\n result.vertexIdx = vertexId * 3;\r\n result.vertexIdxForBones = vertexId * 4;\r\n\r\n // Send vector to decal local world\r\n result.position = new Vector3(positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n Vector3.TransformCoordinatesToRef(result.position, transformMatrix, result.position);\r\n\r\n // Get normal\r\n result.normal = new Vector3(normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n Vector3.TransformNormalToRef(result.normal, transformMatrix, result.normal);\r\n\r\n if (options.captureUVS && uvs) {\r\n const v = uvs[vertexId * 2 + 1];\r\n result.uv = new Vector2(uvs[vertexId * 2], useOpenGLOrientationForUV ? 1 - v : v);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const emptyArray = [0, 0, 0, 0];\r\n\r\n // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n const clip = (vertices: DecalVertex[], axis: Vector3): Nullable<DecalVertex[]> => {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n\r\n const clipSize = 0.5 * Math.abs(Vector3.Dot(size, axis));\r\n\r\n const indexOf = (arr: FloatArray | number[], val: number, start: number, num: number) => {\r\n for (let i = 0; i < num; ++i) {\r\n if (arr[start + i] === val) {\r\n return start + i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const clipVertices = (v0: DecalVertex, v1: DecalVertex): DecalVertex => {\r\n const clipFactor = Vector3.GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n\r\n let indices = emptyArray;\r\n let weights = emptyArray;\r\n\r\n if (matIndices && matWeights) {\r\n const mat0Index = v0.matrixIndicesOverride ? 0 : v0.vertexIdxForBones;\r\n const v0Indices = v0.matrixIndicesOverride ?? matIndices;\r\n const v0Weights = v0.matrixWeightsOverride ?? matWeights;\r\n\r\n const mat1Index = v1.matrixIndicesOverride ? 0 : v1.vertexIdxForBones;\r\n const v1Indices = v1.matrixIndicesOverride ?? matIndices;\r\n const v1Weights = v1.matrixWeightsOverride ?? matWeights;\r\n\r\n indices = [0, 0, 0, 0];\r\n weights = [0, 0, 0, 0];\r\n\r\n let index = 0;\r\n for (let i = 0; i < 4; ++i) {\r\n if (v0Weights[mat0Index + i] > 0) {\r\n const idx = indexOf(v1Indices, v0Indices[mat0Index + i], mat1Index, 4);\r\n indices[index] = v0Indices[mat0Index + i];\r\n weights[index] = Lerp(v0Weights[mat0Index + i], idx >= 0 ? v1Weights[idx] : 0, clipFactor);\r\n index++;\r\n }\r\n }\r\n\r\n for (let i = 0; i < 4 && index < 4; ++i) {\r\n const ind = v1Indices[mat1Index + i];\r\n if (indexOf(v0Indices, ind, mat0Index, 4) !== -1) {\r\n continue;\r\n }\r\n\r\n indices[index] = ind;\r\n weights[index] = Lerp(0, v1Weights[mat1Index + i], clipFactor);\r\n index++;\r\n }\r\n\r\n const sumw = weights[0] + weights[1] + weights[2] + weights[3];\r\n\r\n weights[0] /= sumw;\r\n weights[1] /= sumw;\r\n weights[2] /= sumw;\r\n weights[3] /= sumw;\r\n }\r\n\r\n const v0LocalPositionX = v0.localPositionOverride ? v0.localPositionOverride[0] : (localPositions?.[v0.vertexIdx] ?? 0);\r\n const v0LocalPositionY = v0.localPositionOverride ? v0.localPositionOverride[1] : (localPositions?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalPositionZ = v0.localPositionOverride ? v0.localPositionOverride[2] : (localPositions?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalPositionX = v1.localPositionOverride ? v1.localPositionOverride[0] : (localPositions?.[v1.vertexIdx] ?? 0);\r\n const v1LocalPositionY = v1.localPositionOverride ? v1.localPositionOverride[1] : (localPositions?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalPositionZ = v1.localPositionOverride ? v1.localPositionOverride[2] : (localPositions?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const v0LocalNormalX = v0.localNormalOverride ? v0.localNormalOverride[0] : (localNormals?.[v0.vertexIdx] ?? 0);\r\n const v0LocalNormalY = v0.localNormalOverride ? v0.localNormalOverride[1] : (localNormals?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalNormalZ = v0.localNormalOverride ? v0.localNormalOverride[2] : (localNormals?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalNormalX = v1.localNormalOverride ? v1.localNormalOverride[0] : (localNormals?.[v1.vertexIdx] ?? 0);\r\n const v1LocalNormalY = v1.localNormalOverride ? v1.localNormalOverride[1] : (localNormals?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalNormalZ = v1.localNormalOverride ? v1.localNormalOverride[2] : (localNormals?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const interpNormalX = v0LocalNormalX + (v1LocalNormalX - v0LocalNormalX) * clipFactor;\r\n const interpNormalY = v0LocalNormalY + (v1LocalNormalY - v0LocalNormalY) * clipFactor;\r\n const interpNormalZ = v0LocalNormalZ + (v1LocalNormalZ - v0LocalNormalZ) * clipFactor;\r\n\r\n const norm = Math.sqrt(interpNormalX * interpNormalX + interpNormalY * interpNormalY + interpNormalZ * interpNormalZ);\r\n\r\n return new DecalVertex(\r\n Vector3.Lerp(v0.position, v1.position, clipFactor),\r\n Vector3.Lerp(v0.normal, v1.normal, clipFactor).normalize(),\r\n Vector2.Lerp(v0.uv, v1.uv, clipFactor),\r\n -1,\r\n -1,\r\n localPositions\r\n ? [\r\n v0LocalPositionX + (v1LocalPositionX - v0LocalPositionX) * clipFactor,\r\n v0LocalPositionY + (v1LocalPositionY - v0LocalPositionY) * clipFactor,\r\n v0LocalPositionZ + (v1LocalPositionZ - v0LocalPositionZ) * clipFactor,\r\n ]\r\n : null,\r\n localNormals ? [interpNormalX / norm, interpNormalY / norm, interpNormalZ / norm] : null,\r\n indices,\r\n weights\r\n );\r\n };\r\n\r\n let clipResult: Nullable<DecalVertex[]> = null;\r\n\r\n if (vertices.length > 3) {\r\n clipResult = [] as DecalVertex[];\r\n }\r\n\r\n for (let index = 0; index < vertices.length; index += 3) {\r\n let total = 0;\r\n let nV1: Nullable<DecalVertex> = null;\r\n let nV2: Nullable<DecalVertex> = null;\r\n let nV3: Nullable<DecalVertex> = null;\r\n let nV4: Nullable<DecalVertex> = null;\r\n\r\n const d1 = Vector3.Dot(vertices[index].position, axis) - clipSize;\r\n const d2 = Vector3.Dot(vertices[index + 1].position, axis) - clipSize;\r\n const d3 = Vector3.Dot(vertices[index + 2].position, axis) - clipSize;\r\n\r\n const v1Out = d1 > 0;\r\n const v2Out = d2 > 0;\r\n const v3Out = d3 > 0;\r\n\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n\r\n switch (total) {\r\n case 0:\r\n if (vertices.length > 3) {\r\n clipResult!.push(vertices[index]);\r\n clipResult!.push(vertices[index + 1]);\r\n clipResult!.push(vertices[index + 2]);\r\n } else {\r\n clipResult = vertices;\r\n }\r\n break;\r\n case 1:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n\r\n clipResult.push(nV3);\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV1.clone());\r\n\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n clipResult.push(nV1.clone());\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3);\r\n\r\n clipResult.push(nV4);\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n\r\n return clipResult;\r\n };\r\n\r\n const sourceMeshAsMesh = sourceMesh instanceof Mesh ? sourceMesh : null;\r\n const matrixData = sourceMeshAsMesh?._thinInstanceDataStorage.matrixData;\r\n\r\n const numMatrices = sourceMeshAsMesh?.thinInstanceCount || 1;\r\n const thinInstanceMatrix = TmpVectors.Matrix[0];\r\n\r\n thinInstanceMatrix.copyFrom(Matrix.IdentityReadOnly);\r\n\r\n for (let m = 0; m < numMatrices; ++m) {\r\n if (sourceMeshAsMesh?.hasThinInstances && matrixData) {\r\n const ofst = m * 16;\r\n\r\n thinInstanceMatrix.setRowFromFloats(0, matrixData[ofst + 0], matrixData[ofst + 1], matrixData[ofst + 2], matrixData[ofst + 3]);\r\n thinInstanceMatrix.setRowFromFloats(1, matrixData[ofst + 4], matrixData[ofst + 5], matrixData[ofst + 6], matrixData[ofst + 7]);\r\n thinInstanceMatrix.setRowFromFloats(2, matrixData[ofst + 8], matrixData[ofst + 9], matrixData[ofst + 10], matrixData[ofst + 11]);\r\n thinInstanceMatrix.setRowFromFloats(3, matrixData[ofst + 12], matrixData[ofst + 13], matrixData[ofst + 14], matrixData[ofst + 15]);\r\n }\r\n\r\n // Matrix\r\n const decalWorldMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, angle).multiply(Matrix.Translation(position.x, position.y, position.z));\r\n const inverseDecalWorldMatrix = Matrix.Invert(decalWorldMatrix);\r\n const meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n const transformMatrix = thinInstanceMatrix.multiply(meshWorldMatrix).multiply(inverseDecalWorldMatrix);\r\n\r\n const oneFaceVertices = new Array<DecalVertex>(3);\r\n\r\n for (let index = 0; index < indices.length; index += 3) {\r\n let faceVertices: Nullable<DecalVertex[]> = oneFaceVertices;\r\n\r\n faceVertices[0] = extractDecalVector3(index, transformMatrix);\r\n faceVertices[1] = extractDecalVector3(index + 1, transformMatrix);\r\n faceVertices[2] = extractDecalVector3(index + 2, transformMatrix);\r\n\r\n if (options.cullBackFaces) {\r\n // If all the normals of the vertices of the face are pointing away from the view direction we discard the face.\r\n // As computations are done in the decal coordinate space, the viewDirection is (0,0,1), so when dot(vertexNormal, -viewDirection) <= 0 the vertex is culled\r\n if (-faceVertices[0].normal.z <= 0 && -faceVertices[1].normal.z <= 0 && -faceVertices[2].normal.z <= 0) {\r\n continue;\r\n }\r\n }\r\n\r\n // Clip\r\n faceVertices = clip(faceVertices, XpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, XnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n\r\n // Add UVs and get back to world\r\n for (let vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n const vertex = faceVertices[vIndex];\r\n\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n if (useLocalComputation) {\r\n if (vertex.localPositionOverride) {\r\n vertexData.positions[currentVertexDataIndex * 3] = vertex.localPositionOverride[0];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = vertex.localPositionOverride[1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = vertex.localPositionOverride[2];\r\n } else if (localPositions) {\r\n vertexData.positions[currentVertexDataIndex * 3] = localPositions[vertex.vertexIdx];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = localPositions[vertex.vertexIdx + 1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = localPositions[vertex.vertexIdx + 2];\r\n }\r\n if (vertex.localNormalOverride) {\r\n vertexData.normals[currentVertexDataIndex * 3] = vertex.localNormalOverride[0];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = vertex.localNormalOverride[1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = vertex.localNormalOverride[2];\r\n } else if (localNormals) {\r\n vertexData.normals[currentVertexDataIndex * 3] = localNormals[vertex.vertexIdx];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = localNormals[vertex.vertexIdx + 1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = localNormals[vertex.vertexIdx + 2];\r\n }\r\n } else {\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n }\r\n if (vertexData.matricesIndices && vertexData.matricesWeights) {\r\n if (vertex.matrixIndicesOverride) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = vertex.matrixIndicesOverride[0];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = vertex.matrixIndicesOverride[1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = vertex.matrixIndicesOverride[2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = vertex.matrixIndicesOverride[3];\r\n } else {\r\n if (matIndices) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = matIndices[vertex.vertexIdxForBones];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = matIndices[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = matIndices[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = matIndices[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matIndicesExtra && vertexData.matricesIndicesExtra) {\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4] = matIndicesExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 1] = matIndicesExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 2] = matIndicesExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 3] = matIndicesExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n if (vertex.matrixWeightsOverride) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = vertex.matrixWeightsOverride[0];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = vertex.matrixWeightsOverride[1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = vertex.matrixWeightsOverride[2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = vertex.matrixWeightsOverride[3];\r\n } else {\r\n if (matWeights) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = matWeights[vertex.vertexIdxForBones];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = matWeights[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = matWeights[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = matWeights[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matWeightsExtra && vertexData.matricesWeightsExtra) {\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4] = matWeightsExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 1] = matWeightsExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 2] = matWeightsExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 3] = matWeightsExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n }\r\n\r\n if (!options.captureUVS) {\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n vertexData.uvs.push(useOpenGLOrientationForUV ? 1 - v : v);\r\n } else {\r\n vertex.uv.toArray(vertexData.uvs, currentVertexDataIndex * 2);\r\n }\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n }\r\n\r\n // Avoid the \"Setting vertex data kind 'XXX' with an empty array\" warning when calling vertexData.applyToMesh\r\n if (vertexData.indices.length === 0) {\r\n vertexData.indices = null;\r\n }\r\n if (vertexData.positions.length === 0) {\r\n vertexData.positions = null;\r\n }\r\n if (vertexData.normals.length === 0) {\r\n vertexData.normals = null;\r\n }\r\n if (vertexData.uvs.length === 0) {\r\n vertexData.uvs = null;\r\n }\r\n if (vertexData.matricesIndices?.length === 0) {\r\n vertexData.matricesIndices = null;\r\n }\r\n if (vertexData.matricesWeights?.length === 0) {\r\n vertexData.matricesWeights = null;\r\n }\r\n if (vertexData.matricesIndicesExtra?.length === 0) {\r\n vertexData.matricesIndicesExtra = null;\r\n }\r\n if (vertexData.matricesWeightsExtra?.length === 0) {\r\n vertexData.matricesWeightsExtra = null;\r\n }\r\n\r\n // Return mesh\r\n const decal = new Mesh(name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n\r\n if (useLocalComputation) {\r\n decal.skeleton = sourceMesh.skeleton;\r\n decal.parent = sourceMesh;\r\n } else {\r\n decal.position = position.clone();\r\n decal.rotation = new Vector3(pitch, yaw, angle);\r\n }\r\n\r\n decal.computeWorldMatrix(true);\r\n decal.refreshBoundingInfo(true, true);\r\n\r\n return decal;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the function directly from the module\r\n */\r\nexport const DecalBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateDecal,\r\n};\r\n\r\nMesh.CreateDecal = (name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh => {\r\n const options = {\r\n position,\r\n normal,\r\n size,\r\n angle,\r\n };\r\n\r\n return CreateDecal(name, sourceMesh, options);\r\n};\r\n"]}
|
|
@@ -68,14 +68,6 @@ export declare class TransformNode extends Node {
|
|
|
68
68
|
*/
|
|
69
69
|
get billboardMode(): number;
|
|
70
70
|
set billboardMode(value: number);
|
|
71
|
-
private _preserveParentRotationForBillboard;
|
|
72
|
-
/**
|
|
73
|
-
* Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.
|
|
74
|
-
* This could be useful for glTF objects where parent rotation helps converting from right handed to left handed
|
|
75
|
-
*/
|
|
76
|
-
get preserveParentRotationForBillboard(): boolean;
|
|
77
|
-
set preserveParentRotationForBillboard(value: boolean);
|
|
78
|
-
private _computeUseBillboardPath;
|
|
79
71
|
/**
|
|
80
72
|
* Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube
|
|
81
73
|
*/
|
package/Meshes/transformNode.js
CHANGED
|
@@ -5,7 +5,6 @@ import { Observable } from "../Misc/observable.js";
|
|
|
5
5
|
import { Quaternion, Matrix, Vector3, TmpVectors } from "../Maths/math.vector.js";
|
|
6
6
|
import { Node } from "../node.js";
|
|
7
7
|
import { GetClass } from "../Misc/typeStore.js";
|
|
8
|
-
const ConvertRHSToLHS = Matrix.Compose(Vector3.One(), Quaternion.FromEulerAngles(0, Math.PI, 0), Vector3.Zero());
|
|
9
8
|
/**
|
|
10
9
|
* A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.
|
|
11
10
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
|
|
@@ -32,24 +31,6 @@ export class TransformNode extends Node {
|
|
|
32
31
|
}
|
|
33
32
|
this._billboardMode = value;
|
|
34
33
|
this._cache.useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;
|
|
35
|
-
this._computeUseBillboardPath();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.
|
|
39
|
-
* This could be useful for glTF objects where parent rotation helps converting from right handed to left handed
|
|
40
|
-
*/
|
|
41
|
-
get preserveParentRotationForBillboard() {
|
|
42
|
-
return this._preserveParentRotationForBillboard;
|
|
43
|
-
}
|
|
44
|
-
set preserveParentRotationForBillboard(value) {
|
|
45
|
-
if (value === this._preserveParentRotationForBillboard) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
this._preserveParentRotationForBillboard = value;
|
|
49
|
-
this._computeUseBillboardPath();
|
|
50
|
-
}
|
|
51
|
-
_computeUseBillboardPath() {
|
|
52
|
-
this._cache.useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;
|
|
53
34
|
}
|
|
54
35
|
/**
|
|
55
36
|
* Gets or sets the distance of the object to max, often used by skybox
|
|
@@ -76,7 +57,6 @@ export class TransformNode extends Node {
|
|
|
76
57
|
this._transformToBoneReferal = null;
|
|
77
58
|
this._isAbsoluteSynced = false;
|
|
78
59
|
this._billboardMode = TransformNode.BILLBOARDMODE_NONE;
|
|
79
|
-
this._preserveParentRotationForBillboard = false;
|
|
80
60
|
/**
|
|
81
61
|
* Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube
|
|
82
62
|
*/
|
|
@@ -266,7 +246,6 @@ export class TransformNode extends Node {
|
|
|
266
246
|
cache.billboardMode = -1;
|
|
267
247
|
cache.infiniteDistance = false;
|
|
268
248
|
cache.useBillboardPosition = false;
|
|
269
|
-
cache.useBillboardPath = false;
|
|
270
249
|
}
|
|
271
250
|
/**
|
|
272
251
|
* Returns the current mesh absolute position.
|
|
@@ -904,7 +883,7 @@ export class TransformNode extends Node {
|
|
|
904
883
|
* @returns true if the world matrix computation needs the camera information to be computed
|
|
905
884
|
*/
|
|
906
885
|
isWorldMatrixCameraDependent() {
|
|
907
|
-
return (this._infiniteDistance && !this.parent) ||
|
|
886
|
+
return (this._infiniteDistance && !this.parent) || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE;
|
|
908
887
|
}
|
|
909
888
|
/**
|
|
910
889
|
* Computes the world matrix of the node
|
|
@@ -990,7 +969,7 @@ export class TransformNode extends Node {
|
|
|
990
969
|
if (force) {
|
|
991
970
|
parent.computeWorldMatrix(force);
|
|
992
971
|
}
|
|
993
|
-
if (
|
|
972
|
+
if (this.billboardMode) {
|
|
994
973
|
if (this._transformToBoneReferal) {
|
|
995
974
|
const bone = this.parent;
|
|
996
975
|
bone.getSkeleton().prepare();
|
|
@@ -1029,76 +1008,75 @@ export class TransformNode extends Node {
|
|
|
1029
1008
|
else {
|
|
1030
1009
|
this._worldMatrix.copyFrom(this._localMatrix);
|
|
1031
1010
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
TmpVectors.Matrix[1].
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
eulerAngles.z
|
|
1011
|
+
if (camera && this.billboardMode) {
|
|
1012
|
+
// Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)
|
|
1013
|
+
if (!cache.useBillboardPosition) {
|
|
1014
|
+
const storedTranslation = TmpVectors.Vector3[0];
|
|
1015
|
+
this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation
|
|
1016
|
+
// Cancel camera rotation
|
|
1017
|
+
TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());
|
|
1018
|
+
TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);
|
|
1019
|
+
TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);
|
|
1020
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {
|
|
1021
|
+
TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);
|
|
1022
|
+
const eulerAngles = TmpVectors.Vector3[1];
|
|
1023
|
+
TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);
|
|
1024
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {
|
|
1025
|
+
eulerAngles.x = 0;
|
|
1026
|
+
}
|
|
1027
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {
|
|
1028
|
+
eulerAngles.y = 0;
|
|
1029
|
+
}
|
|
1030
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {
|
|
1031
|
+
eulerAngles.z = 0;
|
|
1032
|
+
}
|
|
1033
|
+
Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);
|
|
1055
1034
|
}
|
|
1056
|
-
|
|
1035
|
+
this._worldMatrix.setTranslationFromFloats(0, 0, 0);
|
|
1036
|
+
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1037
|
+
// Restore translation
|
|
1038
|
+
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1057
1039
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
eulerAngles.y
|
|
1040
|
+
// Billboarding based on camera position
|
|
1041
|
+
else if (cache.useBillboardPosition) {
|
|
1042
|
+
const storedTranslation = TmpVectors.Vector3[0];
|
|
1043
|
+
// Save translation
|
|
1044
|
+
this._worldMatrix.getTranslationToRef(storedTranslation);
|
|
1045
|
+
// Compute camera position in local space
|
|
1046
|
+
const cameraPosition = camera.globalPosition;
|
|
1047
|
+
this._worldMatrix.invertToRef(TmpVectors.Matrix[1]);
|
|
1048
|
+
const camInObjSpace = TmpVectors.Vector3[1];
|
|
1049
|
+
Vector3.TransformCoordinatesToRef(cameraPosition, TmpVectors.Matrix[1], camInObjSpace);
|
|
1050
|
+
camInObjSpace.normalize();
|
|
1051
|
+
// Find the lookAt info in local space
|
|
1052
|
+
const yaw = -Math.atan2(camInObjSpace.z, camInObjSpace.x) + Math.PI / 2;
|
|
1053
|
+
const len = Math.sqrt(camInObjSpace.x * camInObjSpace.x + camInObjSpace.z * camInObjSpace.z);
|
|
1054
|
+
const pitch = -Math.atan2(camInObjSpace.y, len);
|
|
1055
|
+
Quaternion.RotationYawPitchRollToRef(yaw, pitch, 0, TmpVectors.Quaternion[0]);
|
|
1056
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {
|
|
1057
|
+
const eulerAngles = TmpVectors.Vector3[1];
|
|
1058
|
+
TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);
|
|
1059
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {
|
|
1060
|
+
eulerAngles.x = 0;
|
|
1061
|
+
}
|
|
1062
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {
|
|
1063
|
+
eulerAngles.y = 0;
|
|
1064
|
+
}
|
|
1065
|
+
if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {
|
|
1066
|
+
eulerAngles.z = 0;
|
|
1067
|
+
}
|
|
1068
|
+
Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);
|
|
1087
1069
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1070
|
+
else {
|
|
1071
|
+
Matrix.FromQuaternionToRef(TmpVectors.Quaternion[0], TmpVectors.Matrix[0]);
|
|
1090
1072
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1073
|
+
// Cancel translation
|
|
1074
|
+
this._worldMatrix.setTranslationFromFloats(0, 0, 0);
|
|
1075
|
+
// Rotate according to lookat (diff from local to lookat)
|
|
1076
|
+
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1077
|
+
// Restore translation
|
|
1078
|
+
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1095
1079
|
}
|
|
1096
|
-
// Cancel translation
|
|
1097
|
-
this._worldMatrix.setTranslationFromFloats(0, 0, 0);
|
|
1098
|
-
// Rotate according to lookat (diff from local to lookat)
|
|
1099
|
-
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1100
|
-
// Restore translation
|
|
1101
|
-
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1102
1080
|
}
|
|
1103
1081
|
// Normal matrix
|
|
1104
1082
|
if (!this.ignoreNonUniformScaling) {
|