@babylonjs/core 7.20.0 → 7.20.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/Bones/bone.js +3 -3
- package/Bones/bone.js.map +1 -1
- package/Bones/boneLookController.js +3 -3
- package/Bones/boneLookController.js.map +1 -1
- package/Compat/compatibilityOptions.d.ts +13 -6
- package/Compat/compatibilityOptions.js +20 -4
- package/Compat/compatibilityOptions.js.map +1 -1
- package/Compat/index.d.ts +1 -1
- package/Compat/index.js +1 -1
- package/Compat/index.js.map +1 -1
- package/Culling/boundingBox.js +5 -5
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/boundingInfo.js +2 -2
- package/Culling/boundingInfo.js.map +1 -1
- package/Culling/boundingSphere.js +2 -2
- package/Culling/boundingSphere.js.map +1 -1
- package/Culling/ray.js +2 -2
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +3 -0
- package/Debug/debugLayer.js +15 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +11 -2
- package/Engines/engine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/Layers/highlightLayer.js +0 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js +3 -3
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +2 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +3 -3
- package/Materials/Textures/texture.js.map +1 -1
- package/Maths/math.color.js +3 -3
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.js +13 -14
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.js +5 -5
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.js +4 -4
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +8 -8
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -3
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +3 -3
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.js +2 -2
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +2 -2
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.js +2 -2
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.js +5 -5
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.js +4 -4
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +3 -3
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.js +4 -4
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.js +2 -2
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +2 -2
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.js +2 -2
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.js +2 -2
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/geometry.js +7 -7
- package/Meshes/geometry.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +40 -42
- package/Misc/HighDynamicRange/hdr.js +209 -202
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/index.d.ts +1 -1
- package/Misc/HighDynamicRange/index.js +1 -1
- package/Misc/HighDynamicRange/index.js.map +1 -1
- package/Misc/arrayTools.d.ts +12 -17
- package/Misc/arrayTools.js +18 -23
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/dumpTools.d.ts +50 -47
- package/Misc/dumpTools.js +153 -143
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/equirectangularCapture.js +2 -2
- package/Misc/equirectangularCapture.js.map +1 -1
- package/Misc/index.d.ts +2 -1
- package/Misc/index.js +2 -1
- package/Misc/index.js.map +1 -1
- package/Misc/rgbdTextureTools.js +1 -0
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/screenshotTools.js +3 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +2 -2
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +2 -2
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +0 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +0 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +6 -0
- package/PostProcesses/postProcess.js +22 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/background.fragment.js +1 -1
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 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AAC,oBAAoB,GAAG,IAAI,CAAC;IAC1F,IAAI,UAAU,CAAC,oBAAoB,EAAE,MAAM,KAAK,CAAC;QAAE,UAAU,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAE1F,cAAc;IACd,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpD,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE9B,IAAI,mBAAmB,EAAE;QACrB,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACrC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;KAC7B;SAAM;QACH,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,KAAK,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;KACnD;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 { Scalar } from \"../../Maths/math.scalar\";\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 { CompatibilityOptions } 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], CompatibilityOptions.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] = Scalar.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) continue;\r\n\r\n indices[index] = ind;\r\n weights[index] = Scalar.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) continue;\r\n faceVertices = clip(faceVertices, xnAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, ypAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, ynAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, zpAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, znAxis);\r\n if (!faceVertices) continue;\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 (<number[]>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 (<number[]>vertexData.uvs).push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n (<number[]>vertexData.uvs).push(CompatibilityOptions.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) vertexData.indices = null;\r\n if (vertexData.positions.length === 0) vertexData.positions = null;\r\n if (vertexData.normals.length === 0) vertexData.normals = null;\r\n if (vertexData.uvs.length === 0) vertexData.uvs = null;\r\n if (vertexData.matricesIndices?.length === 0) vertexData.matricesIndices = null;\r\n if (vertexData.matricesWeights?.length === 0) vertexData.matricesWeights = null;\r\n if (vertexData.matricesIndicesExtra?.length === 0) vertexData.matricesIndicesExtra = null;\r\n if (vertexData.matricesWeightsExtra?.length === 0) vertexData.matricesWeightsExtra = null;\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/E,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAErC,gBAAgB;AAChB,MAAM,WAAW;IACb,YACW,WAAoB,OAAO,CAAC,IAAI,EAAE,EAClC,SAAkB,OAAO,CAAC,EAAE,EAAE,EAC9B,KAAc,OAAO,CAAC,IAAI,EAAE,EAC5B,YAAoB,CAAC,EACrB,oBAA4B,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ths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\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] = Scalar.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) continue;\r\n\r\n indices[index] = ind;\r\n weights[index] = Scalar.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) continue;\r\n faceVertices = clip(faceVertices, xnAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, ypAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, ynAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, zpAxis);\r\n if (!faceVertices) continue;\r\n faceVertices = clip(faceVertices, znAxis);\r\n if (!faceVertices) continue;\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 (<number[]>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 (<number[]>vertexData.uvs).push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n (<number[]>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) vertexData.indices = null;\r\n if (vertexData.positions.length === 0) vertexData.positions = null;\r\n if (vertexData.normals.length === 0) vertexData.normals = null;\r\n if (vertexData.uvs.length === 0) vertexData.uvs = null;\r\n if (vertexData.matricesIndices?.length === 0) vertexData.matricesIndices = null;\r\n if (vertexData.matricesWeights?.length === 0) vertexData.matricesWeights = null;\r\n if (vertexData.matricesIndicesExtra?.length === 0) vertexData.matricesIndicesExtra = null;\r\n if (vertexData.matricesWeightsExtra?.length === 0) vertexData.matricesWeightsExtra = null;\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,6 +1,6 @@
|
|
|
1
1
|
import { Mesh } from "../mesh.js";
|
|
2
2
|
import { VertexData } from "../mesh.vertexData.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates the VertexData of the Disc or regular Polygon
|
|
6
6
|
* @param options an object used to set the following optional parameters for the disc, required but can be empty
|
|
@@ -34,12 +34,12 @@ export function CreateDiscVertexData(options) {
|
|
|
34
34
|
const u = (x + 1) / 2;
|
|
35
35
|
const v = (1 - y) / 2;
|
|
36
36
|
positions.push(radius * x, radius * y, 0);
|
|
37
|
-
uvs.push(u,
|
|
37
|
+
uvs.push(u, useOpenGLOrientationForUV ? 1 - v : v);
|
|
38
38
|
a += step;
|
|
39
39
|
}
|
|
40
40
|
if (arc === 1) {
|
|
41
41
|
positions.push(positions[3], positions[4], positions[5]); // close the circle
|
|
42
|
-
uvs.push(uvs[2],
|
|
42
|
+
uvs.push(uvs[2], useOpenGLOrientationForUV ? 1 - uvs[3] : uvs[3]);
|
|
43
43
|
}
|
|
44
44
|
//indices
|
|
45
45
|
const vertexNb = positions.length / 3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/discBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"discBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/discBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC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AAG;QACZ,MAAM;QACN,YAAY;QACZ,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData of the Disc or regular Polygon\r\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\r\n * * radius the radius of the disc, optional default 0.5\r\n * * tessellation the number of polygon sides, optional, default 64\r\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\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 box\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function CreateDiscVertexData(options: {\r\n radius?: number;\r\n tessellation?: number;\r\n arc?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n}): VertexData {\r\n const positions: number[] = [];\r\n const indices: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n\r\n const radius = options.radius || 0.5;\r\n const tessellation = options.tessellation || 64;\r\n const arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // positions and uvs\r\n positions.push(0, 0, 0); // disc center first\r\n uvs.push(0.5, 0.5);\r\n\r\n const theta = Math.PI * 2 * arc;\r\n const step = arc === 1 ? theta / tessellation : theta / (tessellation - 1);\r\n let a = 0;\r\n for (let t = 0; t < tessellation; t++) {\r\n const x = Math.cos(a);\r\n const y = Math.sin(a);\r\n const u = (x + 1) / 2;\r\n const v = (1 - y) / 2;\r\n positions.push(radius * x, radius * y, 0);\r\n uvs.push(u, useOpenGLOrientationForUV ? 1 - v : v);\r\n a += step;\r\n }\r\n if (arc === 1) {\r\n positions.push(positions[3], positions[4], positions[5]); // close the circle\r\n uvs.push(uvs[2], useOpenGLOrientationForUV ? 1 - uvs[3] : uvs[3]);\r\n }\r\n\r\n //indices\r\n const vertexNb = positions.length / 3;\r\n for (let i = 1; i < vertexNb - 1; i++) {\r\n indices.push(i + 1, 0, i);\r\n }\r\n\r\n // result\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n const 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\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a plane polygonal mesh. By default, this is a disc\r\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\r\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\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/features/featuresDeepDive/mesh/creation/set#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 plane polygonal mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#disc-or-regular-polygon\r\n */\r\nexport function CreateDisc(\r\n name: string,\r\n options: { radius?: number; tessellation?: number; arc?: number; updatable?: boolean; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 } = {},\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const disc = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n disc._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateDiscVertexData(options);\r\n\r\n vertexData.applyToMesh(disc, options.updatable);\r\n\r\n return disc;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use CreateDisc directly\r\n */\r\nexport const DiscBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateDisc,\r\n};\r\n\r\nVertexData.CreateDisc = CreateDiscVertexData;\r\n\r\nMesh.CreateDisc = (name: string, radius: number, tessellation: number, scene: Nullable<Scene> = null, updatable?: boolean, sideOrientation?: number): Mesh => {\r\n const options = {\r\n radius,\r\n tessellation,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateDisc(name, options, scene);\r\n};\r\n"]}
|
|
@@ -5,7 +5,7 @@ import { VertexData } from "../mesh.vertexData.js";
|
|
|
5
5
|
import { Logger } from "../../Misc/logger.js";
|
|
6
6
|
import { _PrimaryIsoTriangle, GeodesicData } from "../geodesicMesh.js";
|
|
7
7
|
import { GoldbergMesh } from "../goldbergMesh.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js";
|
|
9
9
|
/**
|
|
10
10
|
* Creates the Mesh for a Goldberg Polyhedron
|
|
11
11
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
@@ -46,7 +46,7 @@ export function CreateGoldbergVertexData(options, goldbergData) {
|
|
|
46
46
|
const pdata = goldbergData.vertex[verts[v]];
|
|
47
47
|
positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);
|
|
48
48
|
const vCoord = (pdata[1] * sizeY - minY) / (maxY - minY);
|
|
49
|
-
uvs.push((pdata[0] * sizeX - minX) / (maxX - minX),
|
|
49
|
+
uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), useOpenGLOrientationForUV ? 1 - vCoord : vCoord);
|
|
50
50
|
}
|
|
51
51
|
for (let v = 0; v < verts.length - 2; v++) {
|
|
52
52
|
indices.push(index, index + v + 2, index + v + 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/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;AAE3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AA8CzE;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IACpG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAW,OAAO,CAAC,KAAK,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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 type { Nullable } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { PolyhedronData } from \"../geodesicMesh\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\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 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: number[] = [];\r\n const indices: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: 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 const vCoord = (pdata[1] * sizeY - minY) / (maxY - minY);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - vCoord : vCoord);\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/features/featuresDeepDive/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 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 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.faceCenters[f].x *= sizeX;\r\n goldberg.goldbergData.faceCenters[f].y *= sizeY;\r\n goldberg.goldbergData.faceCenters[f].z *= sizeZ;\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"]}
|
|
1
|
+
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/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;AAE3C,OAAO,EAAE,mBAAmB,E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AAC,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","sourcesContent":["import type { 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 type { Nullable } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { PolyhedronData } from \"../geodesicMesh\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\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 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: number[] = [];\r\n const indices: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: 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 const vCoord = (pdata[1] * sizeY - minY) / (maxY - minY);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), useOpenGLOrientationForUV ? 1 - vCoord : vCoord);\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/features/featuresDeepDive/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 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 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.faceCenters[f].x *= sizeX;\r\n goldberg.goldbergData.faceCenters[f].y *= sizeY;\r\n goldberg.goldbergData.faceCenters[f].z *= sizeZ;\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"]}
|
|
@@ -6,7 +6,7 @@ import { GroundMesh } from "../groundMesh.js";
|
|
|
6
6
|
import { Tools } from "../../Misc/tools.js";
|
|
7
7
|
import { EngineStore } from "../../Engines/engineStore.js";
|
|
8
8
|
import { Epsilon } from "../../Maths/math.constants.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js";
|
|
10
10
|
/**
|
|
11
11
|
* Creates the VertexData for a Ground
|
|
12
12
|
* @param options an object used to set the following optional parameters for the Ground, required but can be empty
|
|
@@ -33,7 +33,7 @@ export function CreateGroundVertexData(options) {
|
|
|
33
33
|
const normal = new Vector3(0, 1.0, 0);
|
|
34
34
|
positions.push(position.x, position.y, position.z);
|
|
35
35
|
normals.push(normal.x, normal.y, normal.z);
|
|
36
|
-
uvs.push(col / subdivisionsX,
|
|
36
|
+
uvs.push(col / subdivisionsX, useOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
for (row = 0; row < subdivisionsY; row++) {
|