@babylonjs/core 7.20.0 → 7.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Bones/bone.js +3 -3
- package/Bones/bone.js.map +1 -1
- package/Bones/boneLookController.js +3 -3
- package/Bones/boneLookController.js.map +1 -1
- package/Compat/compatibilityOptions.d.ts +13 -6
- package/Compat/compatibilityOptions.js +20 -4
- package/Compat/compatibilityOptions.js.map +1 -1
- package/Compat/index.d.ts +1 -1
- package/Compat/index.js +1 -1
- package/Compat/index.js.map +1 -1
- package/Culling/boundingBox.js +5 -5
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/boundingInfo.js +2 -2
- package/Culling/boundingInfo.js.map +1 -1
- package/Culling/boundingSphere.js +2 -2
- package/Culling/boundingSphere.js.map +1 -1
- package/Culling/ray.js +2 -2
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +3 -0
- package/Debug/debugLayer.js +15 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +11 -2
- package/Engines/engine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/Layers/highlightLayer.js +0 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js +3 -3
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +2 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +3 -3
- package/Materials/Textures/texture.js.map +1 -1
- package/Maths/math.color.js +3 -3
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.js +13 -14
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.js +5 -5
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.js +4 -4
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +8 -8
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -3
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +3 -3
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.js +2 -2
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +2 -2
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.js +2 -2
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.js +5 -5
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.js +4 -4
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +3 -3
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.js +4 -4
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.js +2 -2
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +2 -2
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.js +2 -2
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.js +2 -2
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/geometry.js +7 -7
- package/Meshes/geometry.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +40 -42
- package/Misc/HighDynamicRange/hdr.js +209 -202
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/index.d.ts +1 -1
- package/Misc/HighDynamicRange/index.js +1 -1
- package/Misc/HighDynamicRange/index.js.map +1 -1
- package/Misc/arrayTools.d.ts +12 -17
- package/Misc/arrayTools.js +18 -23
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/dumpTools.d.ts +50 -47
- package/Misc/dumpTools.js +153 -143
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/equirectangularCapture.js +2 -2
- package/Misc/equirectangularCapture.js.map +1 -1
- package/Misc/index.d.ts +2 -1
- package/Misc/index.js +2 -1
- package/Misc/index.js.map +1 -1
- package/Misc/rgbdTextureTools.js +1 -0
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/screenshotTools.js +3 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +2 -2
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +2 -2
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +0 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +0 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +6 -0
- package/PostProcesses/postProcess.js +22 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/background.fragment.js +1 -1
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 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EAAE,GAAG,CAAC,CAAC;IAE5E,SAAS;IACT,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC;IAErB,IAAI,UAAU,EAAE;QACZ,MAAM,WAAW,GAAG,eAAe,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/F,UAAU,CAAC,MAAM,GAAG,WAAW,CAAC;KACnC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,cAAc,CAC1B,IAAY,EACZ,OAcC,EACD,QAAyB,IAAI;IAE7B,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAElC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACnF,GAAG,CAAC,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAE9D,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAErD,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,gEAAgE;IAChE,cAAc;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CreateTiledPlaneVertexData } from \"./tiledPlaneBuilder\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a tiled box\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\r\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\r\n * * pattern sets the rotation or reflection pattern for the tiles,\r\n * * size of the box\r\n * * width of the box, overwrites size\r\n * * height of the box, overwrites size\r\n * * depth of the box, overwrites size\r\n * * tileSize sets the size of a tile\r\n * * tileWidth sets the tile width and overwrites tileSize\r\n * * tileHeight sets the tile width and overwrites tileSize\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\r\n * * alignVertical places whole tiles aligned to the center, left or right of a column\r\n * @param options.pattern\r\n * @param options.size\r\n * @param options.width\r\n * @param options.height\r\n * @param options.depth\r\n * @param options.tileSize\r\n * @param options.tileWidth\r\n * @param options.tileHeight\r\n * @param options.faceUV\r\n * @param options.faceColors\r\n * @param options.alignHorizontal\r\n * @param options.alignVertical\r\n * @param options.sideOrientation\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the TiledBox\r\n */\r\nexport function CreateTiledBoxVertexData(options: {\r\n pattern?: number;\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n tileSize?: number;\r\n tileWidth?: number;\r\n tileHeight?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n alignHorizontal?: number;\r\n alignVertical?: number;\r\n sideOrientation?: number;\r\n}): VertexData {\r\n const nbFaces = 6;\r\n\r\n const faceUV: Vector4[] = options.faceUV || new Array<Vector4>(6);\r\n const faceColors = options.faceColors;\r\n\r\n const flipTile = options.pattern || Mesh.NO_FLIP;\r\n\r\n const width = options.width || options.size || 1;\r\n const height = options.height || options.size || 1;\r\n const depth = options.depth || options.size || 1;\r\n const tileWidth = options.tileWidth || options.tileSize || 1;\r\n const tileHeight = options.tileHeight || options.tileSize || 1;\r\n const alignH = options.alignHorizontal || 0;\r\n const alignV = options.alignVertical || 0;\r\n\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // default face colors and UV if undefined\r\n for (let f = 0; f < nbFaces; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n\r\n const halfWidth = width / 2;\r\n const halfHeight = height / 2;\r\n const halfDepth = depth / 2;\r\n\r\n const faceVertexData: Array<VertexData> = [];\r\n\r\n for (let f = 0; f < 2; f++) {\r\n //front and back\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n for (let f = 2; f < 4; f++) {\r\n //sides\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: depth,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n let baseAlignV = alignV;\r\n if (alignV === Mesh.BOTTOM) {\r\n baseAlignV = Mesh.TOP;\r\n } else if (alignV === Mesh.TOP) {\r\n baseAlignV = Mesh.BOTTOM;\r\n }\r\n\r\n for (let f = 4; f < 6; f++) {\r\n //top and bottom\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: depth,\r\n alignVertical: baseAlignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n let positions: Array<number> = [];\r\n let normals: Array<number> = [];\r\n let uvs: Array<number> = [];\r\n let indices: Array<number> = [];\r\n const colors: Array<number> = [];\r\n const facePositions: Array<Array<Vector3>> = [];\r\n const faceNormals: Array<Array<Vector3>> = [];\r\n\r\n const newFaceUV: Array<Array<number>> = [];\r\n let lu: number = 0;\r\n\r\n let li: number = 0;\r\n\r\n for (let f = 0; f < nbFaces; f++) {\r\n const len = faceVertexData[f].positions!.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (let p = 0; p < len / 3; p++) {\r\n facePositions[f].push(new Vector3(faceVertexData[f].positions![3 * p], faceVertexData[f].positions![3 * p + 1], faceVertexData[f].positions![3 * p + 2]));\r\n faceNormals[f].push(new Vector3(faceVertexData[f].normals![3 * p], faceVertexData[f].normals![3 * p + 1], faceVertexData[f].normals![3 * p + 2]));\r\n }\r\n // uvs\r\n lu = faceVertexData[f].uvs!.length;\r\n newFaceUV[f] = [];\r\n for (let i = 0; i < lu; i += 2) {\r\n newFaceUV[f][i] = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * faceVertexData[f].uvs![i];\r\n newFaceUV[f][i + 1] = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * faceVertexData[f].uvs![i + 1];\r\n\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n newFaceUV[f][i + 1] = 1.0 - newFaceUV[f][i + 1];\r\n }\r\n }\r\n uvs = uvs.concat(newFaceUV[f]);\r\n\r\n indices = indices.concat(<Array<number>>faceVertexData[f].indices!.map((x: number) => x + li));\r\n li += facePositions[f].length;\r\n if (faceColors) {\r\n for (let c = 0; c < 4; c++) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n }\r\n\r\n const vec0 = new Vector3(0, 0, halfDepth);\r\n const mtrx0 = Matrix.RotationY(Math.PI);\r\n positions = facePositions[0]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx0).add(vec0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []);\r\n normals = faceNormals[0]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []);\r\n positions = positions.concat(\r\n facePositions[1]\r\n .map((entry) => entry.subtract(vec0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(faceNormals[1].map((entry) => [entry.x, entry.y, entry.z]).reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []));\r\n\r\n const vec2 = new Vector3(halfWidth, 0, 0);\r\n const mtrx2 = Matrix.RotationY(-Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[2]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx2).add(vec2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[2]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n const mtrx3 = Matrix.RotationY(Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[3]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx3).subtract(vec2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[3]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx3))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n\r\n const vec4 = new Vector3(0, halfHeight, 0);\r\n const mtrx4 = Matrix.RotationX(Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[4]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx4).add(vec4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[4]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n const mtrx5 = Matrix.RotationX(-Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[5]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx5).subtract(vec4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[5]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx5))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\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 if (faceColors) {\r\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a tiled box mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\r\n * * pattern sets the rotation or reflection pattern for the tiles,\r\n * * size of the box\r\n * * width of the box, overwrites size\r\n * * height of the box, overwrites size\r\n * * depth of the box, overwrites size\r\n * * tileSize sets the size of a tile\r\n * * tileWidth sets the tile width and overwrites tileSize\r\n * * tileHeight sets the tile width and overwrites tileSize\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\r\n * * alignVertical places whole tiles aligned to the center, left or right of a column\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param options.pattern\r\n * @param options.width\r\n * @param options.height\r\n * @param options.depth\r\n * @param options.tileSize\r\n * @param options.tileWidth\r\n * @param options.tileHeight\r\n * @param options.alignHorizontal\r\n * @param options.alignVertical\r\n * @param options.faceUV\r\n * @param options.faceColors\r\n * @param options.sideOrientation\r\n * @param options.updatable\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\nexport function CreateTiledBox(\r\n name: string,\r\n options: {\r\n pattern?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n tileSize?: number;\r\n tileWidth?: number;\r\n tileHeight?: number;\r\n alignHorizontal?: number;\r\n alignVertical?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n sideOrientation?: number;\r\n updatable?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const box = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTiledBoxVertexData(options);\r\n\r\n vertexData.applyToMesh(box, options.updatable);\r\n\r\n return box;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTiledBox instead\r\n */\r\nexport const TiledBoxBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledBox,\r\n};\r\n\r\nVertexData.CreateTiledBox = CreateTiledBoxVertexData;\r\n"]}
|
|
1
|
+
{"version":3,"file":"tiledBoxBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/tiledBoxBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAcxC;IACG,MAAM,OAAO,GAAG,CAAC,CAAC;IAElB,MAAM,MAAM,GAAc,OAAO,CAAC,MAAM,IAAI,IAAI,KAAK,CAAU,CAAC,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAEtC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAEjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI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G;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,gEAAgE;IAChE,cAAc;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CreateTiledPlaneVertexData } from \"./tiledPlaneBuilder\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a tiled box\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\r\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\r\n * * pattern sets the rotation or reflection pattern for the tiles,\r\n * * size of the box\r\n * * width of the box, overwrites size\r\n * * height of the box, overwrites size\r\n * * depth of the box, overwrites size\r\n * * tileSize sets the size of a tile\r\n * * tileWidth sets the tile width and overwrites tileSize\r\n * * tileHeight sets the tile width and overwrites tileSize\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\r\n * * alignVertical places whole tiles aligned to the center, left or right of a column\r\n * @param options.pattern\r\n * @param options.size\r\n * @param options.width\r\n * @param options.height\r\n * @param options.depth\r\n * @param options.tileSize\r\n * @param options.tileWidth\r\n * @param options.tileHeight\r\n * @param options.faceUV\r\n * @param options.faceColors\r\n * @param options.alignHorizontal\r\n * @param options.alignVertical\r\n * @param options.sideOrientation\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the TiledBox\r\n */\r\nexport function CreateTiledBoxVertexData(options: {\r\n pattern?: number;\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n tileSize?: number;\r\n tileWidth?: number;\r\n tileHeight?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n alignHorizontal?: number;\r\n alignVertical?: number;\r\n sideOrientation?: number;\r\n}): VertexData {\r\n const nbFaces = 6;\r\n\r\n const faceUV: Vector4[] = options.faceUV || new Array<Vector4>(6);\r\n const faceColors = options.faceColors;\r\n\r\n const flipTile = options.pattern || Mesh.NO_FLIP;\r\n\r\n const width = options.width || options.size || 1;\r\n const height = options.height || options.size || 1;\r\n const depth = options.depth || options.size || 1;\r\n const tileWidth = options.tileWidth || options.tileSize || 1;\r\n const tileHeight = options.tileHeight || options.tileSize || 1;\r\n const alignH = options.alignHorizontal || 0;\r\n const alignV = options.alignVertical || 0;\r\n\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // default face colors and UV if undefined\r\n for (let f = 0; f < nbFaces; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n\r\n const halfWidth = width / 2;\r\n const halfHeight = height / 2;\r\n const halfDepth = depth / 2;\r\n\r\n const faceVertexData: Array<VertexData> = [];\r\n\r\n for (let f = 0; f < 2; f++) {\r\n //front and back\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n for (let f = 2; f < 4; f++) {\r\n //sides\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: depth,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n let baseAlignV = alignV;\r\n if (alignV === Mesh.BOTTOM) {\r\n baseAlignV = Mesh.TOP;\r\n } else if (alignV === Mesh.TOP) {\r\n baseAlignV = Mesh.BOTTOM;\r\n }\r\n\r\n for (let f = 4; f < 6; f++) {\r\n //top and bottom\r\n faceVertexData[f] = CreateTiledPlaneVertexData({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: depth,\r\n alignVertical: baseAlignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation,\r\n });\r\n }\r\n\r\n let positions: Array<number> = [];\r\n let normals: Array<number> = [];\r\n let uvs: Array<number> = [];\r\n let indices: Array<number> = [];\r\n const colors: Array<number> = [];\r\n const facePositions: Array<Array<Vector3>> = [];\r\n const faceNormals: Array<Array<Vector3>> = [];\r\n\r\n const newFaceUV: Array<Array<number>> = [];\r\n let lu: number = 0;\r\n\r\n let li: number = 0;\r\n\r\n for (let f = 0; f < nbFaces; f++) {\r\n const len = faceVertexData[f].positions!.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (let p = 0; p < len / 3; p++) {\r\n facePositions[f].push(new Vector3(faceVertexData[f].positions![3 * p], faceVertexData[f].positions![3 * p + 1], faceVertexData[f].positions![3 * p + 2]));\r\n faceNormals[f].push(new Vector3(faceVertexData[f].normals![3 * p], faceVertexData[f].normals![3 * p + 1], faceVertexData[f].normals![3 * p + 2]));\r\n }\r\n // uvs\r\n lu = faceVertexData[f].uvs!.length;\r\n newFaceUV[f] = [];\r\n for (let i = 0; i < lu; i += 2) {\r\n newFaceUV[f][i] = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * faceVertexData[f].uvs![i];\r\n newFaceUV[f][i + 1] = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * faceVertexData[f].uvs![i + 1];\r\n\r\n if (useOpenGLOrientationForUV) {\r\n newFaceUV[f][i + 1] = 1.0 - newFaceUV[f][i + 1];\r\n }\r\n }\r\n uvs = uvs.concat(newFaceUV[f]);\r\n\r\n indices = indices.concat(<Array<number>>faceVertexData[f].indices!.map((x: number) => x + li));\r\n li += facePositions[f].length;\r\n if (faceColors) {\r\n for (let c = 0; c < 4; c++) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n }\r\n\r\n const vec0 = new Vector3(0, 0, halfDepth);\r\n const mtrx0 = Matrix.RotationY(Math.PI);\r\n positions = facePositions[0]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx0).add(vec0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []);\r\n normals = faceNormals[0]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []);\r\n positions = positions.concat(\r\n facePositions[1]\r\n .map((entry) => entry.subtract(vec0))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(faceNormals[1].map((entry) => [entry.x, entry.y, entry.z]).reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), []));\r\n\r\n const vec2 = new Vector3(halfWidth, 0, 0);\r\n const mtrx2 = Matrix.RotationY(-Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[2]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx2).add(vec2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[2]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n const mtrx3 = Matrix.RotationY(Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[3]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx3).subtract(vec2))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[3]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx3))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n\r\n const vec4 = new Vector3(0, halfHeight, 0);\r\n const mtrx4 = Matrix.RotationX(Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[4]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx4).add(vec4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[4]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n const mtrx5 = Matrix.RotationX(-Math.PI / 2);\r\n positions = positions.concat(\r\n facePositions[5]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx5).subtract(vec4))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n normals = normals.concat(\r\n faceNormals[5]\r\n .map((entry) => Vector3.TransformNormal(entry, mtrx5))\r\n .map((entry) => [entry.x, entry.y, entry.z])\r\n .reduce((accumulator: Array<number>, currentValue) => accumulator.concat(currentValue), [])\r\n );\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\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 if (faceColors) {\r\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a tiled box mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\r\n * * pattern sets the rotation or reflection pattern for the tiles,\r\n * * size of the box\r\n * * width of the box, overwrites size\r\n * * height of the box, overwrites size\r\n * * depth of the box, overwrites size\r\n * * tileSize sets the size of a tile\r\n * * tileWidth sets the tile width and overwrites tileSize\r\n * * tileHeight sets the tile width and overwrites tileSize\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\r\n * * alignVertical places whole tiles aligned to the center, left or right of a column\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param options.pattern\r\n * @param options.width\r\n * @param options.height\r\n * @param options.depth\r\n * @param options.tileSize\r\n * @param options.tileWidth\r\n * @param options.tileHeight\r\n * @param options.alignHorizontal\r\n * @param options.alignVertical\r\n * @param options.faceUV\r\n * @param options.faceColors\r\n * @param options.sideOrientation\r\n * @param options.updatable\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\nexport function CreateTiledBox(\r\n name: string,\r\n options: {\r\n pattern?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n tileSize?: number;\r\n tileWidth?: number;\r\n tileHeight?: number;\r\n alignHorizontal?: number;\r\n alignVertical?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n sideOrientation?: number;\r\n updatable?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const box = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTiledBoxVertexData(options);\r\n\r\n vertexData.applyToMesh(box, options.updatable);\r\n\r\n return box;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTiledBox instead\r\n */\r\nexport const TiledBoxBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledBox,\r\n};\r\n\r\nVertexData.CreateTiledBox = CreateTiledBoxVertexData;\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Matrix, Vector3, Vector2 } from "../../Maths/math.vector.js";
|
|
2
2
|
import { Mesh } from "../mesh.js";
|
|
3
3
|
import { VertexData } from "../mesh.vertexData.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates the VertexData for a torus
|
|
7
7
|
* @param options an object used to set the following optional parameters for the box, required but can be empty
|
|
@@ -46,7 +46,7 @@ export function CreateTorusVertexData(options) {
|
|
|
46
46
|
normal = Vector3.TransformNormal(normal, transform);
|
|
47
47
|
positions.push(position.x, position.y, position.z);
|
|
48
48
|
normals.push(normal.x, normal.y, normal.z);
|
|
49
|
-
uvs.push(textureCoordinate.x,
|
|
49
|
+
uvs.push(textureCoordinate.x, useOpenGLOrientationForUV ? 1.0 - textureCoordinate.y : textureCoordinate.y);
|
|
50
50
|
// And create indices for two triangles.
|
|
51
51
|
const nextI = (i + 1) % stride;
|
|
52
52
|
const nextJ = (j + 1) % stride;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"torusBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/torusBuilder.ts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K,CAAC,CAAC;IAEpC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACnF,KAAK,CAAC,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAEhE,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAElD,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAEjD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,gEAAgE;IAChE,WAAW;CACd,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAE/C,IAAI,CAAC,WAAW,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,SAAiB,EAAE,YAAoB,EAAE,KAAa,EAAE,SAAmB,EAAE,eAAwB,EAAQ,EAAE;IAC/J,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,SAAS;QACT,YAAY;QACZ,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\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.diameter\r\n * @param options.thickness\r\n * @param options.tessellation\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @returns the VertexData of the torus\r\n */\r\nexport function CreateTorusVertexData(options: { diameter?: number; thickness?: number; tessellation?: number; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 }) {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n const diameter = options.diameter || 1;\r\n const thickness = options.thickness || 0.5;\r\n const tessellation = (options.tessellation || 16) | 0;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const stride = tessellation + 1;\r\n\r\n for (let i = 0; i <= tessellation; i++) {\r\n const u = i / tessellation;\r\n\r\n const outerAngle = (i * Math.PI * 2.0) / tessellation - Math.PI / 2.0;\r\n\r\n const transform = Matrix.Translation(diameter / 2.0, 0, 0).multiply(Matrix.RotationY(outerAngle));\r\n\r\n for (let j = 0; j <= tessellation; j++) {\r\n const v = 1 - j / tessellation;\r\n\r\n const innerAngle = (j * Math.PI * 2.0) / tessellation + Math.PI;\r\n const dx = Math.cos(innerAngle);\r\n const dy = Math.sin(innerAngle);\r\n\r\n // Create a vertex.\r\n let normal = new Vector3(dx, dy, 0);\r\n let position = normal.scale(thickness / 2);\r\n const textureCoordinate = new Vector2(u, v);\r\n\r\n position = Vector3.TransformCoordinates(position, transform);\r\n normal = Vector3.TransformNormal(normal, transform);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - textureCoordinate.y : textureCoordinate.y);\r\n\r\n // And create indices for two triangles.\r\n const nextI = (i + 1) % stride;\r\n const nextJ = (j + 1) % stride;\r\n\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\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 torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (positive integer, default 16)\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.diameter\r\n * @param options.thickness\r\n * @param options.tessellation\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus\r\n */\r\nexport function CreateTorus(\r\n name: string,\r\n options: { diameter?: number; thickness?: number; tessellation?: number; updatable?: boolean; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 } = {},\r\n scene?: Scene\r\n): Mesh {\r\n const torus = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTorusVertexData(options);\r\n\r\n vertexData.applyToMesh(torus, options.updatable);\r\n\r\n return torus;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTorus instead\r\n */\r\nexport const TorusBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTorus,\r\n};\r\n\r\nVertexData.CreateTorus = CreateTorusVertexData;\r\n\r\nMesh.CreateTorus = (name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh => {\r\n const options = {\r\n diameter,\r\n thickness,\r\n tessellation,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateTorus(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"torusBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/torusBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA0I;IAC5K,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,EAAE,CAAC;IAEf,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CA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AAE,YAAoB,EAAE,KAAa,EAAE,SAAmB,EAAE,eAAwB,EAAQ,EAAE;IAC/J,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,SAAS;QACT,YAAY;QACZ,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\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.diameter\r\n * @param options.thickness\r\n * @param options.tessellation\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @returns the VertexData of the torus\r\n */\r\nexport function CreateTorusVertexData(options: { diameter?: number; thickness?: number; tessellation?: number; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 }) {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n const diameter = options.diameter || 1;\r\n const thickness = options.thickness || 0.5;\r\n const tessellation = (options.tessellation || 16) | 0;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const stride = tessellation + 1;\r\n\r\n for (let i = 0; i <= tessellation; i++) {\r\n const u = i / tessellation;\r\n\r\n const outerAngle = (i * Math.PI * 2.0) / tessellation - Math.PI / 2.0;\r\n\r\n const transform = Matrix.Translation(diameter / 2.0, 0, 0).multiply(Matrix.RotationY(outerAngle));\r\n\r\n for (let j = 0; j <= tessellation; j++) {\r\n const v = 1 - j / tessellation;\r\n\r\n const innerAngle = (j * Math.PI * 2.0) / tessellation + Math.PI;\r\n const dx = Math.cos(innerAngle);\r\n const dy = Math.sin(innerAngle);\r\n\r\n // Create a vertex.\r\n let normal = new Vector3(dx, dy, 0);\r\n let position = normal.scale(thickness / 2);\r\n const textureCoordinate = new Vector2(u, v);\r\n\r\n position = Vector3.TransformCoordinates(position, transform);\r\n normal = Vector3.TransformNormal(normal, transform);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, useOpenGLOrientationForUV ? 1.0 - textureCoordinate.y : textureCoordinate.y);\r\n\r\n // And create indices for two triangles.\r\n const nextI = (i + 1) % stride;\r\n const nextJ = (j + 1) % stride;\r\n\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\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 torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (positive integer, default 16)\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.diameter\r\n * @param options.thickness\r\n * @param options.tessellation\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus\r\n */\r\nexport function CreateTorus(\r\n name: string,\r\n options: { diameter?: number; thickness?: number; tessellation?: number; updatable?: boolean; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 } = {},\r\n scene?: Scene\r\n): Mesh {\r\n const torus = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTorusVertexData(options);\r\n\r\n vertexData.applyToMesh(torus, options.updatable);\r\n\r\n return torus;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTorus instead\r\n */\r\nexport const TorusBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTorus,\r\n};\r\n\r\nVertexData.CreateTorus = CreateTorusVertexData;\r\n\r\nMesh.CreateTorus = (name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh => {\r\n const options = {\r\n diameter,\r\n thickness,\r\n tessellation,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateTorus(name, options, scene);\r\n};\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vector3 } from "../../Maths/math.vector.js";
|
|
2
2
|
import { Mesh } from "../mesh.js";
|
|
3
3
|
import { VertexData } from "../mesh.vertexData.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js";
|
|
5
5
|
// based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473
|
|
6
6
|
/**
|
|
7
7
|
* Creates the VertexData for a TorusKnot
|
|
@@ -72,7 +72,7 @@ export function CreateTorusKnotVertexData(options) {
|
|
|
72
72
|
positions.push(p1.y + cx * n.y + cy * bitan.y);
|
|
73
73
|
positions.push(p1.z + cx * n.z + cy * bitan.z);
|
|
74
74
|
uvs.push(i / radialSegments);
|
|
75
|
-
uvs.push(
|
|
75
|
+
uvs.push(useOpenGLOrientationForUV ? 1.0 - j / tubularSegments : j / tubularSegments);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
for (i = 0; i < radialSegments; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"torusKnotBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/torusKnotBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,kIAAkI;AAClI;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAUzC;IACG,MAAM,OAAO,GAAa,EAAE,CAAC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;AACD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,gEAAgE;IAChE,eAAe;CAClB,CAAC;AAEF,UAAU,CAAC,eAAe,GAAG,yBAAyB,CAAC;AAEvD,IAAI,CAAC,eAAe,GAAG,CACnB,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,cAAsB,EACtB,eAAuB,EACvB,CAAS,EACT,CAAS,EACT,KAAa,EACb,SAAmB,EACnB,eAAwB,EACpB,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,MAAM;QACN,IAAI;QACJ,cAAc;QACd,eAAe;QACf,CAAC;QACD,CAAC;QACD,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n// based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n/**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\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.radius\r\n * @param options.tube\r\n * @param options.radialSegments\r\n * @param options.tubularSegments\r\n * @param options.p\r\n * @param options.q\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @returns the VertexData of the Torus Knot\r\n */\r\nexport function CreateTorusKnotVertexData(options: {\r\n radius?: number;\r\n tube?: number;\r\n radialSegments?: number;\r\n tubularSegments?: number;\r\n p?: number;\r\n q?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n}): VertexData {\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n\r\n const radius = options.radius || 2;\r\n const tube = options.tube || 0.5;\r\n const radialSegments = options.radialSegments || 32;\r\n const tubularSegments = options.tubularSegments || 32;\r\n const p = options.p || 2;\r\n const q = options.q || 3;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // Helper\r\n const getPos = (angle: number) => {\r\n const cu = Math.cos(angle);\r\n const su = Math.sin(angle);\r\n const quOverP = (q / p) * angle;\r\n const cs = Math.cos(quOverP);\r\n\r\n const tx = radius * (2 + cs) * 0.5 * cu;\r\n const ty = radius * (2 + cs) * su * 0.5;\r\n const tz = radius * Math.sin(quOverP) * 0.5;\r\n\r\n return new Vector3(tx, ty, tz);\r\n };\r\n\r\n // Vertices\r\n let i: number;\r\n let j: number;\r\n for (i = 0; i <= radialSegments; i++) {\r\n const modI = i % radialSegments;\r\n const u = (modI / radialSegments) * 2 * p * Math.PI;\r\n const p1 = getPos(u);\r\n const p2 = getPos(u + 0.01);\r\n const tang = p2.subtract(p1);\r\n let n = p2.add(p1);\r\n\r\n const bitan = Vector3.Cross(tang, n);\r\n n = Vector3.Cross(bitan, tang);\r\n\r\n bitan.normalize();\r\n n.normalize();\r\n\r\n for (j = 0; j < tubularSegments; j++) {\r\n const modJ = j % tubularSegments;\r\n const v = (modJ / tubularSegments) * 2 * Math.PI;\r\n const cx = -tube * Math.cos(v);\r\n const cy = tube * Math.sin(v);\r\n\r\n positions.push(p1.x + cx * n.x + cy * bitan.x);\r\n positions.push(p1.y + cx * n.y + cy * bitan.y);\r\n positions.push(p1.z + cx * n.z + cy * bitan.z);\r\n\r\n uvs.push(i / radialSegments);\r\n uvs.push(CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - j / tubularSegments : j / tubularSegments);\r\n }\r\n }\r\n\r\n for (i = 0; i < radialSegments; i++) {\r\n for (j = 0; j < tubularSegments; j++) {\r\n const jNext = (j + 1) % tubularSegments;\r\n const a = i * tubularSegments + j;\r\n const b = (i + 1) * tubularSegments + j;\r\n const c = (i + 1) * tubularSegments + jNext;\r\n const d = i * tubularSegments + jNext;\r\n\r\n indices.push(d);\r\n indices.push(b);\r\n indices.push(a);\r\n indices.push(d);\r\n indices.push(c);\r\n indices.push(b);\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\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 torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\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.radius\r\n * @param options.tube\r\n * @param options.radialSegments\r\n * @param options.tubularSegments\r\n * @param options.p\r\n * @param options.q\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus-knot\r\n */\r\nexport function CreateTorusKnot(\r\n name: string,\r\n options: {\r\n radius?: number;\r\n tube?: number;\r\n radialSegments?: number;\r\n tubularSegments?: number;\r\n p?: number;\r\n q?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n } = {},\r\n scene?: Scene\r\n): Mesh {\r\n const torusKnot = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torusKnot._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTorusKnotVertexData(options);\r\n\r\n vertexData.applyToMesh(torusKnot, options.updatable);\r\n\r\n return torusKnot;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTorusKnot instead\r\n */\r\nexport const TorusKnotBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTorusKnot,\r\n};\r\n\r\nVertexData.CreateTorusKnot = CreateTorusKnotVertexData;\r\n\r\nMesh.CreateTorusKnot = (\r\n name: string,\r\n radius: number,\r\n tube: number,\r\n radialSegments: number,\r\n tubularSegments: number,\r\n p: number,\r\n q: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number\r\n): Mesh => {\r\n const options = {\r\n radius,\r\n tube,\r\n radialSegments,\r\n tubularSegments,\r\n p,\r\n q,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateTorusKnot(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"torusKnotBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/torusKnotBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,kIAAkI;AAClI;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAUzC;IACG,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC;IACjC,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IACpD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IACtD,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,IAAI,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,SAAS,CAAC;IACjC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC;IAErB,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,eAAe,CAC3B,IAAY,EACZ,UAWI,EAAE,EACN,KAAa;IAEb,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAExC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACnF,SAAS,CAAC,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAEpE,MAAM,UAAU,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAEtD,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAErD,OAAO,SAAS,CAAC;AACrB,CAAC;AACD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,gEAAgE;IAChE,eAAe;CAClB,CAAC;AAEF,UAAU,CAAC,eAAe,GAAG,yBAAyB,CAAC;AAEvD,IAAI,CAAC,eAAe,GAAG,CACnB,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,cAAsB,EACtB,eAAuB,EACvB,CAAS,EACT,CAAS,EACT,KAAa,EACb,SAAmB,EACnB,eAAwB,EACpB,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,MAAM;QACN,IAAI;QACJ,cAAc;QACd,eAAe;QACf,CAAC;QACD,CAAC;QACD,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n// based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n/**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\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.radius\r\n * @param options.tube\r\n * @param options.radialSegments\r\n * @param options.tubularSegments\r\n * @param options.p\r\n * @param options.q\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @returns the VertexData of the Torus Knot\r\n */\r\nexport function CreateTorusKnotVertexData(options: {\r\n radius?: number;\r\n tube?: number;\r\n radialSegments?: number;\r\n tubularSegments?: number;\r\n p?: number;\r\n q?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n}): VertexData {\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n\r\n const radius = options.radius || 2;\r\n const tube = options.tube || 0.5;\r\n const radialSegments = options.radialSegments || 32;\r\n const tubularSegments = options.tubularSegments || 32;\r\n const p = options.p || 2;\r\n const q = options.q || 3;\r\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // Helper\r\n const getPos = (angle: number) => {\r\n const cu = Math.cos(angle);\r\n const su = Math.sin(angle);\r\n const quOverP = (q / p) * angle;\r\n const cs = Math.cos(quOverP);\r\n\r\n const tx = radius * (2 + cs) * 0.5 * cu;\r\n const ty = radius * (2 + cs) * su * 0.5;\r\n const tz = radius * Math.sin(quOverP) * 0.5;\r\n\r\n return new Vector3(tx, ty, tz);\r\n };\r\n\r\n // Vertices\r\n let i: number;\r\n let j: number;\r\n for (i = 0; i <= radialSegments; i++) {\r\n const modI = i % radialSegments;\r\n const u = (modI / radialSegments) * 2 * p * Math.PI;\r\n const p1 = getPos(u);\r\n const p2 = getPos(u + 0.01);\r\n const tang = p2.subtract(p1);\r\n let n = p2.add(p1);\r\n\r\n const bitan = Vector3.Cross(tang, n);\r\n n = Vector3.Cross(bitan, tang);\r\n\r\n bitan.normalize();\r\n n.normalize();\r\n\r\n for (j = 0; j < tubularSegments; j++) {\r\n const modJ = j % tubularSegments;\r\n const v = (modJ / tubularSegments) * 2 * Math.PI;\r\n const cx = -tube * Math.cos(v);\r\n const cy = tube * Math.sin(v);\r\n\r\n positions.push(p1.x + cx * n.x + cy * bitan.x);\r\n positions.push(p1.y + cx * n.y + cy * bitan.y);\r\n positions.push(p1.z + cx * n.z + cy * bitan.z);\r\n\r\n uvs.push(i / radialSegments);\r\n uvs.push(useOpenGLOrientationForUV ? 1.0 - j / tubularSegments : j / tubularSegments);\r\n }\r\n }\r\n\r\n for (i = 0; i < radialSegments; i++) {\r\n for (j = 0; j < tubularSegments; j++) {\r\n const jNext = (j + 1) % tubularSegments;\r\n const a = i * tubularSegments + j;\r\n const b = (i + 1) * tubularSegments + j;\r\n const c = (i + 1) * tubularSegments + jNext;\r\n const d = i * tubularSegments + jNext;\r\n\r\n indices.push(d);\r\n indices.push(b);\r\n indices.push(a);\r\n indices.push(d);\r\n indices.push(c);\r\n indices.push(b);\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\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 torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\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.radius\r\n * @param options.tube\r\n * @param options.radialSegments\r\n * @param options.tubularSegments\r\n * @param options.p\r\n * @param options.q\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus-knot\r\n */\r\nexport function CreateTorusKnot(\r\n name: string,\r\n options: {\r\n radius?: number;\r\n tube?: number;\r\n radialSegments?: number;\r\n tubularSegments?: number;\r\n p?: number;\r\n q?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n } = {},\r\n scene?: Scene\r\n): Mesh {\r\n const torusKnot = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torusKnot._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateTorusKnotVertexData(options);\r\n\r\n vertexData.applyToMesh(torusKnot, options.updatable);\r\n\r\n return torusKnot;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTorusKnot instead\r\n */\r\nexport const TorusKnotBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTorusKnot,\r\n};\r\n\r\nVertexData.CreateTorusKnot = CreateTorusKnotVertexData;\r\n\r\nMesh.CreateTorusKnot = (\r\n name: string,\r\n radius: number,\r\n tube: number,\r\n radialSegments: number,\r\n tubularSegments: number,\r\n p: number,\r\n q: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number\r\n): Mesh => {\r\n const options = {\r\n radius,\r\n tube,\r\n radialSegments,\r\n tubularSegments,\r\n p,\r\n q,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateTorusKnot(name, options, scene);\r\n};\r\n"]}
|
package/Meshes/geometry.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Tools } from "../Misc/tools.js";
|
|
|
10
10
|
import { Tags } from "../Misc/tags.js";
|
|
11
11
|
import { extractMinAndMax } from "../Maths/math.functions.js";
|
|
12
12
|
import { EngineStore } from "../Engines/engineStore.js";
|
|
13
|
-
import {
|
|
13
|
+
import { useOpenGLOrientationForUV } from "../Compat/compatibilityOptions.js";
|
|
14
14
|
import { CopyFloatData } from "../Buffers/bufferUtils.js";
|
|
15
15
|
/**
|
|
16
16
|
* Class used to store geometry data (vertex buffers + index buffer)
|
|
@@ -1028,7 +1028,7 @@ export class Geometry {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {
|
|
1030
1030
|
const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);
|
|
1031
|
-
if (
|
|
1031
|
+
if (useOpenGLOrientationForUV) {
|
|
1032
1032
|
for (let index = 1; index < uvsData.length; index += 2) {
|
|
1033
1033
|
uvsData[index] = 1 - uvsData[index];
|
|
1034
1034
|
}
|
|
@@ -1037,7 +1037,7 @@ export class Geometry {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {
|
|
1039
1039
|
const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);
|
|
1040
|
-
if (
|
|
1040
|
+
if (useOpenGLOrientationForUV) {
|
|
1041
1041
|
for (let index = 1; index < uvs2Data.length; index += 2) {
|
|
1042
1042
|
uvs2Data[index] = 1 - uvs2Data[index];
|
|
1043
1043
|
}
|
|
@@ -1046,7 +1046,7 @@ export class Geometry {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {
|
|
1048
1048
|
const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);
|
|
1049
|
-
if (
|
|
1049
|
+
if (useOpenGLOrientationForUV) {
|
|
1050
1050
|
for (let index = 1; index < uvs3Data.length; index += 2) {
|
|
1051
1051
|
uvs3Data[index] = 1 - uvs3Data[index];
|
|
1052
1052
|
}
|
|
@@ -1055,7 +1055,7 @@ export class Geometry {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {
|
|
1057
1057
|
const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);
|
|
1058
|
-
if (
|
|
1058
|
+
if (useOpenGLOrientationForUV) {
|
|
1059
1059
|
for (let index = 1; index < uvs4Data.length; index += 2) {
|
|
1060
1060
|
uvs4Data[index] = 1 - uvs4Data[index];
|
|
1061
1061
|
}
|
|
@@ -1064,7 +1064,7 @@ export class Geometry {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {
|
|
1066
1066
|
const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);
|
|
1067
|
-
if (
|
|
1067
|
+
if (useOpenGLOrientationForUV) {
|
|
1068
1068
|
for (let index = 1; index < uvs5Data.length; index += 2) {
|
|
1069
1069
|
uvs5Data[index] = 1 - uvs5Data[index];
|
|
1070
1070
|
}
|
|
@@ -1073,7 +1073,7 @@ export class Geometry {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {
|
|
1075
1075
|
const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);
|
|
1076
|
-
if (
|
|
1076
|
+
if (useOpenGLOrientationForUV) {
|
|
1077
1077
|
for (let index = 1; index < uvs6Data.length; index += 2) {
|
|
1078
1078
|
uvs6Data[index] = 1 - uvs6Data[index];
|
|
1079
1079
|
}
|