@babylonjs/core 6.40.0 → 6.41.0
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 +2 -2
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Debug/physicsViewer.js +2 -2
- package/Debug/physicsViewer.js.map +1 -1
- package/Engines/thinEngine.js +2 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +8 -7
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +7 -6
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +9 -12
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +8 -7
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/drawWrapper.d.ts +15 -0
- package/Materials/drawWrapper.js +15 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +0 -16
- package/Materials/effect.js +0 -16
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.js +0 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/material.d.ts +3 -2
- package/Materials/material.js +14 -12
- package/Materials/material.js.map +1 -1
- package/Materials/pushMaterial.d.ts +2 -2
- package/Materials/pushMaterial.js +9 -6
- package/Materials/pushMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +10 -16
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +8 -7
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/boxBuilder.d.ts +0 -33
- package/Meshes/Builders/boxBuilder.js +0 -33
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +0 -31
- package/Meshes/Builders/cylinderBuilder.js +0 -31
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.d.ts +0 -7
- package/Meshes/Builders/decalBuilder.js +0 -7
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.d.ts +0 -13
- package/Meshes/Builders/discBuilder.js +0 -13
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/geodesicBuilder.d.ts +0 -13
- package/Meshes/Builders/geodesicBuilder.js +0 -13
- package/Meshes/Builders/geodesicBuilder.js.map +1 -1
- package/Meshes/Builders/hemisphereBuilder.d.ts +0 -3
- package/Meshes/Builders/hemisphereBuilder.js +0 -3
- package/Meshes/Builders/hemisphereBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.d.ts +0 -19
- package/Meshes/Builders/icoSphereBuilder.js +0 -19
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.d.ts +0 -12
- package/Meshes/Builders/latheBuilder.js +0 -12
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.d.ts +0 -26
- package/Meshes/Builders/linesBuilder.js +0 -26
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.d.ts +0 -14
- package/Meshes/Builders/planeBuilder.js +0 -14
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.d.ts +0 -21
- package/Meshes/Builders/polygonBuilder.js +0 -21
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.d.ts +0 -25
- package/Meshes/Builders/polyhedronBuilder.js +0 -25
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.d.ts +0 -22
- package/Meshes/Builders/ribbonBuilder.js +0 -22
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +0 -32
- package/Meshes/Builders/shapeBuilder.js +0 -32
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.d.ts +0 -22
- package/Meshes/Builders/sphereBuilder.js +0 -22
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/geometryDesaturateBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryDesaturateBlock.js +62 -0
- package/Meshes/Node/Blocks/geometryDesaturateBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +4 -4
- package/Meshes/mesh.js.map +1 -1
- package/Physics/castingResult.d.ts +66 -0
- package/Physics/castingResult.js +61 -0
- package/Physics/castingResult.js.map +1 -0
- package/Physics/index.d.ts +4 -0
- package/Physics/index.js +4 -0
- package/Physics/index.js.map +1 -1
- package/Physics/physicsPointProximityQuery.d.ts +28 -0
- package/Physics/physicsPointProximityQuery.js +2 -0
- package/Physics/physicsPointProximityQuery.js.map +1 -0
- package/Physics/physicsRaycastResult.d.ts +2 -44
- package/Physics/physicsRaycastResult.js +7 -38
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/physicsShapeCastQuery.d.ts +32 -0
- package/Physics/physicsShapeCastQuery.js +2 -0
- package/Physics/physicsShapeCastQuery.js.map +1 -0
- package/Physics/physicsShapeProximityCastQuery.d.ts +32 -0
- package/Physics/physicsShapeProximityCastQuery.js +2 -0
- package/Physics/physicsShapeProximityCastQuery.js.map +1 -0
- package/Physics/proximityCastResult.d.ts +20 -0
- package/Physics/proximityCastResult.js +31 -0
- package/Physics/proximityCastResult.js.map +1 -0
- package/Physics/shapeCastResult.d.ts +16 -0
- package/Physics/shapeCastResult.js +24 -0
- package/Physics/shapeCastResult.js.map +1 -0
- package/Physics/v2/Plugins/havokPlugin.d.ts +28 -0
- package/Physics/v2/Plugins/havokPlugin.js +80 -11
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +2 -2
- package/XR/features/WebXRHandTracking.js +4 -5
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +25 -15
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/webXRCamera.d.ts +1 -0
- package/XR/webXRCamera.js +19 -8
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ribbonBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/ribbonBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAWtC;IACG,IAAI,SAAS,GAAgB,OAAO,CAAC,SAAS,CAAC;IAC/C,MAAM,UAAU,GAAY,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;IACxD,MAAM,SAAS,GAAY,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IACtD,MAAM,QAAQ,GAAY,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;IACpD,MAAM,aAAa,GAAW,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClE,IAAI,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC;IACrD,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CA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CAAC;QAEpD,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE1C,OAAO,MAAM,CAAC;KACjB;AACL,CAAC;AACD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,gEAAgE;IAChE,YAAY;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,sBAAsB,CAAC;AAEjD,IAAI,CAAC,YAAY,GAAG,CAChB,IAAY,EACZ,SAAsB,EACtB,aAAsB,KAAK,EAC3B,SAAkB,EAClB,MAAc,EACd,KAAa,EACb,YAAqB,KAAK,EAC1B,eAAwB,EACxB,QAAe,EACjB,EAAE;IACA,OAAO,YAAY,CACf,IAAI,EACJ;QACI,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,UAAU;QACtB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;KACrB,EACD,KAAK,CACR,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { Nullable, FloatArray } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector3, Vector2, Vector4 } from \"../../Maths/math.vector\";\r\nimport { TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\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 * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @param options.pathArray\r\n * @param options.closeArray\r\n * @param options.closePath\r\n * @param options.offset\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.invertUV\r\n * @param options.uvs\r\n * @param options.colors\r\n * @returns the VertexData of the ribbon\r\n */\r\nexport function CreateRibbonVertexData(options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n}): VertexData {\r\n let pathArray: Vector3[][] = options.pathArray;\r\n const closeArray: boolean = options.closeArray || false;\r\n const closePath: boolean = options.closePath || false;\r\n const invertUV: boolean = options.invertUV || false;\r\n const defaultOffset: number = Math.floor(pathArray[0].length / 2);\r\n let offset: number = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const customUV = options.uvs;\r\n const customColors = options.colors;\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 const us: number[][] = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n const vs: number[][] = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutive paths from pathArray\r\n const uTotalDistance: number[] = []; // uTotalDistance[p] : total distance of path p\r\n const vTotalDistance: number[] = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n let minlg: number; // minimal length among all paths from pathArray\r\n const lg: number[] = []; // array of path lengths : nb of vertex per path\r\n const idx: number[] = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n let p: number; // path iterator\r\n let i: number; // point iterator\r\n let j: number; // point iterator\r\n\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n const ar1: Vector3[] = [];\r\n const ar2: Vector3[] = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n\r\n // positions and horizontal distances (u)\r\n let idc: number = 0;\r\n const closePathCorr: number = closePath ? 1 : 0; // the final index will be +1 if closePath\r\n let path: Vector3[];\r\n let l: number;\r\n minlg = pathArray[0].length;\r\n let vectlg: number;\r\n let dist: number;\r\n for (p = 0; p < pathArray.length; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = pathArray[p];\r\n l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n\r\n if (closePath) {\r\n // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += l + closePathCorr;\r\n }\r\n\r\n // vertical distances (v)\r\n let path1: Vector3[];\r\n let path2: Vector3[];\r\n let vertex1: Nullable<Vector3> = null;\r\n let vertex2: Nullable<Vector3> = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1; p++) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[p + 1];\r\n if (i === minlg) {\r\n // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n } else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n\r\n if (closeArray && vertex2 && vertex1) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[0];\r\n if (i === minlg) {\r\n // closePath\r\n vertex2 = path2[0];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n\r\n // uvs\r\n let u: number;\r\n let v: number;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - customUV[p].y : customUV[p].y);\r\n }\r\n } else {\r\n for (p = 0; p < pathArray.length; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = uTotalDistance[p] != 0.0 ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = vTotalDistance[i] != 0.0 ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n } else {\r\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n p = 0; // path index\r\n let pi: number = 0; // positions array index\r\n let l1: number = lg[p] - 1; // path1 length\r\n let l2: number = lg[p + 1] - 1; // path2 length\r\n let min: number = l1 < l2 ? l1 : l2; // current path stop index\r\n let shft: number = idx[1] - idx[0]; // shift\r\n const path1nb: number = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\r\n\r\n while (pi <= min && p < path1nb) {\r\n // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) {\r\n // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n if (p === lg.length - 1) {\r\n // last path of pathArray reached <=> closeArray == true\r\n shft = idx[0] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[0] - 1;\r\n } else {\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n }\r\n pi = idx[p];\r\n min = l1 < l2 ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n\r\n // normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n if (closePath) {\r\n // update both the first and last vertex normals to their average value\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Colors\r\n let colors: Nullable<Float32Array> = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (let c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n const positions32 = new Float32Array(positions);\r\n const normals32 = new Float32Array(normals);\r\n const uvs32 = new Float32Array(uvs);\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, VertexBuffer.ColorKind);\r\n }\r\n\r\n if (closePath) {\r\n (<any>vertexData)._idx = idx;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\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 options.pathArray\r\n * @param options.closeArray\r\n * @param options.closePath\r\n * @param options.offset\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.instance\r\n * @param options.invertUV\r\n * @param options.uvs\r\n * @param options.colors\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n */\r\nexport function CreateRibbon(\r\n name: string,\r\n options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const pathArray = options.pathArray;\r\n const closeArray = options.closeArray;\r\n const closePath = options.closePath;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const updatable = options.updatable;\r\n\r\n if (instance) {\r\n // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n const minimum = TmpVectors.Vector3[0].setAll(Number.MAX_VALUE);\r\n const maximum = TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE);\r\n const positionFunction = (positions: FloatArray) => {\r\n let minlg = pathArray[0].length;\r\n const mesh = <Mesh>instance;\r\n let i = 0;\r\n const ns = mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE ? 2 : 1;\r\n for (let si = 1; si <= ns; ++si) {\r\n for (let p = 0; p < pathArray.length; ++p) {\r\n const path = pathArray[p];\r\n const l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n for (let j = 0; j < minlg; ++j) {\r\n const pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n const pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n const positions = <FloatArray>instance.getVerticesData(VertexBuffer.PositionKind);\r\n positionFunction(positions);\r\n if (instance.hasBoundingInfo) {\r\n instance.getBoundingInfo().reConstruct(minimum, maximum, instance._worldMatrix);\r\n } else {\r\n instance.buildBoundingInfo(minimum, maximum, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (options.colors) {\r\n const colors = <FloatArray>instance.getVerticesData(VertexBuffer.ColorKind);\r\n for (let c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n const color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(VertexBuffer.ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n const uvs = <FloatArray>instance.getVerticesData(VertexBuffer.UVKind);\r\n for (let i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - options.uvs[i].y : options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(VertexBuffer.UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n const indices = instance.getIndices();\r\n const normals = <FloatArray>instance.getVerticesData(VertexBuffer.NormalKind);\r\n const params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n VertexData.ComputeNormals(positions, indices, normals, params);\r\n\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (let p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage!.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage!.idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!instance.areNormalsFrozen) {\r\n instance.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n }\r\n\r\n return instance;\r\n } else {\r\n // new ribbon creation\r\n\r\n const ribbon = new Mesh(name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _CreationDataStorage();\r\n\r\n const vertexData = CreateRibbonVertexData(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = (<any>vertexData)._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n\r\n vertexData.applyToMesh(ribbon, updatable);\r\n\r\n return ribbon;\r\n }\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateRibbon directly\r\n */\r\nexport const RibbonBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateRibbon,\r\n};\r\n\r\nVertexData.CreateRibbon = CreateRibbonVertexData;\r\n\r\nMesh.CreateRibbon = (\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean = false,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable: boolean = false,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n) => {\r\n return CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n },\r\n scene\r\n );\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"ribbonBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/ribbonBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE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EACD,KAAK,CACR,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { Nullable, FloatArray } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector3, Vector2, Vector4 } from \"../../Maths/math.vector\";\r\nimport { TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\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 * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\nexport function CreateRibbonVertexData(options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n}): VertexData {\r\n let pathArray: Vector3[][] = options.pathArray;\r\n const closeArray: boolean = options.closeArray || false;\r\n const closePath: boolean = options.closePath || false;\r\n const invertUV: boolean = options.invertUV || false;\r\n const defaultOffset: number = Math.floor(pathArray[0].length / 2);\r\n let offset: number = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const customUV = options.uvs;\r\n const customColors = options.colors;\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 const us: number[][] = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n const vs: number[][] = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutive paths from pathArray\r\n const uTotalDistance: number[] = []; // uTotalDistance[p] : total distance of path p\r\n const vTotalDistance: number[] = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n let minlg: number; // minimal length among all paths from pathArray\r\n const lg: number[] = []; // array of path lengths : nb of vertex per path\r\n const idx: number[] = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n let p: number; // path iterator\r\n let i: number; // point iterator\r\n let j: number; // point iterator\r\n\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n const ar1: Vector3[] = [];\r\n const ar2: Vector3[] = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n\r\n // positions and horizontal distances (u)\r\n let idc: number = 0;\r\n const closePathCorr: number = closePath ? 1 : 0; // the final index will be +1 if closePath\r\n let path: Vector3[];\r\n let l: number;\r\n minlg = pathArray[0].length;\r\n let vectlg: number;\r\n let dist: number;\r\n for (p = 0; p < pathArray.length; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = pathArray[p];\r\n l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n\r\n if (closePath) {\r\n // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += l + closePathCorr;\r\n }\r\n\r\n // vertical distances (v)\r\n let path1: Vector3[];\r\n let path2: Vector3[];\r\n let vertex1: Nullable<Vector3> = null;\r\n let vertex2: Nullable<Vector3> = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1; p++) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[p + 1];\r\n if (i === minlg) {\r\n // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n } else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n\r\n if (closeArray && vertex2 && vertex1) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[0];\r\n if (i === minlg) {\r\n // closePath\r\n vertex2 = path2[0];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n\r\n // uvs\r\n let u: number;\r\n let v: number;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - customUV[p].y : customUV[p].y);\r\n }\r\n } else {\r\n for (p = 0; p < pathArray.length; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = uTotalDistance[p] != 0.0 ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = vTotalDistance[i] != 0.0 ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n } else {\r\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n p = 0; // path index\r\n let pi: number = 0; // positions array index\r\n let l1: number = lg[p] - 1; // path1 length\r\n let l2: number = lg[p + 1] - 1; // path2 length\r\n let min: number = l1 < l2 ? l1 : l2; // current path stop index\r\n let shft: number = idx[1] - idx[0]; // shift\r\n const path1nb: number = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\r\n\r\n while (pi <= min && p < path1nb) {\r\n // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) {\r\n // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n if (p === lg.length - 1) {\r\n // last path of pathArray reached <=> closeArray == true\r\n shft = idx[0] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[0] - 1;\r\n } else {\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n }\r\n pi = idx[p];\r\n min = l1 < l2 ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n\r\n // normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n if (closePath) {\r\n // update both the first and last vertex normals to their average value\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Colors\r\n let colors: Nullable<Float32Array> = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (let c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n const positions32 = new Float32Array(positions);\r\n const normals32 = new Float32Array(normals);\r\n const uvs32 = new Float32Array(uvs);\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, VertexBuffer.ColorKind);\r\n }\r\n\r\n if (closePath) {\r\n (<any>vertexData)._idx = idx;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\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 ribbon mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n */\r\nexport function CreateRibbon(\r\n name: string,\r\n options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const pathArray = options.pathArray;\r\n const closeArray = options.closeArray;\r\n const closePath = options.closePath;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const updatable = options.updatable;\r\n\r\n if (instance) {\r\n // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n const minimum = TmpVectors.Vector3[0].setAll(Number.MAX_VALUE);\r\n const maximum = TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE);\r\n const positionFunction = (positions: FloatArray) => {\r\n let minlg = pathArray[0].length;\r\n const mesh = <Mesh>instance;\r\n let i = 0;\r\n const ns = mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE ? 2 : 1;\r\n for (let si = 1; si <= ns; ++si) {\r\n for (let p = 0; p < pathArray.length; ++p) {\r\n const path = pathArray[p];\r\n const l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n for (let j = 0; j < minlg; ++j) {\r\n const pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n const pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n const positions = <FloatArray>instance.getVerticesData(VertexBuffer.PositionKind);\r\n positionFunction(positions);\r\n if (instance.hasBoundingInfo) {\r\n instance.getBoundingInfo().reConstruct(minimum, maximum, instance._worldMatrix);\r\n } else {\r\n instance.buildBoundingInfo(minimum, maximum, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (options.colors) {\r\n const colors = <FloatArray>instance.getVerticesData(VertexBuffer.ColorKind);\r\n for (let c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n const color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(VertexBuffer.ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n const uvs = <FloatArray>instance.getVerticesData(VertexBuffer.UVKind);\r\n for (let i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - options.uvs[i].y : options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(VertexBuffer.UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n const indices = instance.getIndices();\r\n const normals = <FloatArray>instance.getVerticesData(VertexBuffer.NormalKind);\r\n const params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n VertexData.ComputeNormals(positions, indices, normals, params);\r\n\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (let p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage!.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage!.idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!instance.areNormalsFrozen) {\r\n instance.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n }\r\n\r\n return instance;\r\n } else {\r\n // new ribbon creation\r\n\r\n const ribbon = new Mesh(name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _CreationDataStorage();\r\n\r\n const vertexData = CreateRibbonVertexData(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = (<any>vertexData)._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n\r\n vertexData.applyToMesh(ribbon, updatable);\r\n\r\n return ribbon;\r\n }\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateRibbon directly\r\n */\r\nexport const RibbonBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateRibbon,\r\n};\r\n\r\nVertexData.CreateRibbon = CreateRibbonVertexData;\r\n\r\nMesh.CreateRibbon = (\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean = false,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable: boolean = false,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n) => {\r\n return CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n },\r\n scene\r\n );\r\n};\r\n"]}
|
|
@@ -22,21 +22,6 @@ import { Mesh } from "../mesh";
|
|
|
22
22
|
* * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.
|
|
23
23
|
* @param name defines the name of the mesh
|
|
24
24
|
* @param options defines the options used to create the mesh
|
|
25
|
-
* @param options.shape
|
|
26
|
-
* @param options.path
|
|
27
|
-
* @param options.scale
|
|
28
|
-
* @param options.rotation
|
|
29
|
-
* @param options.closeShape
|
|
30
|
-
* @param options.closePath
|
|
31
|
-
* @param options.cap
|
|
32
|
-
* @param options.updatable
|
|
33
|
-
* @param options.sideOrientation
|
|
34
|
-
* @param options.frontUVs
|
|
35
|
-
* @param options.backUVs
|
|
36
|
-
* @param options.instance
|
|
37
|
-
* @param options.invertUV
|
|
38
|
-
* @param options.firstNormal
|
|
39
|
-
* @param options.adjustFrame
|
|
40
25
|
* @param scene defines the hosting scene
|
|
41
26
|
* @returns the extruded shape mesh
|
|
42
27
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
|
|
@@ -83,23 +68,6 @@ export declare function ExtrudeShape(name: string, options: {
|
|
|
83
68
|
* * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.
|
|
84
69
|
* @param name defines the name of the mesh
|
|
85
70
|
* @param options defines the options used to create the mesh
|
|
86
|
-
* @param options.shape
|
|
87
|
-
* @param options.path
|
|
88
|
-
* @param options.scaleFunction
|
|
89
|
-
* @param options.rotationFunction
|
|
90
|
-
* @param options.ribbonCloseArray
|
|
91
|
-
* @param options.ribbonClosePath
|
|
92
|
-
* @param options.closeShape
|
|
93
|
-
* @param options.closePath
|
|
94
|
-
* @param options.cap
|
|
95
|
-
* @param options.updatable
|
|
96
|
-
* @param options.sideOrientation
|
|
97
|
-
* @param options.frontUVs
|
|
98
|
-
* @param options.backUVs
|
|
99
|
-
* @param options.instance
|
|
100
|
-
* @param options.invertUV
|
|
101
|
-
* @param options.firstNormal
|
|
102
|
-
* @param options.adjustFrame
|
|
103
71
|
* @param scene defines the hosting scene
|
|
104
72
|
* @returns the custom extruded shape mesh
|
|
105
73
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes
|
|
@@ -21,21 +21,6 @@ import { Path3D } from "../../Maths/math.path.js";
|
|
|
21
21
|
* * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.
|
|
22
22
|
* @param name defines the name of the mesh
|
|
23
23
|
* @param options defines the options used to create the mesh
|
|
24
|
-
* @param options.shape
|
|
25
|
-
* @param options.path
|
|
26
|
-
* @param options.scale
|
|
27
|
-
* @param options.rotation
|
|
28
|
-
* @param options.closeShape
|
|
29
|
-
* @param options.closePath
|
|
30
|
-
* @param options.cap
|
|
31
|
-
* @param options.updatable
|
|
32
|
-
* @param options.sideOrientation
|
|
33
|
-
* @param options.frontUVs
|
|
34
|
-
* @param options.backUVs
|
|
35
|
-
* @param options.instance
|
|
36
|
-
* @param options.invertUV
|
|
37
|
-
* @param options.firstNormal
|
|
38
|
-
* @param options.adjustFrame
|
|
39
24
|
* @param scene defines the hosting scene
|
|
40
25
|
* @returns the extruded shape mesh
|
|
41
26
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
|
|
@@ -79,23 +64,6 @@ export function ExtrudeShape(name, options, scene = null) {
|
|
|
79
64
|
* * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.
|
|
80
65
|
* @param name defines the name of the mesh
|
|
81
66
|
* @param options defines the options used to create the mesh
|
|
82
|
-
* @param options.shape
|
|
83
|
-
* @param options.path
|
|
84
|
-
* @param options.scaleFunction
|
|
85
|
-
* @param options.rotationFunction
|
|
86
|
-
* @param options.ribbonCloseArray
|
|
87
|
-
* @param options.ribbonClosePath
|
|
88
|
-
* @param options.closeShape
|
|
89
|
-
* @param options.closePath
|
|
90
|
-
* @param options.cap
|
|
91
|
-
* @param options.updatable
|
|
92
|
-
* @param options.sideOrientation
|
|
93
|
-
* @param options.frontUVs
|
|
94
|
-
* @param options.backUVs
|
|
95
|
-
* @param options.instance
|
|
96
|
-
* @param options.invertUV
|
|
97
|
-
* @param options.firstNormal
|
|
98
|
-
* @param options.adjustFrame
|
|
99
67
|
* @param scene defines the hosting scene
|
|
100
68
|
* @returns the custom extruded shape mesh
|
|
101
69
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/shapeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,YAAY,CACxB,IAAY,EACZ,OAgBC,EACD,QAAyB,IAAI;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,OA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AG,CACtB,IAAY,EACZ,KAAgB,EAChB,IAAe,EACf,aAAkE,EAClE,gBAAqE,EACrE,gBAAyB,EACzB,eAAwB,EACxB,GAAW,EACX,KAAY,EACZ,SAAmB,EACnB,eAAwB,EACxB,QAAe,EACX,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,aAAa;QAC5B,gBAAgB,EAAE,gBAAgB;QAClC,gBAAgB,EAAE,gBAAgB;QAClC,eAAe,EAAE,eAAe;QAChC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM;QACvC,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\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 * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. Consider using this for any path that is straight, and particular for paths in the xy plane.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\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 options.shape\r\n * @param options.path\r\n * @param options.scale\r\n * @param options.rotation\r\n * @param options.closeShape\r\n * @param options.closePath\r\n * @param options.cap\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.instance\r\n * @param options.invertUV\r\n * @param options.firstNormal\r\n * @param options.adjustFrame\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShape(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scale?: number;\r\n rotation?: number;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scale = options.scale || 1;\r\n const rotation = options.rotation || 0;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance || null;\r\n const invertUV = options.invertUV || false;\r\n const closeShape = options.closeShape || false;\r\n const closePath = options.closePath || false;\r\n\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n scale,\r\n rotation,\r\n null,\r\n null,\r\n closePath,\r\n closeShape,\r\n cap,\r\n false,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n options.firstNormal || null,\r\n options.adjustFrame ? true : false\r\n );\r\n}\r\n\r\n/**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray` - depreciated in favor of closeShape\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray` - depreciated in favor of closePath\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\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 * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. It should be supplied when the path is in the xy plane, and particularly if these sections are straight, because the underlying Path3D object will pick a normal in the xy plane that causes the extrusion to be collapsed into the plane. This should be used for any path that is straight.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\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 options.shape\r\n * @param options.path\r\n * @param options.scaleFunction\r\n * @param options.rotationFunction\r\n * @param options.ribbonCloseArray\r\n * @param options.ribbonClosePath\r\n * @param options.closeShape\r\n * @param options.closePath\r\n * @param options.cap\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.instance\r\n * @param options.invertUV\r\n * @param options.firstNormal\r\n * @param options.adjustFrame\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShapeCustom(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scaleFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n rotationFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n ribbonCloseArray?: boolean;\r\n ribbonClosePath?: boolean;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scaleFunction =\r\n options.scaleFunction ||\r\n (() => {\r\n return 1;\r\n });\r\n const rotationFunction =\r\n options.rotationFunction ||\r\n (() => {\r\n return 0;\r\n });\r\n const ribbonCloseArray = options.closePath || options.ribbonCloseArray || false;\r\n const ribbonClosePath = options.closeShape || options.ribbonClosePath || false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const firstNormal = options.firstNormal || null;\r\n const adjustFrame = options.adjustFrame || false;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const invertUV = options.invertUV || false;\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n null,\r\n null,\r\n scaleFunction,\r\n rotationFunction,\r\n ribbonCloseArray,\r\n ribbonClosePath,\r\n cap,\r\n true,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance || null,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n firstNormal,\r\n adjustFrame\r\n );\r\n}\r\n\r\nfunction _ExtrudeShapeGeneric(\r\n name: string,\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rbCA: boolean,\r\n rbCP: boolean,\r\n cap: number,\r\n custom: boolean,\r\n scene: Nullable<Scene>,\r\n updtbl: boolean,\r\n side: number,\r\n instance: Nullable<Mesh>,\r\n invertUV: boolean,\r\n frontUVs: Nullable<Vector4>,\r\n backUVs: Nullable<Vector4>,\r\n firstNormal: Nullable<Vector3>,\r\n adjustFrame: boolean\r\n): Mesh {\r\n // extrusion geometry\r\n const extrusionPathArray = (\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n path3D: Path3D,\r\n shapePaths: Vector3[][],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n custom: boolean,\r\n adjustFrame: boolean\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const binormals = path3D.getBinormals();\r\n const distances = path3D.getDistances();\r\n if (adjustFrame) {\r\n /* fix tangents,normals, binormals */\r\n for (let i = 0; i < tangents.length; i++) {\r\n if (tangents[i].x == 0 && tangents[i].y == 0 && tangents[i].z == 0) {\r\n tangents[i].copyFrom(tangents[i - 1]);\r\n }\r\n if (normals[i].x == 0 && normals[i].y == 0 && normals[i].z == 0) {\r\n normals[i].copyFrom(normals[i - 1]);\r\n }\r\n if (binormals[i].x == 0 && binormals[i].y == 0 && binormals[i].z == 0) {\r\n binormals[i].copyFrom(binormals[i - 1]);\r\n }\r\n if (i > 0) {\r\n let v = tangents[i - 1];\r\n if (Vector3.Dot(v, tangents[i]) < 0) {\r\n tangents[i].scaleInPlace(-1);\r\n }\r\n v = normals[i - 1];\r\n if (Vector3.Dot(v, normals[i]) < 0) {\r\n normals[i].scaleInPlace(-1);\r\n }\r\n v = binormals[i - 1];\r\n if (Vector3.Dot(v, binormals[i]) < 0) {\r\n binormals[i].scaleInPlace(-1);\r\n }\r\n }\r\n }\r\n }\r\n let angle = 0;\r\n const returnScale = () => {\r\n return scale !== null ? scale : 1;\r\n };\r\n const returnRotation = () => {\r\n return rotation !== null ? rotation : 0;\r\n };\r\n const rotate: { (i: number, distance: number): number } = custom && rotateFunction ? rotateFunction : returnRotation;\r\n const scl: { (i: number, distance: number): number } = custom && scaleFunction ? scaleFunction : returnScale;\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n\r\n for (let i = 0; i < curve.length; i++) {\r\n const shapePath: Vector3[] = [];\r\n const angleStep = rotate(i, distances[i]);\r\n const scaleRatio = scl(i, distances[i]);\r\n Matrix.RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n for (let p = 0; p < shape.length; p++) {\r\n const planed = tangents[i].scale(shape[p].z).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y));\r\n const rotated = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n const capPath = (shapePath: Vector3[]) => {\r\n const pointCap = Array<Vector3>();\r\n const barycenter = Vector3.Zero();\r\n let i: number;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case Mesh.CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case Mesh.CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // instance update\r\n const storage = instance._creationDataStorage!;\r\n path3D = firstNormal ? storage.path3D.update(curve, firstNormal) : storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom, adjustFrame);\r\n instance = CreateRibbon(\"\", { pathArray, closeArray: false, closePath: false, offset: 0, updatable: false, sideOrientation: 0, instance }, scene || undefined);\r\n\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);\r\n const newShapePaths = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame);\r\n const extrudedGeneric = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: rbCA,\r\n closePath: rbCP,\r\n updatable: updtbl,\r\n sideOrientation: side,\r\n invertUV: invertUV,\r\n frontUVs: frontUVs || undefined,\r\n backUVs: backUVs || undefined,\r\n },\r\n scene\r\n );\r\n extrudedGeneric._creationDataStorage!.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage!.path3D = path3D;\r\n extrudedGeneric._creationDataStorage!.cap = cap;\r\n\r\n return extrudedGeneric;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use the functions directly from the module\r\n */\r\nexport const ShapeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShape,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShapeCustom,\r\n};\r\n\r\nMesh.ExtrudeShape = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene> = null,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShape(name, options, scene);\r\n};\r\n\r\nMesh.ExtrudeShapeCustom = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShapeCustom(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"shapeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/shapeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CACxB,IAAY,EACZ,OAgBC,EACD,QAAyB,IAAI;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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aAAa;QAC5B,gBAAgB,EAAE,gBAAgB;QAClC,gBAAgB,EAAE,gBAAgB;QAClC,eAAe,EAAE,eAAe;QAChC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM;QACvC,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\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 * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. Consider using this for any path that is straight, and particular for paths in the xy plane.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\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 extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShape(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scale?: number;\r\n rotation?: number;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scale = options.scale || 1;\r\n const rotation = options.rotation || 0;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance || null;\r\n const invertUV = options.invertUV || false;\r\n const closeShape = options.closeShape || false;\r\n const closePath = options.closePath || false;\r\n\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n scale,\r\n rotation,\r\n null,\r\n null,\r\n closePath,\r\n closeShape,\r\n cap,\r\n false,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n options.firstNormal || null,\r\n options.adjustFrame ? true : false\r\n );\r\n}\r\n\r\n/**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray` - depreciated in favor of closeShape\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray` - depreciated in favor of closePath\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\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 optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\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 * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. It should be supplied when the path is in the xy plane, and particularly if these sections are straight, because the underlying Path3D object will pick a normal in the xy plane that causes the extrusion to be collapsed into the plane. This should be used for any path that is straight.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\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 custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShapeCustom(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scaleFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n rotationFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n ribbonCloseArray?: boolean;\r\n ribbonClosePath?: boolean;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scaleFunction =\r\n options.scaleFunction ||\r\n (() => {\r\n return 1;\r\n });\r\n const rotationFunction =\r\n options.rotationFunction ||\r\n (() => {\r\n return 0;\r\n });\r\n const ribbonCloseArray = options.closePath || options.ribbonCloseArray || false;\r\n const ribbonClosePath = options.closeShape || options.ribbonClosePath || false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const firstNormal = options.firstNormal || null;\r\n const adjustFrame = options.adjustFrame || false;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const invertUV = options.invertUV || false;\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n null,\r\n null,\r\n scaleFunction,\r\n rotationFunction,\r\n ribbonCloseArray,\r\n ribbonClosePath,\r\n cap,\r\n true,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance || null,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n firstNormal,\r\n adjustFrame\r\n );\r\n}\r\n\r\nfunction _ExtrudeShapeGeneric(\r\n name: string,\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rbCA: boolean,\r\n rbCP: boolean,\r\n cap: number,\r\n custom: boolean,\r\n scene: Nullable<Scene>,\r\n updtbl: boolean,\r\n side: number,\r\n instance: Nullable<Mesh>,\r\n invertUV: boolean,\r\n frontUVs: Nullable<Vector4>,\r\n backUVs: Nullable<Vector4>,\r\n firstNormal: Nullable<Vector3>,\r\n adjustFrame: boolean\r\n): Mesh {\r\n // extrusion geometry\r\n const extrusionPathArray = (\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n path3D: Path3D,\r\n shapePaths: Vector3[][],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n custom: boolean,\r\n adjustFrame: boolean\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const binormals = path3D.getBinormals();\r\n const distances = path3D.getDistances();\r\n if (adjustFrame) {\r\n /* fix tangents,normals, binormals */\r\n for (let i = 0; i < tangents.length; i++) {\r\n if (tangents[i].x == 0 && tangents[i].y == 0 && tangents[i].z == 0) {\r\n tangents[i].copyFrom(tangents[i - 1]);\r\n }\r\n if (normals[i].x == 0 && normals[i].y == 0 && normals[i].z == 0) {\r\n normals[i].copyFrom(normals[i - 1]);\r\n }\r\n if (binormals[i].x == 0 && binormals[i].y == 0 && binormals[i].z == 0) {\r\n binormals[i].copyFrom(binormals[i - 1]);\r\n }\r\n if (i > 0) {\r\n let v = tangents[i - 1];\r\n if (Vector3.Dot(v, tangents[i]) < 0) {\r\n tangents[i].scaleInPlace(-1);\r\n }\r\n v = normals[i - 1];\r\n if (Vector3.Dot(v, normals[i]) < 0) {\r\n normals[i].scaleInPlace(-1);\r\n }\r\n v = binormals[i - 1];\r\n if (Vector3.Dot(v, binormals[i]) < 0) {\r\n binormals[i].scaleInPlace(-1);\r\n }\r\n }\r\n }\r\n }\r\n let angle = 0;\r\n const returnScale = () => {\r\n return scale !== null ? scale : 1;\r\n };\r\n const returnRotation = () => {\r\n return rotation !== null ? rotation : 0;\r\n };\r\n const rotate: { (i: number, distance: number): number } = custom && rotateFunction ? rotateFunction : returnRotation;\r\n const scl: { (i: number, distance: number): number } = custom && scaleFunction ? scaleFunction : returnScale;\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n\r\n for (let i = 0; i < curve.length; i++) {\r\n const shapePath: Vector3[] = [];\r\n const angleStep = rotate(i, distances[i]);\r\n const scaleRatio = scl(i, distances[i]);\r\n Matrix.RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n for (let p = 0; p < shape.length; p++) {\r\n const planed = tangents[i].scale(shape[p].z).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y));\r\n const rotated = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n const capPath = (shapePath: Vector3[]) => {\r\n const pointCap = Array<Vector3>();\r\n const barycenter = Vector3.Zero();\r\n let i: number;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case Mesh.CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case Mesh.CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // instance update\r\n const storage = instance._creationDataStorage!;\r\n path3D = firstNormal ? storage.path3D.update(curve, firstNormal) : storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom, adjustFrame);\r\n instance = CreateRibbon(\"\", { pathArray, closeArray: false, closePath: false, offset: 0, updatable: false, sideOrientation: 0, instance }, scene || undefined);\r\n\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);\r\n const newShapePaths = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame);\r\n const extrudedGeneric = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: rbCA,\r\n closePath: rbCP,\r\n updatable: updtbl,\r\n sideOrientation: side,\r\n invertUV: invertUV,\r\n frontUVs: frontUVs || undefined,\r\n backUVs: backUVs || undefined,\r\n },\r\n scene\r\n );\r\n extrudedGeneric._creationDataStorage!.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage!.path3D = path3D;\r\n extrudedGeneric._creationDataStorage!.cap = cap;\r\n\r\n return extrudedGeneric;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use the functions directly from the module\r\n */\r\nexport const ShapeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShape,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShapeCustom,\r\n};\r\n\r\nMesh.ExtrudeShape = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene> = null,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShape(name, options, scene);\r\n};\r\n\r\nMesh.ExtrudeShapeCustom = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShapeCustom(name, options, scene);\r\n};\r\n"]}
|
|
@@ -16,17 +16,6 @@ import type { Nullable } from "../../types";
|
|
|
16
16
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
17
17
|
* * 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)
|
|
18
18
|
* * 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)
|
|
19
|
-
* @param options.segments
|
|
20
|
-
* @param options.diameter
|
|
21
|
-
* @param options.diameterX
|
|
22
|
-
* @param options.diameterY
|
|
23
|
-
* @param options.diameterZ
|
|
24
|
-
* @param options.arc
|
|
25
|
-
* @param options.slice
|
|
26
|
-
* @param options.sideOrientation
|
|
27
|
-
* @param options.frontUVs
|
|
28
|
-
* @param options.backUVs
|
|
29
|
-
* @param options.dedupTopBottomIndices
|
|
30
19
|
* @returns the VertexData of the ellipsoid
|
|
31
20
|
*/
|
|
32
21
|
export declare function CreateSphereVertexData(options: {
|
|
@@ -54,17 +43,6 @@ export declare function CreateSphereVertexData(options: {
|
|
|
54
43
|
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
55
44
|
* @param name defines the name of the mesh
|
|
56
45
|
* @param options defines the options used to create the mesh
|
|
57
|
-
* @param options.segments
|
|
58
|
-
* @param options.diameter
|
|
59
|
-
* @param options.diameterX
|
|
60
|
-
* @param options.diameterY
|
|
61
|
-
* @param options.diameterZ
|
|
62
|
-
* @param options.arc
|
|
63
|
-
* @param options.slice
|
|
64
|
-
* @param options.sideOrientation
|
|
65
|
-
* @param options.frontUVs
|
|
66
|
-
* @param options.backUVs
|
|
67
|
-
* @param options.updatable
|
|
68
46
|
* @param scene defines the hosting scene
|
|
69
47
|
* @returns the sphere mesh
|
|
70
48
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere
|
|
@@ -15,17 +15,6 @@ import { CompatibilityOptions } from "../../Compat/compatibilityOptions.js";
|
|
|
15
15
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
16
16
|
* * 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)
|
|
17
17
|
* * 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)
|
|
18
|
-
* @param options.segments
|
|
19
|
-
* @param options.diameter
|
|
20
|
-
* @param options.diameterX
|
|
21
|
-
* @param options.diameterY
|
|
22
|
-
* @param options.diameterZ
|
|
23
|
-
* @param options.arc
|
|
24
|
-
* @param options.slice
|
|
25
|
-
* @param options.sideOrientation
|
|
26
|
-
* @param options.frontUVs
|
|
27
|
-
* @param options.backUVs
|
|
28
|
-
* @param options.dedupTopBottomIndices
|
|
29
18
|
* @returns the VertexData of the ellipsoid
|
|
30
19
|
*/
|
|
31
20
|
export function CreateSphereVertexData(options) {
|
|
@@ -108,17 +97,6 @@ export function CreateSphereVertexData(options) {
|
|
|
108
97
|
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
109
98
|
* @param name defines the name of the mesh
|
|
110
99
|
* @param options defines the options used to create the mesh
|
|
111
|
-
* @param options.segments
|
|
112
|
-
* @param options.diameter
|
|
113
|
-
* @param options.diameterX
|
|
114
|
-
* @param options.diameterY
|
|
115
|
-
* @param options.diameterZ
|
|
116
|
-
* @param options.arc
|
|
117
|
-
* @param options.slice
|
|
118
|
-
* @param options.sideOrientation
|
|
119
|
-
* @param options.frontUVs
|
|
120
|
-
* @param options.backUVs
|
|
121
|
-
* @param options.updatable
|
|
122
100
|
* @param scene defines the hosting scene
|
|
123
101
|
* @returns the sphere mesh
|
|
124
102
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphereBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/sphereBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;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E,YAAY;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,sBAAsB,CAAC;AAEjD,IAAI,CAAC,YAAY,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,QAAgB,EAAE,KAAa,EAAE,SAAmB,EAAE,eAAwB,EAAQ,EAAE;IACzI,MAAM,OAAO,GAAG;QACZ,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,QAAQ;QACnB,eAAe,EAAE,eAAe;QAChC,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) 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 * @param options.segments\r\n * @param options.diameter\r\n * @param options.diameterX\r\n * @param options.diameterY\r\n * @param options.diameterZ\r\n * @param options.arc\r\n * @param options.slice\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.dedupTopBottomIndices\r\n * @returns the VertexData of the ellipsoid\r\n */\r\nexport function CreateSphereVertexData(options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n dedupTopBottomIndices?: boolean;\r\n}): VertexData {\r\n const segments: number = (options.segments || 32) | 0;\r\n const diameterX: number = options.diameterX || options.diameter || 1;\r\n const diameterY: number = options.diameterY || options.diameter || 1;\r\n const diameterZ: number = options.diameterZ || options.diameter || 1;\r\n const arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n const slice: number = options.slice && options.slice <= 0 ? 1.0 : options.slice || 1.0;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const dedupTopBottomIndices = !!options.dedupTopBottomIndices;\r\n\r\n const radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);\r\n\r\n const totalZRotationSteps = 2 + segments;\r\n const totalYRotationSteps = 2 * totalZRotationSteps;\r\n\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n for (let zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n const normalizedZ = zRotationStep / totalZRotationSteps;\r\n const angleZ = normalizedZ * Math.PI * slice;\r\n\r\n for (let yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n const normalizedY = yRotationStep / totalYRotationSteps;\r\n\r\n const angleY = normalizedY * Math.PI * 2 * arc;\r\n\r\n const rotationZ = Matrix.RotationZ(-angleZ);\r\n const rotationY = Matrix.RotationY(angleY);\r\n const afterRotZ = Vector3.TransformCoordinates(Vector3.Up(), rotationZ);\r\n const complete = Vector3.TransformCoordinates(afterRotZ, rotationY);\r\n\r\n const vertex = complete.multiply(radius);\r\n const normal = complete.divide(radius).normalize();\r\n\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - normalizedZ : normalizedZ);\r\n }\r\n\r\n if (zRotationStep > 0) {\r\n const verticesCount = positions.length / 3;\r\n for (let firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {\r\n if (dedupTopBottomIndices) {\r\n if (zRotationStep > 1) {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n }\r\n if (zRotationStep < totalZRotationSteps || slice < 1.0) {\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n } else {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Result\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 sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\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 options.segments\r\n * @param options.diameter\r\n * @param options.diameterX\r\n * @param options.diameterY\r\n * @param options.diameterZ\r\n * @param options.arc\r\n * @param options.slice\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.updatable\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere\r\n */\r\nexport function CreateSphere(\r\n name: string,\r\n options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n updatable?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const sphere = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateSphereVertexData(options);\r\n\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n\r\n return sphere;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateSphere directly\r\n */\r\nexport const SphereBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateSphere,\r\n};\r\n\r\nVertexData.CreateSphere = CreateSphereVertexData;\r\n\r\nMesh.CreateSphere = (name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh => {\r\n const options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable,\r\n };\r\n\r\n return CreateSphere(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"sphereBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/sphereBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAYtC;IACG,MAAM,QAAQ,GAAW,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACtD,MAAM,SAAS,GAAW,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,IA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AAQ;QACnB,eAAe,EAAE,eAAe;QAChC,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) 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 ellipsoid\r\n */\r\nexport function CreateSphereVertexData(options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n dedupTopBottomIndices?: boolean;\r\n}): VertexData {\r\n const segments: number = (options.segments || 32) | 0;\r\n const diameterX: number = options.diameterX || options.diameter || 1;\r\n const diameterY: number = options.diameterY || options.diameter || 1;\r\n const diameterZ: number = options.diameterZ || options.diameter || 1;\r\n const arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n const slice: number = options.slice && options.slice <= 0 ? 1.0 : options.slice || 1.0;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const dedupTopBottomIndices = !!options.dedupTopBottomIndices;\r\n\r\n const radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);\r\n\r\n const totalZRotationSteps = 2 + segments;\r\n const totalYRotationSteps = 2 * totalZRotationSteps;\r\n\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n for (let zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n const normalizedZ = zRotationStep / totalZRotationSteps;\r\n const angleZ = normalizedZ * Math.PI * slice;\r\n\r\n for (let yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n const normalizedY = yRotationStep / totalYRotationSteps;\r\n\r\n const angleY = normalizedY * Math.PI * 2 * arc;\r\n\r\n const rotationZ = Matrix.RotationZ(-angleZ);\r\n const rotationY = Matrix.RotationY(angleY);\r\n const afterRotZ = Vector3.TransformCoordinates(Vector3.Up(), rotationZ);\r\n const complete = Vector3.TransformCoordinates(afterRotZ, rotationY);\r\n\r\n const vertex = complete.multiply(radius);\r\n const normal = complete.divide(radius).normalize();\r\n\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - normalizedZ : normalizedZ);\r\n }\r\n\r\n if (zRotationStep > 0) {\r\n const verticesCount = positions.length / 3;\r\n for (let firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {\r\n if (dedupTopBottomIndices) {\r\n if (zRotationStep > 1) {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n }\r\n if (zRotationStep < totalZRotationSteps || slice < 1.0) {\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n } else {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Result\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 sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\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 sphere mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere\r\n */\r\nexport function CreateSphere(\r\n name: string,\r\n options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n updatable?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const sphere = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateSphereVertexData(options);\r\n\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n\r\n return sphere;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateSphere directly\r\n */\r\nexport const SphereBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateSphere,\r\n};\r\n\r\nVertexData.CreateSphere = CreateSphereVertexData;\r\n\r\nMesh.CreateSphere = (name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh => {\r\n const options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable,\r\n };\r\n\r\n return CreateSphere(name, options, scene);\r\n};\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to desaturate a color
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryDesaturateBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryDesaturateBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the color operand input component
|
|
19
|
+
*/
|
|
20
|
+
get color(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the level operand input component
|
|
23
|
+
*/
|
|
24
|
+
get level(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeGeometryConnectionPoint;
|
|
29
|
+
protected _buildBlock(): this | undefined;
|
|
30
|
+
}
|