@babylonjs/core 5.0.0-beta.2 → 5.0.0-beta.3
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/Culling/ray.js +2 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/axesViewer.d.ts +1 -0
- package/Debug/axesViewer.js +1 -0
- package/Debug/axesViewer.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -6
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.d.ts +2 -0
- package/Engines/WebGPU/webgpuCacheSampler.js +23 -2
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +3 -3
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +0 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -8
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +0 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +4 -26
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/engine.js +1 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.js +3 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +3 -3
- package/Engines/webgpuEngine.js +5 -8
- package/Engines/webgpuEngine.js.map +1 -1
- package/Maths/math.path.d.ts +1 -0
- package/Maths/math.path.js +1 -0
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.d.ts +1 -0
- package/Maths/math.vector.js +1 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/geodesicBuilder.d.ts +1 -0
- package/Meshes/Builders/geodesicBuilder.js +1 -0
- package/Meshes/Builders/geodesicBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.d.ts +1 -0
- package/Meshes/Builders/goldbergBuilder.js +1 -0
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +30 -11
- package/Meshes/Builders/tiledBoxBuilder.js +30 -11
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.d.ts +21 -16
- package/Meshes/Builders/tiledPlaneBuilder.js +21 -16
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +31 -14
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { Nullable } from '../../types';
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates the Mesh for a Geodesic Polyhedron
|
|
8
8
|
* @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
|
|
9
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
|
|
9
10
|
* @param name defines the name of the mesh
|
|
10
11
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
11
12
|
* * m number of horizontal steps along an isogrid
|
|
@@ -4,6 +4,7 @@ import { _PrimaryIsoTriangle, GeodesicData } from "../geodesicMesh.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates the Mesh for a Geodesic Polyhedron
|
|
6
6
|
* @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
|
|
7
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
|
|
7
8
|
* @param name defines the name of the mesh
|
|
8
9
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
9
10
|
* * m number of horizontal steps along an isogrid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/geodesicBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/geodesicBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAmP,EAAE,KAA6B;IAA7B,sBAAA,EAAA,YAA6B;IAC3T,IAAI,CAAC,GAAW,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACrB,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;KACtD;IACD,IAAI,CAAC,GAAW,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACrB,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;KACtD;IACD,IAAI,CAAC,GAAG,CAAC,EAAE;QACP,IAAM,IAAI,GAAG,CAAC,CAAC;QACf,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,IAAI,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;KAClD;IACD,IAAM,OAAO,GAAwB,IAAI,mBAAmB,EAAE,CAAC;IAC/D,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,IAAM,YAAY,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAM,UAAU,GAAW;QACvB,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC;IACF,IAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { CreatePolyhedron } from \"./polyhedronBuilder\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\n\r\n/**\r\n * Creates the Mesh for a Geodesic Polyhedron\r\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * m number of horizontal steps along an isogrid\r\n * * n number of angled steps along an isogrid\r\n * * size the size of the Geodesic, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\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 scene defines the hosting scene\r\n * @returns Geodesic mesh\r\n */\r\nexport function CreateGeodesic(name: string, options: { m?: number, n?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Nullable<Scene> = null): Mesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n\r\n const geoOptions: object = {\r\n custom: geodesicData,\r\n size: options.size,\r\n sizeX: options.sizeX,\r\n sizeY: options.sizeY,\r\n sizeZ: options.sizeZ,\r\n faceUV: options.faceUV,\r\n faceColors: options.faceColors,\r\n flat: options.flat,\r\n updatable: options.updatable,\r\n sideOrientation: options.sideOrientation,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs\r\n };\r\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\r\n\r\n return geodesic;\r\n}"]}
|
|
@@ -56,6 +56,7 @@ export declare function CreateGoldbergVertexData(options: GoldbergVertexDataOpti
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
|
|
58
58
|
* @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
|
|
59
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
|
|
59
60
|
* @param name defines the name of the mesh
|
|
60
61
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
61
62
|
* @param scene defines the hosting scene
|
|
@@ -63,6 +63,7 @@ export function CreateGoldbergVertexData(options, goldbergData) {
|
|
|
63
63
|
/**
|
|
64
64
|
* Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
|
|
65
65
|
* @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
|
|
66
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
|
|
66
67
|
* @param name defines the name of the mesh
|
|
67
68
|
* @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
|
|
68
69
|
* @param scene defines the hosting scene
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8C/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IACpG,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,eAAe,GAAG,CAAC,OAAO,CAAC,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,IAAI,UAAU,CAAC,WAAW,CAAC;IAEhH,IAAM,SAAS,GAAG,IAAI,KAAK,EAAU,CAAC;IACtC,IAAM,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC;IACpC,IAAM,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC;IACpC,IAAM,GAAG,GAAG,IAAI,KAAK,EAAU,CAAC;IAEhC,IAAI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CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
|
|
1
|
+
{"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8C/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IACpG,IAAM,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AAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAC/C,IAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAC9C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
|
|
@@ -6,12 +6,22 @@ import { Mesh } from "../mesh";
|
|
|
6
6
|
import { VertexData } from "../mesh.vertexData";
|
|
7
7
|
/**
|
|
8
8
|
* Creates the VertexData for a tiled box
|
|
9
|
-
* @
|
|
10
|
-
|
|
9
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
10
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
11
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
12
|
+
* * size of the box
|
|
13
|
+
* * width of the box, overwrites size
|
|
14
|
+
* * height of the box, overwrites size
|
|
15
|
+
* * depth of the box, overwrites size
|
|
16
|
+
* * tileSize sets the size of a tile
|
|
17
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
18
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
11
19
|
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
12
20
|
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
21
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
22
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
13
23
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
14
|
-
* @returns the VertexData of the
|
|
24
|
+
* @returns the VertexData of the TiledBox
|
|
15
25
|
*/
|
|
16
26
|
export declare function CreateTiledBoxVertexData(options: {
|
|
17
27
|
pattern?: number;
|
|
@@ -29,14 +39,23 @@ export declare function CreateTiledBoxVertexData(options: {
|
|
|
29
39
|
sideOrientation?: number;
|
|
30
40
|
}): VertexData;
|
|
31
41
|
/**
|
|
32
|
-
* Creates a box mesh
|
|
33
|
-
*
|
|
34
|
-
* * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
|
|
35
|
-
* * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
36
|
-
* * 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/babylon101/discover_basic_elements#side-orientation
|
|
37
|
-
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
42
|
+
* Creates a tiled box mesh
|
|
43
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
38
44
|
* @param name defines the name of the mesh
|
|
39
|
-
* @param options
|
|
45
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
46
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
47
|
+
* * size of the box
|
|
48
|
+
* * width of the box, overwrites size
|
|
49
|
+
* * height of the box, overwrites size
|
|
50
|
+
* * depth of the box, overwrites size
|
|
51
|
+
* * tileSize sets the size of a tile
|
|
52
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
53
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
54
|
+
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
55
|
+
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
56
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
57
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
58
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
40
59
|
* @param scene defines the hosting scene
|
|
41
60
|
* @returns the box mesh
|
|
42
61
|
*/
|
|
@@ -57,7 +76,7 @@ export declare function CreateTiledBox(name: string, options: {
|
|
|
57
76
|
}, scene?: Nullable<Scene>): Mesh;
|
|
58
77
|
/**
|
|
59
78
|
* Class containing static functions to help procedurally build meshes
|
|
60
|
-
* @deprecated use
|
|
79
|
+
* @deprecated use CreateTiledBox instead
|
|
61
80
|
*/
|
|
62
81
|
export declare const TiledBoxBuilder: {
|
|
63
82
|
CreateTiledBox: typeof CreateTiledBox;
|
|
@@ -5,12 +5,22 @@ import { VertexData } from "../mesh.vertexData.js";
|
|
|
5
5
|
import { CreateTiledPlaneVertexData } from "./tiledPlaneBuilder.js";
|
|
6
6
|
/**
|
|
7
7
|
* Creates the VertexData for a tiled box
|
|
8
|
-
* @
|
|
9
|
-
|
|
8
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
9
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
10
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
11
|
+
* * size of the box
|
|
12
|
+
* * width of the box, overwrites size
|
|
13
|
+
* * height of the box, overwrites size
|
|
14
|
+
* * depth of the box, overwrites size
|
|
15
|
+
* * tileSize sets the size of a tile
|
|
16
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
17
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
10
18
|
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
11
19
|
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
20
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
21
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
12
22
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
13
|
-
* @returns the VertexData of the
|
|
23
|
+
* @returns the VertexData of the TiledBox
|
|
14
24
|
*/
|
|
15
25
|
export function CreateTiledBoxVertexData(options) {
|
|
16
26
|
var nbFaces = 6;
|
|
@@ -151,14 +161,23 @@ export function CreateTiledBoxVertexData(options) {
|
|
|
151
161
|
return vertexData;
|
|
152
162
|
}
|
|
153
163
|
/**
|
|
154
|
-
* Creates a box mesh
|
|
155
|
-
*
|
|
156
|
-
* * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
|
|
157
|
-
* * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
158
|
-
* * 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/babylon101/discover_basic_elements#side-orientation
|
|
159
|
-
* * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
|
|
164
|
+
* Creates a tiled box mesh
|
|
165
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
|
|
160
166
|
* @param name defines the name of the mesh
|
|
161
|
-
* @param options
|
|
167
|
+
* @param options an object used to set the following optional parameters for the tiled box, required but can be empty
|
|
168
|
+
* * pattern sets the rotation or reflection pattern for the tiles,
|
|
169
|
+
* * size of the box
|
|
170
|
+
* * width of the box, overwrites size
|
|
171
|
+
* * height of the box, overwrites size
|
|
172
|
+
* * depth of the box, overwrites size
|
|
173
|
+
* * tileSize sets the size of a tile
|
|
174
|
+
* * tileWidth sets the tile width and overwrites tileSize
|
|
175
|
+
* * tileHeight sets the tile width and overwrites tileSize
|
|
176
|
+
* * faceUV an array of 6 Vector4 elements used to set different images to each box side
|
|
177
|
+
* * faceColors an array of 6 Color3 elements used to set different colors to each box side
|
|
178
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
179
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
180
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
162
181
|
* @param scene defines the hosting scene
|
|
163
182
|
* @returns the box mesh
|
|
164
183
|
*/
|
|
@@ -173,7 +192,7 @@ export function CreateTiledBox(name, options, scene) {
|
|
|
173
192
|
}
|
|
174
193
|
/**
|
|
175
194
|
* Class containing static functions to help procedurally build meshes
|
|
176
|
-
* @deprecated use
|
|
195
|
+
* @deprecated use CreateTiledBox instead
|
|
177
196
|
*/
|
|
178
197
|
export var TiledBoxBuilder = {
|
|
179
198
|
CreateTiledBox: CreateTiledBox
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiledBoxBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/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,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgR;IACrT,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,IAAI,MAAM,GAAc,OAAO,CAAC,MAAM,IAAI,IAAI,KAAK,CAAU,CAAC,CAAC,CAAC;IAChE,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAEpC,IAAI,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAE/C,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IAC/C,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IACjD,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IAC/C,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,I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C,SAAS,CAAC,CAAC;IAE/C,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC3B,cAAc,gBAAA;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC","sourcesContent":["import { Nullable } from \"../../types\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CreateTiledPlaneVertexData } from \"./tiledPlaneBuilder\";\r\n\r\n/**\r\n * Creates the VertexData for a tiled box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\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 * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the box\r\n */\r\nexport function CreateTiledBoxVertexData(options: { pattern?: number, size?: number, width?: number, height?: number, depth?: number, tileSize?: number, tileWidth?: number, tileHeight?: number, faceUV?: Vector4[], faceColors?: Color4[], alignHorizontal?: number, alignVertical?: number, sideOrientation?: number }): VertexData {\r\n var nbFaces = 6;\r\n\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(6);\r\n var faceColors = options.faceColors;\r\n\r\n var flipTile = options.pattern || Mesh.NO_FLIP;\r\n\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // default face colors and UV if undefined\r\n for (var 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 var halfWidth = width / 2;\r\n var halfHeight = height / 2;\r\n var halfDepth = depth / 2;\r\n\r\n var faceVertexData: Array<VertexData> = [];\r\n\r\n for (var f = 0; f < 2; f++) { //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 (var f = 2; f < 4; f++) { //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 var baseAlignV = alignV;\r\n if (alignV === Mesh.BOTTOM) {\r\n baseAlignV = Mesh.TOP;\r\n }\r\n else if (alignV === Mesh.TOP) {\r\n baseAlignV = Mesh.BOTTOM;\r\n }\r\n\r\n for (var f = 4; f < 6; f++) { //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 var positions: Array<number> = [];\r\n var normals: Array<number> = [];\r\n var uvs: Array<number> = [];\r\n var indices: Array<number> = [];\r\n var colors: Array<number> = [];\r\n var facePositions: Array<Array<Vector3>> = [];\r\n var faceNormals: Array<Array<Vector3>> = [];\r\n\r\n var newFaceUV: Array<Array<number>> = [];\r\n var len: number = 0;\r\n var lu: number = 0;\r\n\r\n var li: number = 0;\r\n\r\n for (var f = 0; f < nbFaces; f++) {\r\n var len = faceVertexData[f].positions!.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (var 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 (var 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 uvs = uvs.concat(newFaceUV[f]);\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 (var 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 var vec0 = new Vector3(0, 0, halfDepth);\r\n var mtrx0 = Matrix.RotationY(Math.PI);\r\n positions = facePositions[0].map((entry) => Vector3.TransformNormal(entry, mtrx0).add(vec0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n );\r\n normals = faceNormals[0].map((entry) => Vector3.TransformNormal(entry, mtrx0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n );\r\n positions = positions.concat(facePositions[1].map((entry) => entry.subtract(vec0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[1].map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n var vec2 = new Vector3(halfWidth, 0, 0);\r\n var mtrx2 = Matrix.RotationY(-Math.PI / 2);\r\n positions = positions.concat(facePositions[2].map((entry) => Vector3.TransformNormal(entry, mtrx2).add(vec2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[2].map((entry) => Vector3.TransformNormal(entry, mtrx2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n var mtrx3 = Matrix.RotationY(Math.PI / 2);\r\n positions = positions.concat(facePositions[3].map((entry) => Vector3.TransformNormal(entry, mtrx3).subtract(vec2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[3].map((entry) => Vector3.TransformNormal(entry, mtrx3)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n var vec4 = new Vector3(0, halfHeight, 0);\r\n var mtrx4 = Matrix.RotationX(Math.PI / 2);\r\n positions = positions.concat(facePositions[4].map((entry) => Vector3.TransformNormal(entry, mtrx4).add(vec4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[4].map((entry) => Vector3.TransformNormal(entry, mtrx4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n var mtrx5 = Matrix.RotationX(-Math.PI / 2);\r\n positions = positions.concat(facePositions[5].map((entry) => Vector3.TransformNormal(entry, mtrx5).subtract(vec4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[5].map((entry) => Vector3.TransformNormal(entry, mtrx5)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n // Result\r\n var 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 var 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 box mesh\r\n * faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\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/babylon101/discover_basic_elements#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 box mesh\r\n */\r\nexport function CreateTiledBox(name: string, options: { pattern?: number, width?: number, height?: number, depth?: number, tileSize?: number, tileWidth?: number, tileHeight?: number, alignHorizontal?: number, alignVertical?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, updatable?: boolean }, scene: Nullable<Scene> = null): Mesh {\r\n var 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 var 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 CreateTildeBox instead\r\n */\r\nexport const TiledBoxBuilder = {\r\n CreateTiledBox\r\n};\r\n\r\nVertexData.CreateTiledBox = CreateTiledBoxVertexData;"]}
|
|
1
|
+
{"version":3,"file":"tiledBoxBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/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,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgR;IACrT,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,IAAI,MAAM,GAAc,OAAO,CAAC,MAAM,IAAI,IAAI,KAAK,CAAU,CAAC,CAAC,CAAC;IAChE,IAAI,UAA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;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAsR,EAAE,KAA6B;IAA7B,sBAAA,EAAA,YAA6B;IAC9V,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEhC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACnF,GAAG,CAAC,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAE9D,IAAI,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAEnD,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC3B,cAAc,gBAAA;CACjB,CAAC;AAEF,UAAU,CAAC,cAAc,GAAG,wBAAwB,CAAC","sourcesContent":["import { Nullable } from \"../../types\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CreateTiledPlaneVertexData } from \"./tiledPlaneBuilder\";\r\n\r\n/**\r\n * Creates the VertexData for a tiled box\r\n * @see https://doc.babylonjs.com/divingDeeper/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 * * 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: { pattern?: number, size?: number, width?: number, height?: number, depth?: number, tileSize?: number, tileWidth?: number, tileHeight?: number, faceUV?: Vector4[], faceColors?: Color4[], alignHorizontal?: number, alignVertical?: number, sideOrientation?: number }): VertexData {\r\n var nbFaces = 6;\r\n\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(6);\r\n var faceColors = options.faceColors;\r\n\r\n var flipTile = options.pattern || Mesh.NO_FLIP;\r\n\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n // default face colors and UV if undefined\r\n for (var 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 var halfWidth = width / 2;\r\n var halfHeight = height / 2;\r\n var halfDepth = depth / 2;\r\n\r\n var faceVertexData: Array<VertexData> = [];\r\n\r\n for (var f = 0; f < 2; f++) { //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 (var f = 2; f < 4; f++) { //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 var baseAlignV = alignV;\r\n if (alignV === Mesh.BOTTOM) {\r\n baseAlignV = Mesh.TOP;\r\n }\r\n else if (alignV === Mesh.TOP) {\r\n baseAlignV = Mesh.BOTTOM;\r\n }\r\n\r\n for (var f = 4; f < 6; f++) { //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 var positions: Array<number> = [];\r\n var normals: Array<number> = [];\r\n var uvs: Array<number> = [];\r\n var indices: Array<number> = [];\r\n var colors: Array<number> = [];\r\n var facePositions: Array<Array<Vector3>> = [];\r\n var faceNormals: Array<Array<Vector3>> = [];\r\n\r\n var newFaceUV: Array<Array<number>> = [];\r\n var len: number = 0;\r\n var lu: number = 0;\r\n\r\n var li: number = 0;\r\n\r\n for (var f = 0; f < nbFaces; f++) {\r\n var len = faceVertexData[f].positions!.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (var 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 (var 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 uvs = uvs.concat(newFaceUV[f]);\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 (var 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 var vec0 = new Vector3(0, 0, halfDepth);\r\n var mtrx0 = Matrix.RotationY(Math.PI);\r\n positions = facePositions[0].map((entry) => Vector3.TransformNormal(entry, mtrx0).add(vec0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n );\r\n normals = faceNormals[0].map((entry) => Vector3.TransformNormal(entry, mtrx0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n );\r\n positions = positions.concat(facePositions[1].map((entry) => entry.subtract(vec0)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[1].map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n var vec2 = new Vector3(halfWidth, 0, 0);\r\n var mtrx2 = Matrix.RotationY(-Math.PI / 2);\r\n positions = positions.concat(facePositions[2].map((entry) => Vector3.TransformNormal(entry, mtrx2).add(vec2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[2].map((entry) => Vector3.TransformNormal(entry, mtrx2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n var mtrx3 = Matrix.RotationY(Math.PI / 2);\r\n positions = positions.concat(facePositions[3].map((entry) => Vector3.TransformNormal(entry, mtrx3).subtract(vec2)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[3].map((entry) => Vector3.TransformNormal(entry, mtrx3)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n var vec4 = new Vector3(0, halfHeight, 0);\r\n var mtrx4 = Matrix.RotationX(Math.PI / 2);\r\n positions = positions.concat(facePositions[4].map((entry) => Vector3.TransformNormal(entry, mtrx4).add(vec4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[4].map((entry) => Vector3.TransformNormal(entry, mtrx4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n var mtrx5 = Matrix.RotationX(-Math.PI / 2);\r\n positions = positions.concat(facePositions[5].map((entry) => Vector3.TransformNormal(entry, mtrx5).subtract(vec4)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n normals = normals.concat(faceNormals[5].map((entry) => Vector3.TransformNormal(entry, mtrx5)).map((entry) => [entry.x, entry.y, entry.z]).reduce(\r\n (accumulator: Array<number>, currentValue) => accumulator.concat(currentValue),\r\n []\r\n ));\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n // Result\r\n var 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 var 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/divingDeeper/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 scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\nexport function CreateTiledBox(name: string, options: { pattern?: number, width?: number, height?: number, depth?: number, tileSize?: number, tileWidth?: number, tileHeight?: number, alignHorizontal?: number, alignVertical?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, updatable?: boolean }, scene: Nullable<Scene> = null): Mesh {\r\n var 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 var 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 CreateTiledBox\r\n};\r\n\r\nVertexData.CreateTiledBox = CreateTiledBoxVertexData;"]}
|
|
@@ -5,12 +5,18 @@ import { Mesh } from "../mesh";
|
|
|
5
5
|
import { VertexData } from "../mesh.vertexData";
|
|
6
6
|
/**
|
|
7
7
|
* Creates the VertexData for a tiled plane
|
|
8
|
-
* @
|
|
8
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_plane
|
|
9
|
+
* @param options an object used to set the following optional parameters for the tiled plane, required but can be empty
|
|
9
10
|
* * pattern a limited pattern arrangement depending on the number
|
|
11
|
+
* * size of the box
|
|
12
|
+
* * width of the box, overwrites size
|
|
13
|
+
* * height of the box, overwrites size
|
|
10
14
|
* * tileSize sets the width, height and depth of the tile to the value of size, optional default 1
|
|
11
15
|
* * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size
|
|
12
16
|
* * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size
|
|
13
17
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
18
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
19
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
14
20
|
* * 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)
|
|
15
21
|
* * 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)
|
|
16
22
|
* @returns the VertexData of the tiled plane
|
|
@@ -31,22 +37,21 @@ export declare function CreateTiledPlaneVertexData(options: {
|
|
|
31
37
|
}): VertexData;
|
|
32
38
|
/**
|
|
33
39
|
* Creates a tiled plane mesh
|
|
34
|
-
*
|
|
35
|
-
* * * flip (reflect about central vertical) alternate tiles across and up
|
|
36
|
-
* * * flip every tile on alternate rows
|
|
37
|
-
* * * rotate (180 degs) alternate tiles across and up
|
|
38
|
-
* * * rotate every tile on alternate rows
|
|
39
|
-
* * * flip and rotate alternate tiles across and up
|
|
40
|
-
* * * flip and rotate every tile on alternate rows
|
|
41
|
-
* * The parameter `tileSize` sets the size (float) of each tile side (default 1)
|
|
42
|
-
* * You can set some different tile dimensions by using the parameters `tileWidth` and `tileHeight` (both by default have the same value of `tileSize`)
|
|
43
|
-
* * 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/babylon101/discover_basic_elements#side-orientation
|
|
44
|
-
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
45
|
-
* * 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)
|
|
46
|
-
* * 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)
|
|
47
|
-
* @see https://doc.babylonjs.com/how_to/set_shapes#box
|
|
40
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_plane
|
|
48
41
|
* @param name defines the name of the mesh
|
|
49
|
-
* @param options
|
|
42
|
+
* @param options an object used to set the following optional parameters for the tiled plane, required but can be empty
|
|
43
|
+
* * pattern a limited pattern arrangement depending on the number
|
|
44
|
+
* * size of the box
|
|
45
|
+
* * width of the box, overwrites size
|
|
46
|
+
* * height of the box, overwrites size
|
|
47
|
+
* * tileSize sets the width, height and depth of the tile to the value of size, optional default 1
|
|
48
|
+
* * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size
|
|
49
|
+
* * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size
|
|
50
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
51
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
52
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
53
|
+
* * 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)
|
|
54
|
+
* * 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)
|
|
50
55
|
* @param scene defines the hosting scene
|
|
51
56
|
* @returns the box mesh
|
|
52
57
|
*/
|
|
@@ -2,12 +2,18 @@ import { Mesh } from "../mesh.js";
|
|
|
2
2
|
import { VertexData } from "../mesh.vertexData.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates the VertexData for a tiled plane
|
|
5
|
-
* @
|
|
5
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_plane
|
|
6
|
+
* @param options an object used to set the following optional parameters for the tiled plane, required but can be empty
|
|
6
7
|
* * pattern a limited pattern arrangement depending on the number
|
|
8
|
+
* * size of the box
|
|
9
|
+
* * width of the box, overwrites size
|
|
10
|
+
* * height of the box, overwrites size
|
|
7
11
|
* * tileSize sets the width, height and depth of the tile to the value of size, optional default 1
|
|
8
12
|
* * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size
|
|
9
13
|
* * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size
|
|
10
14
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
15
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
16
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
11
17
|
* * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
|
|
12
18
|
* * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
|
|
13
19
|
* @returns the VertexData of the tiled plane
|
|
@@ -382,22 +388,21 @@ export function CreateTiledPlaneVertexData(options) {
|
|
|
382
388
|
}
|
|
383
389
|
/**
|
|
384
390
|
* Creates a tiled plane mesh
|
|
385
|
-
*
|
|
386
|
-
* * * flip (reflect about central vertical) alternate tiles across and up
|
|
387
|
-
* * * flip every tile on alternate rows
|
|
388
|
-
* * * rotate (180 degs) alternate tiles across and up
|
|
389
|
-
* * * rotate every tile on alternate rows
|
|
390
|
-
* * * flip and rotate alternate tiles across and up
|
|
391
|
-
* * * flip and rotate every tile on alternate rows
|
|
392
|
-
* * The parameter `tileSize` sets the size (float) of each tile side (default 1)
|
|
393
|
-
* * You can set some different tile dimensions by using the parameters `tileWidth` and `tileHeight` (both by default have the same value of `tileSize`)
|
|
394
|
-
* * 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/babylon101/discover_basic_elements#side-orientation
|
|
395
|
-
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
396
|
-
* * 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)
|
|
397
|
-
* * 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)
|
|
398
|
-
* @see https://doc.babylonjs.com/how_to/set_shapes#box
|
|
391
|
+
* @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_plane
|
|
399
392
|
* @param name defines the name of the mesh
|
|
400
|
-
* @param options
|
|
393
|
+
* @param options an object used to set the following optional parameters for the tiled plane, required but can be empty
|
|
394
|
+
* * pattern a limited pattern arrangement depending on the number
|
|
395
|
+
* * size of the box
|
|
396
|
+
* * width of the box, overwrites size
|
|
397
|
+
* * height of the box, overwrites size
|
|
398
|
+
* * tileSize sets the width, height and depth of the tile to the value of size, optional default 1
|
|
399
|
+
* * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size
|
|
400
|
+
* * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size
|
|
401
|
+
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
402
|
+
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
403
|
+
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
404
|
+
* * 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)
|
|
405
|
+
* * 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)
|
|
401
406
|
* @param scene defines the hosting scene
|
|
402
407
|
* @returns the box mesh
|
|
403
408
|
*/
|