@babylonjs/core 8.50.3 → 8.50.5
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/Cameras/geospatialCamera.js +1 -1
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.js +0 -3
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
- package/Meshes/Builders/cylinderBuilder.js +1 -2
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +2 -0
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +0 -1
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +50 -54
- package/Meshes/Builders/groundBuilder.js +50 -54
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +0 -26
- package/Meshes/Builders/tiledBoxBuilder.js +0 -26
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.d.ts +0 -25
- package/Meshes/Builders/tiledPlaneBuilder.js +0 -25
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.d.ts +0 -13
- package/Meshes/Builders/torusBuilder.js +0 -13
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.d.ts +0 -19
- package/Meshes/Builders/torusKnotBuilder.js +0 -19
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/Builders/tubeBuilder.d.ts +0 -12
- package/Meshes/Builders/tubeBuilder.js +0 -12
- package/Meshes/Builders/tubeBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.types.d.ts +11 -0
- package/Meshes/Compression/dracoDecoder.types.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +0 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +0 -8
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/scalingBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Matrices/scalingBlock.js +1 -0
- package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/translationBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Matrices/translationBlock.js +1 -0
- package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +2 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.d.ts +3 -0
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +3 -0
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -0
- package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.d.ts +3 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mathBlock.js +1 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -0
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/randomBlock.js +2 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/Blocks/subdivideBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/subdivideBlock.js +1 -0
- package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +3 -0
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +0 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +0 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +0 -1
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/WebGL/webGLDataBuffer.d.ts +2 -0
- package/Meshes/WebGL/webGLDataBuffer.js +2 -0
- package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
- package/Meshes/WebGPU/webgpuDataBuffer.d.ts +4 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js +4 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -0
- package/Meshes/abstractMesh.decalMap.d.ts +1 -0
- package/Meshes/abstractMesh.decalMap.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -6
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +0 -6
- package/Meshes/csg.js.map +1 -1
- package/Meshes/csg2.js +1 -2
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geodesicMesh.d.ts +26 -0
- package/Meshes/geodesicMesh.js +18 -3
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/groundMesh.d.ts +1 -0
- package/Meshes/groundMesh.js +1 -0
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/index.js +0 -2
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +18 -3
- package/Meshes/instancedMesh.js +10 -3
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +286 -204
- package/Meshes/mesh.js +251 -197
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +15 -19
- package/Meshes/mesh.vertexData.js +15 -19
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +0 -1
- package/Meshes/meshSimplification.js +6 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.d.ts +2 -0
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/meshUVSpaceRenderer.d.ts +1 -0
- package/Meshes/meshUVSpaceRenderer.js.map +1 -1
- package/Meshes/polygonMesh.js +4 -0
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.project.d.ts +1 -0
- package/Meshes/subMesh.project.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +5 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +1 -1
- package/Meshes/transformNode.js +1 -1
- package/Meshes/transformNode.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js"
|
|
|
8
8
|
* @returns the capsule VertexData
|
|
9
9
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/capsule
|
|
10
10
|
*/
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
11
|
export function CreateCapsuleVertexData(options = {
|
|
13
12
|
subdivisions: 2,
|
|
14
13
|
tessellation: 16,
|
|
@@ -191,7 +190,6 @@ export function CreateCapsuleVertexData(options = {
|
|
|
191
190
|
* @param scene The scene the mesh is scoped to.
|
|
192
191
|
* @returns Capsule Mesh
|
|
193
192
|
*/
|
|
194
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
195
193
|
export function CreateCapsule(name, options = {
|
|
196
194
|
orientation: Vector3.Up(),
|
|
197
195
|
subdivisions: 2,
|
|
@@ -210,7 +208,6 @@ export function CreateCapsule(name, options = {
|
|
|
210
208
|
* Class containing static functions to help procedurally build meshes
|
|
211
209
|
* @deprecated please use CreateCapsule directly
|
|
212
210
|
*/
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
214
211
|
export const CapsuleBuilder = {
|
|
215
212
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
216
213
|
CreateCapsule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capsuleBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/capsuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E;;;;;GAKG;AACH,gEAAgE;AAChE,MAAM,UAAU,uBAAuB,CACnC,UAAiC;IAC7B,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,CAAC;CACrB;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACtF,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,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GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACpD,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,gEAAgE;IAChE,aAAa;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,IAAI,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,OAA8B,EAAE,KAAuB,EAAQ,EAAE;IACjG,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,UAAU,CAAC,aAAa,GAAG,uBAAuB,CAAC","sourcesContent":["import { VertexData } from \"../mesh.vertexData\";\r\nimport { Vector2, Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n/**\r\n * Scripts based off of https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\r\n * @param options the constructors options used to shape the mesh.\r\n * @returns the capsule VertexData\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/capsule\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function CreateCapsuleVertexData(\r\n options: ICreateCapsuleOptions = {\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6,\r\n }\r\n): VertexData {\r\n const subdivisions = Math.max(options.subdivisions ? options.subdivisions : 2, 1) | 0;\r\n const tessellation = Math.max(options.tessellation ? options.tessellation : 16, 3) | 0;\r\n const height = Math.max(options.height ? options.height : 1, 0);\r\n const radius = Math.max(options.radius ? options.radius : 0.25, 0);\r\n const capDetail = Math.max(options.capSubdivisions ? options.capSubdivisions : 6, 1) | 0;\r\n\r\n const radialSegments = tessellation;\r\n const heightSegments = subdivisions;\r\n\r\n const radiusTop = Math.max(options.radiusTop ? options.radiusTop : radius, 0);\r\n const radiusBottom = Math.max(options.radiusBottom ? options.radiusBottom : radius, 0);\r\n\r\n const heightMinusCaps = height - (radiusTop + radiusBottom);\r\n\r\n const thetaStart = 0.0;\r\n const thetaLength = 2.0 * Math.PI;\r\n\r\n const capsTopSegments = Math.max(options.topCapSubdivisions ? options.topCapSubdivisions : capDetail, 1);\r\n const capsBottomSegments = Math.max(options.bottomCapSubdivisions ? options.bottomCapSubdivisions : capDetail, 1);\r\n\r\n const alpha = Math.acos((radiusBottom - radiusTop) / height);\r\n\r\n let indices = [];\r\n const vertices = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n let index = 0;\r\n const indexArray = [],\r\n halfHeight = heightMinusCaps * 0.5;\r\n const pi2 = Math.PI * 0.5;\r\n\r\n let x, y;\r\n const normal = Vector3.Zero();\r\n const vertex = Vector3.Zero();\r\n\r\n const cosAlpha = Math.cos(alpha);\r\n const sinAlpha = Math.sin(alpha);\r\n\r\n const coneLength = new Vector2(radiusTop * sinAlpha, halfHeight + radiusTop * cosAlpha)\r\n .subtract(new Vector2(radiusBottom * sinAlpha, -halfHeight + radiusBottom * cosAlpha))\r\n .length();\r\n\r\n // Total length for v texture coord\r\n const vl = radiusTop * alpha + coneLength + radiusBottom * (pi2 - alpha);\r\n\r\n let v = 0;\r\n for (y = 0; y <= capsTopSegments; y++) {\r\n const indexRow = [];\r\n\r\n const a = pi2 - alpha * (y / capsTopSegments);\r\n\r\n v += (radiusTop * alpha) / capsTopSegments;\r\n\r\n const cosA = Math.cos(a);\r\n const sinA = Math.sin(a);\r\n\r\n // calculate the radius of the current row\r\n const _radius = cosA * radiusTop;\r\n\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = halfHeight + sinA * radiusTop;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n\r\n const coneHeight = height - radiusTop - radiusBottom + cosAlpha * radiusTop - cosAlpha * radiusBottom;\r\n const slope = (sinAlpha * (radiusBottom - radiusTop)) / coneHeight;\r\n\r\n for (y = 1; y <= heightSegments; y++) {\r\n const indexRow = [];\r\n v += coneLength / heightSegments;\r\n // calculate the radius of the current row\r\n const _radius = sinAlpha * ((y * (radiusBottom - radiusTop)) / heightSegments + radiusTop);\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = halfHeight + cosAlpha * radiusTop - (y * coneHeight) / heightSegments;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(sinTheta, slope, cosTheta).normalize();\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n\r\n for (y = 1; y <= capsBottomSegments; y++) {\r\n const indexRow = [];\r\n const a = pi2 - alpha - (Math.PI - alpha) * (y / capsBottomSegments);\r\n v += (radiusBottom * alpha) / capsBottomSegments;\r\n const cosA = Math.cos(a);\r\n const sinA = Math.sin(a);\r\n // calculate the radius of the current row\r\n const _radius = cosA * radiusBottom;\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = -halfHeight + sinA * radiusBottom;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n // generate indices\r\n for (x = 0; x < radialSegments; x++) {\r\n for (y = 0; y < capsTopSegments + heightSegments + capsBottomSegments; y++) {\r\n // we use the index array to access the correct indices\r\n const i1 = indexArray[y][x];\r\n const i2 = indexArray[y + 1][x];\r\n const i3 = indexArray[y + 1][x + 1];\r\n const i4 = indexArray[y][x + 1];\r\n // face one\r\n indices.push(i1);\r\n indices.push(i2);\r\n indices.push(i4);\r\n // face two\r\n indices.push(i2);\r\n indices.push(i3);\r\n indices.push(i4);\r\n }\r\n }\r\n\r\n indices = indices.reverse();\r\n\r\n if (options.orientation && !options.orientation.equals(Vector3.Up())) {\r\n const m = new Matrix();\r\n options.orientation\r\n .clone()\r\n .scale(Math.PI * 0.5)\r\n .cross(Vector3.Up())\r\n .toQuaternion()\r\n .toRotationMatrix(m);\r\n const v = Vector3.Zero();\r\n for (let i = 0; i < vertices.length; i += 3) {\r\n v.set(vertices[i], vertices[i + 1], vertices[i + 2]);\r\n Vector3.TransformCoordinatesToRef(v.clone(), m, v);\r\n vertices[i] = v.x;\r\n vertices[i + 1] = v.y;\r\n vertices[i + 2] = v.z;\r\n }\r\n }\r\n\r\n const vDat = new VertexData();\r\n vDat.positions = vertices;\r\n vDat.normals = normals;\r\n vDat.uvs = uvs;\r\n vDat.indices = indices;\r\n\r\n return vDat;\r\n}\r\n\r\n/**\r\n * The options Interface for creating a Capsule Mesh\r\n */\r\nexport interface ICreateCapsuleOptions {\r\n /** The Orientation of the capsule. Default : Vector3.Up() */\r\n orientation?: Vector3;\r\n\r\n /** Number of sub segments on the tube section of the capsule running parallel to orientation. */\r\n subdivisions?: number;\r\n\r\n /** Number of cylindrical segments on the capsule. */\r\n tessellation?: number;\r\n\r\n /** Height or Length of the capsule. */\r\n height?: number;\r\n\r\n /** Radius of the capsule. */\r\n radius?: number;\r\n\r\n /** Number of sub segments on the cap sections of the capsule running parallel to orientation. */\r\n capSubdivisions?: number;\r\n\r\n /** Overwrite for the top radius. */\r\n radiusTop?: number;\r\n\r\n /** Overwrite for the bottom radius. */\r\n radiusBottom?: number;\r\n\r\n /** Overwrite for the top capSubdivisions. */\r\n topCapSubdivisions?: number;\r\n\r\n /** Overwrite for the bottom capSubdivisions. */\r\n bottomCapSubdivisions?: number;\r\n\r\n /** Internal geometry is supposed to change once created. */\r\n updatable?: boolean;\r\n}\r\n\r\n/**\r\n * Creates a capsule or a pill mesh\r\n * @param name defines the name of the mesh\r\n * @param options The constructors options.\r\n * @param scene The scene the mesh is scoped to.\r\n * @returns Capsule Mesh\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function CreateCapsule(\r\n name: string,\r\n options: ICreateCapsuleOptions = {\r\n orientation: Vector3.Up(),\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6,\r\n updatable: false,\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const capsule = new Mesh(name, scene);\r\n const vertexData = CreateCapsuleVertexData(options);\r\n vertexData.applyToMesh(capsule, options.updatable);\r\n return capsule;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use CreateCapsule directly\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const CapsuleBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateCapsule,\r\n};\r\n\r\n/**\r\n * Creates a capsule or a pill mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/how_to/capsule_shape\r\n */\r\nMesh.CreateCapsule = (name: string, options: ICreateCapsuleOptions, scene?: Nullable<Scene>): Mesh => {\r\n return CreateCapsule(name, options, scene);\r\n};\r\n\r\nVertexData.CreateCapsule = CreateCapsuleVertexData;\r\n"]}
|
|
1
|
+
{"version":3,"file":"capsuleBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/capsuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACnC,UAAiC;IAC7B,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,CAAC;CACrB;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,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B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC;AAwCD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CACzB,IAAY,EACZ,UAAiC;IAC7B,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE;IACzB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,CAAC;IAClB,SAAS,EAAE,KAAK;CACnB,EACD,QAAyB,IAAI;IAE7B,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACpD,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,gEAAgE;IAChE,aAAa;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,IAAI,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,OAA8B,EAAE,KAAuB,EAAQ,EAAE;IACjG,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,UAAU,CAAC,aAAa,GAAG,uBAAuB,CAAC","sourcesContent":["import { VertexData } from \"../mesh.vertexData\";\r\nimport { Vector2, Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n/**\r\n * Scripts based off of https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\r\n * @param options the constructors options used to shape the mesh.\r\n * @returns the capsule VertexData\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/capsule\r\n */\r\nexport function CreateCapsuleVertexData(\r\n options: ICreateCapsuleOptions = {\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6,\r\n }\r\n): VertexData {\r\n const subdivisions = Math.max(options.subdivisions ? options.subdivisions : 2, 1) | 0;\r\n const tessellation = Math.max(options.tessellation ? options.tessellation : 16, 3) | 0;\r\n const height = Math.max(options.height ? options.height : 1, 0);\r\n const radius = Math.max(options.radius ? options.radius : 0.25, 0);\r\n const capDetail = Math.max(options.capSubdivisions ? options.capSubdivisions : 6, 1) | 0;\r\n\r\n const radialSegments = tessellation;\r\n const heightSegments = subdivisions;\r\n\r\n const radiusTop = Math.max(options.radiusTop ? options.radiusTop : radius, 0);\r\n const radiusBottom = Math.max(options.radiusBottom ? options.radiusBottom : radius, 0);\r\n\r\n const heightMinusCaps = height - (radiusTop + radiusBottom);\r\n\r\n const thetaStart = 0.0;\r\n const thetaLength = 2.0 * Math.PI;\r\n\r\n const capsTopSegments = Math.max(options.topCapSubdivisions ? options.topCapSubdivisions : capDetail, 1);\r\n const capsBottomSegments = Math.max(options.bottomCapSubdivisions ? options.bottomCapSubdivisions : capDetail, 1);\r\n\r\n const alpha = Math.acos((radiusBottom - radiusTop) / height);\r\n\r\n let indices = [];\r\n const vertices = [];\r\n const normals = [];\r\n const uvs = [];\r\n\r\n let index = 0;\r\n const indexArray = [],\r\n halfHeight = heightMinusCaps * 0.5;\r\n const pi2 = Math.PI * 0.5;\r\n\r\n let x, y;\r\n const normal = Vector3.Zero();\r\n const vertex = Vector3.Zero();\r\n\r\n const cosAlpha = Math.cos(alpha);\r\n const sinAlpha = Math.sin(alpha);\r\n\r\n const coneLength = new Vector2(radiusTop * sinAlpha, halfHeight + radiusTop * cosAlpha)\r\n .subtract(new Vector2(radiusBottom * sinAlpha, -halfHeight + radiusBottom * cosAlpha))\r\n .length();\r\n\r\n // Total length for v texture coord\r\n const vl = radiusTop * alpha + coneLength + radiusBottom * (pi2 - alpha);\r\n\r\n let v = 0;\r\n for (y = 0; y <= capsTopSegments; y++) {\r\n const indexRow = [];\r\n\r\n const a = pi2 - alpha * (y / capsTopSegments);\r\n\r\n v += (radiusTop * alpha) / capsTopSegments;\r\n\r\n const cosA = Math.cos(a);\r\n const sinA = Math.sin(a);\r\n\r\n // calculate the radius of the current row\r\n const _radius = cosA * radiusTop;\r\n\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = halfHeight + sinA * radiusTop;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n\r\n const coneHeight = height - radiusTop - radiusBottom + cosAlpha * radiusTop - cosAlpha * radiusBottom;\r\n const slope = (sinAlpha * (radiusBottom - radiusTop)) / coneHeight;\r\n\r\n for (y = 1; y <= heightSegments; y++) {\r\n const indexRow = [];\r\n v += coneLength / heightSegments;\r\n // calculate the radius of the current row\r\n const _radius = sinAlpha * ((y * (radiusBottom - radiusTop)) / heightSegments + radiusTop);\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = halfHeight + cosAlpha * radiusTop - (y * coneHeight) / heightSegments;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(sinTheta, slope, cosTheta).normalize();\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n\r\n for (y = 1; y <= capsBottomSegments; y++) {\r\n const indexRow = [];\r\n const a = pi2 - alpha - (Math.PI - alpha) * (y / capsBottomSegments);\r\n v += (radiusBottom * alpha) / capsBottomSegments;\r\n const cosA = Math.cos(a);\r\n const sinA = Math.sin(a);\r\n // calculate the radius of the current row\r\n const _radius = cosA * radiusBottom;\r\n for (x = 0; x <= radialSegments; x++) {\r\n const u = x / radialSegments;\r\n const theta = u * thetaLength + thetaStart;\r\n const sinTheta = Math.sin(theta);\r\n const cosTheta = Math.cos(theta);\r\n // vertex\r\n vertex.x = _radius * sinTheta;\r\n vertex.y = -halfHeight + sinA * radiusBottom;\r\n vertex.z = _radius * cosTheta;\r\n vertices.push(vertex.x, vertex.y, vertex.z);\r\n // normal\r\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\r\n normals.push(normal.x, normal.y, normal.z);\r\n // uv\r\n uvs.push(u, useOpenGLOrientationForUV ? v / vl : 1 - v / vl);\r\n // save index of vertex in respective row\r\n indexRow.push(index);\r\n // increase index\r\n index++;\r\n }\r\n // now save vertices of the row in our index array\r\n indexArray.push(indexRow);\r\n }\r\n // generate indices\r\n for (x = 0; x < radialSegments; x++) {\r\n for (y = 0; y < capsTopSegments + heightSegments + capsBottomSegments; y++) {\r\n // we use the index array to access the correct indices\r\n const i1 = indexArray[y][x];\r\n const i2 = indexArray[y + 1][x];\r\n const i3 = indexArray[y + 1][x + 1];\r\n const i4 = indexArray[y][x + 1];\r\n // face one\r\n indices.push(i1);\r\n indices.push(i2);\r\n indices.push(i4);\r\n // face two\r\n indices.push(i2);\r\n indices.push(i3);\r\n indices.push(i4);\r\n }\r\n }\r\n\r\n indices = indices.reverse();\r\n\r\n if (options.orientation && !options.orientation.equals(Vector3.Up())) {\r\n const m = new Matrix();\r\n options.orientation\r\n .clone()\r\n .scale(Math.PI * 0.5)\r\n .cross(Vector3.Up())\r\n .toQuaternion()\r\n .toRotationMatrix(m);\r\n const v = Vector3.Zero();\r\n for (let i = 0; i < vertices.length; i += 3) {\r\n v.set(vertices[i], vertices[i + 1], vertices[i + 2]);\r\n Vector3.TransformCoordinatesToRef(v.clone(), m, v);\r\n vertices[i] = v.x;\r\n vertices[i + 1] = v.y;\r\n vertices[i + 2] = v.z;\r\n }\r\n }\r\n\r\n const vDat = new VertexData();\r\n vDat.positions = vertices;\r\n vDat.normals = normals;\r\n vDat.uvs = uvs;\r\n vDat.indices = indices;\r\n\r\n return vDat;\r\n}\r\n\r\n/**\r\n * The options Interface for creating a Capsule Mesh\r\n */\r\nexport interface ICreateCapsuleOptions {\r\n /** The Orientation of the capsule. Default : Vector3.Up() */\r\n orientation?: Vector3;\r\n\r\n /** Number of sub segments on the tube section of the capsule running parallel to orientation. */\r\n subdivisions?: number;\r\n\r\n /** Number of cylindrical segments on the capsule. */\r\n tessellation?: number;\r\n\r\n /** Height or Length of the capsule. */\r\n height?: number;\r\n\r\n /** Radius of the capsule. */\r\n radius?: number;\r\n\r\n /** Number of sub segments on the cap sections of the capsule running parallel to orientation. */\r\n capSubdivisions?: number;\r\n\r\n /** Overwrite for the top radius. */\r\n radiusTop?: number;\r\n\r\n /** Overwrite for the bottom radius. */\r\n radiusBottom?: number;\r\n\r\n /** Overwrite for the top capSubdivisions. */\r\n topCapSubdivisions?: number;\r\n\r\n /** Overwrite for the bottom capSubdivisions. */\r\n bottomCapSubdivisions?: number;\r\n\r\n /** Internal geometry is supposed to change once created. */\r\n updatable?: boolean;\r\n}\r\n\r\n/**\r\n * Creates a capsule or a pill mesh\r\n * @param name defines the name of the mesh\r\n * @param options The constructors options.\r\n * @param scene The scene the mesh is scoped to.\r\n * @returns Capsule Mesh\r\n */\r\nexport function CreateCapsule(\r\n name: string,\r\n options: ICreateCapsuleOptions = {\r\n orientation: Vector3.Up(),\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6,\r\n updatable: false,\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const capsule = new Mesh(name, scene);\r\n const vertexData = CreateCapsuleVertexData(options);\r\n vertexData.applyToMesh(capsule, options.updatable);\r\n return capsule;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use CreateCapsule directly\r\n */\r\nexport const CapsuleBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateCapsule,\r\n};\r\n\r\n/**\r\n * Creates a capsule or a pill mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/how_to/capsule_shape\r\n */\r\nMesh.CreateCapsule = (name: string, options: ICreateCapsuleOptions, scene?: Nullable<Scene>): Mesh => {\r\n return CreateCapsule(name, options, scene);\r\n};\r\n\r\nVertexData.CreateCapsule = CreateCapsuleVertexData;\r\n"]}
|
|
@@ -12,7 +12,7 @@ import type { Nullable } from "../../types.js";
|
|
|
12
12
|
* * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter
|
|
13
13
|
* * diameter sets the diameter of the top and bottom of the cone, optional default 1
|
|
14
14
|
* * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24
|
|
15
|
-
* * subdivisions` the number of rings along the cylinder height, optional, default 1
|
|
15
|
+
* * `subdivisions` the number of rings along the cylinder height, optional, default 1
|
|
16
16
|
* * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
|
|
17
17
|
* * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
|
|
18
18
|
* * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
|
|
@@ -13,7 +13,7 @@ import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js"
|
|
|
13
13
|
* * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter
|
|
14
14
|
* * diameter sets the diameter of the top and bottom of the cone, optional default 1
|
|
15
15
|
* * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24
|
|
16
|
-
* * subdivisions` the number of rings along the cylinder height, optional, default 1
|
|
16
|
+
* * `subdivisions` the number of rings along the cylinder height, optional, default 1
|
|
17
17
|
* * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
|
|
18
18
|
* * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
|
|
19
19
|
* * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
|
|
@@ -24,7 +24,6 @@ import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js"
|
|
|
24
24
|
* * 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)
|
|
25
25
|
* @returns the VertexData of the cylinder, cone or prism
|
|
26
26
|
*/
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
27
|
export function CreateCylinderVertexData(options) {
|
|
29
28
|
const height = options.height || 2;
|
|
30
29
|
let diameterTop = options.diameterTop === 0 ? 0 : options.diameterTop || options.diameter || 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA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AO,CAAC,eAAe,CAAC,CAAC;IACnF,QAAQ,CAAC,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAEnE,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAErD,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAEpD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,gEAAgE;IAChE,cAAc;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC;AAErD,IAAI,CAAC,cAAc,GAAG,CAClB,IAAY,EACZ,MAAc,EACd,WAAmB,EACnB,cAAsB,EACtB,YAAoB,EACpB,YAAiB,EACjB,KAAa,EACb,SAAe,EACf,eAAwB,EACpB,EAAE;IACN,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,eAAe,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC;YAChD,SAAS,GAAG,KAAK,CAAC;QACtB,CAAC;QACD,KAAK,GAAU,YAAY,CAAC;QAC5B,YAAY,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAAG;QACZ,MAAM;QACN,WAAW;QACX,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function CreateCylinderVertexData(options: {\r\n height?: number;\r\n diameterTop?: number;\r\n diameterBottom?: number;\r\n diameter?: number;\r\n tessellation?: number;\r\n subdivisions?: number;\r\n arc?: number;\r\n faceColors?: Color4[];\r\n faceUV?: Vector4[];\r\n hasRings?: boolean;\r\n enclose?: boolean;\r\n cap?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n}): VertexData {\r\n const height: number = options.height || 2;\r\n let diameterTop: number = options.diameterTop === 0 ? 0 : options.diameterTop || options.diameter || 1;\r\n let diameterBottom: number = options.diameterBottom === 0 ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n const tessellation: number = (options.tessellation || 24) | 0;\r\n const subdivisions: number = (options.subdivisions || 1) | 0;\r\n const hasRings: boolean = options.hasRings ? true : false;\r\n const enclose: boolean = options.enclose ? true : false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.CAP_ALL;\r\n const arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n const faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n const quadNb: number = arc !== 1 && enclose ? 2 : 0;\r\n const ringNb: number = hasRings ? subdivisions : 1;\r\n const surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n let f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n const colors: number[] = [];\r\n\r\n const angleStep = (Math.PI * 2 * arc) / tessellation;\r\n let angle: number;\r\n let h: number;\r\n let radius: number;\r\n const tan = (diameterBottom - diameterTop) / 2 / height;\r\n const ringVertex: Vector3 = Vector3.Zero();\r\n const ringNormal: Vector3 = Vector3.Zero();\r\n const ringFirstVertex: Vector3 = Vector3.Zero();\r\n const ringFirstNormal: Vector3 = Vector3.Zero();\r\n const quadNormal: Vector3 = Vector3.Zero();\r\n const y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n let i: number;\r\n let j: number;\r\n let r: number;\r\n let ringIdx: number = 1;\r\n let s: number = 1; // surface index\r\n let cs: number = 0;\r\n let v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = hasRings && i !== 0 && i !== subdivisions ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angleStep;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n } else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + ((faceUV[s].z - faceUV[s].x) * j) / tessellation, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, useOpenGLOrientationForUV ? 1 - v : v);\r\n uvs.push(faceUV[s + 1].z, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, useOpenGLOrientationForUV ? 1 - v : v);\r\n uvs.push(faceUV[s + 2].z, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n const e: number = arc !== 1 && enclose ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) {\r\n // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = hasRings ? i + 2 : i + 1;\r\n }\r\n\r\n // Caps\r\n const createCylinderCap = (isTop: boolean) => {\r\n const radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n let angle;\r\n let circleVector;\r\n let i: number;\r\n const u: Vector4 = isTop ? faceUV[surfaceNb - 1] : faceUV[0];\r\n let c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = isTop ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n const vbase = positions.length / 3;\r\n const offset = isTop ? height / 2 : -height / 2;\r\n const center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n const v = u.y + (u.w - u.y) * 0.5;\r\n uvs.push(u.x + (u.z - u.x) * 0.5, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n const textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = (Math.PI * 2 * i * arc) / tessellation;\r\n const cos = Math.cos(-angle);\r\n const sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n const textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n const v = u.y + (u.w - u.y) * textureCoordinate.y;\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n } else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if (cap === Mesh.CAP_START || cap === Mesh.CAP_ALL) {\r\n createCylinderCap(false);\r\n }\r\n if (cap === Mesh.CAP_END || cap === Mesh.CAP_ALL) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n 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 if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/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 cylinder mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(\r\n name: string,\r\n options: {\r\n height?: number;\r\n diameterTop?: number;\r\n diameterBottom?: number;\r\n diameter?: number;\r\n tessellation?: number;\r\n subdivisions?: number;\r\n arc?: number;\r\n faceColors?: Color4[];\r\n faceUV?: Vector4[];\r\n updatable?: boolean;\r\n hasRings?: boolean;\r\n enclose?: boolean;\r\n cap?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n } = {},\r\n scene?: Nullable<Scene>\r\n): Mesh {\r\n const cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateCylinder,\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (\r\n name: string,\r\n height: number,\r\n diameterTop: number,\r\n diameterBottom: number,\r\n tessellation: number,\r\n subdivisions: any,\r\n scene?: Scene,\r\n updatable?: any,\r\n sideOrientation?: number\r\n): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAgBxC;IACG,MAAM,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,IAAI,WAAW,GAAW,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IACvG,IAAI,cAAc,GAAW,OAAO,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,O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CAAC;QACD,KAAK,GAAU,YAAY,CAAC;QAC5B,YAAY,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAAG;QACZ,MAAM;QACN,WAAW;QACX,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,eAAe;QACf,SAAS;KACZ,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * `subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\nexport function CreateCylinderVertexData(options: {\r\n height?: number;\r\n diameterTop?: number;\r\n diameterBottom?: number;\r\n diameter?: number;\r\n tessellation?: number;\r\n subdivisions?: number;\r\n arc?: number;\r\n faceColors?: Color4[];\r\n faceUV?: Vector4[];\r\n hasRings?: boolean;\r\n enclose?: boolean;\r\n cap?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n}): VertexData {\r\n const height: number = options.height || 2;\r\n let diameterTop: number = options.diameterTop === 0 ? 0 : options.diameterTop || options.diameter || 1;\r\n let diameterBottom: number = options.diameterBottom === 0 ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n const tessellation: number = (options.tessellation || 24) | 0;\r\n const subdivisions: number = (options.subdivisions || 1) | 0;\r\n const hasRings: boolean = options.hasRings ? true : false;\r\n const enclose: boolean = options.enclose ? true : false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.CAP_ALL;\r\n const arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n const faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n const quadNb: number = arc !== 1 && enclose ? 2 : 0;\r\n const ringNb: number = hasRings ? subdivisions : 1;\r\n const surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n let f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n const colors: number[] = [];\r\n\r\n const angleStep = (Math.PI * 2 * arc) / tessellation;\r\n let angle: number;\r\n let h: number;\r\n let radius: number;\r\n const tan = (diameterBottom - diameterTop) / 2 / height;\r\n const ringVertex: Vector3 = Vector3.Zero();\r\n const ringNormal: Vector3 = Vector3.Zero();\r\n const ringFirstVertex: Vector3 = Vector3.Zero();\r\n const ringFirstNormal: Vector3 = Vector3.Zero();\r\n const quadNormal: Vector3 = Vector3.Zero();\r\n const y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n let i: number;\r\n let j: number;\r\n let r: number;\r\n let ringIdx: number = 1;\r\n let s: number = 1; // surface index\r\n let cs: number = 0;\r\n let v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = hasRings && i !== 0 && i !== subdivisions ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angleStep;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n } else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + ((faceUV[s].z - faceUV[s].x) * j) / tessellation, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, useOpenGLOrientationForUV ? 1 - v : v);\r\n uvs.push(faceUV[s + 1].z, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (hasRings) {\r\n v = cs !== s ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, useOpenGLOrientationForUV ? 1 - v : v);\r\n uvs.push(faceUV[s + 2].z, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n const e: number = arc !== 1 && enclose ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) {\r\n // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = hasRings ? i + 2 : i + 1;\r\n }\r\n\r\n // Caps\r\n const createCylinderCap = (isTop: boolean) => {\r\n const radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n let angle;\r\n let circleVector;\r\n let i: number;\r\n const u: Vector4 = isTop ? faceUV[surfaceNb - 1] : faceUV[0];\r\n let c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = isTop ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n const vbase = positions.length / 3;\r\n const offset = isTop ? height / 2 : -height / 2;\r\n const center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n const v = u.y + (u.w - u.y) * 0.5;\r\n uvs.push(u.x + (u.z - u.x) * 0.5, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n const textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = (Math.PI * 2 * i * arc) / tessellation;\r\n const cos = Math.cos(-angle);\r\n const sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n const textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n const v = u.y + (u.w - u.y) * textureCoordinate.y;\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, useOpenGLOrientationForUV ? 1 - v : v);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n } else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if (cap === Mesh.CAP_START || cap === Mesh.CAP_ALL) {\r\n createCylinderCap(false);\r\n }\r\n if (cap === Mesh.CAP_END || cap === Mesh.CAP_ALL) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n 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 if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/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 cylinder mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(\r\n name: string,\r\n options: {\r\n height?: number;\r\n diameterTop?: number;\r\n diameterBottom?: number;\r\n diameter?: number;\r\n tessellation?: number;\r\n subdivisions?: number;\r\n arc?: number;\r\n faceColors?: Color4[];\r\n faceUV?: Vector4[];\r\n updatable?: boolean;\r\n hasRings?: boolean;\r\n enclose?: boolean;\r\n cap?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n } = {},\r\n scene?: Nullable<Scene>\r\n): Mesh {\r\n const cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateCylinder,\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (\r\n name: string,\r\n height: number,\r\n diameterTop: number,\r\n diameterBottom: number,\r\n tessellation: number,\r\n subdivisions: any,\r\n scene?: Scene,\r\n updatable?: any,\r\n sideOrientation?: number\r\n): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable,\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};\r\n"]}
|
|
@@ -12,6 +12,7 @@ const ZpAxis = new Vector3(0, 0, 1);
|
|
|
12
12
|
const ZnAxis = new Vector3(0, 0, -1);
|
|
13
13
|
/** @internal */
|
|
14
14
|
class DecalVertex {
|
|
15
|
+
/** @internal */
|
|
15
16
|
constructor(position = Vector3.Zero(), normal = Vector3.Up(), uv = Vector2.Zero(), vertexIdx = 0, vertexIdxForBones = 0, localPositionOverride = null, localNormalOverride = null, matrixIndicesOverride = null, matrixWeightsOverride = null) {
|
|
16
17
|
this.position = position;
|
|
17
18
|
this.normal = normal;
|
|
@@ -23,6 +24,7 @@ class DecalVertex {
|
|
|
23
24
|
this.matrixIndicesOverride = matrixIndicesOverride;
|
|
24
25
|
this.matrixWeightsOverride = matrixWeightsOverride;
|
|
25
26
|
}
|
|
27
|
+
/** @internal */
|
|
26
28
|
clone() {
|
|
27
29
|
return new DecalVertex(this.position.clone(), this.normal.clone(), this.uv.clone(), this.vertexIdx, this.vertexIdxForBones, this.localPositionOverride?.slice(), this.localNormalOverride?.slice(), this.matrixIndicesOverride?.slice(), this.matrixWeightsOverride?.slice());
|
|
28
30
|
}
|