@babylonjs/core 7.28.0 → 7.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Culling/ray.core.d.ts +13 -0
- package/Culling/ray.core.js +14 -6
- package/Culling/ray.core.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +24 -0
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +2 -1
- package/Engines/index.d.ts +1 -0
- package/Engines/index.js +1 -0
- package/Engines/index.js.map +1 -1
- package/Engines/nullEngine.d.ts +1 -0
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +4 -0
- package/Engines/webgpuEngine.js +2 -4
- package/Engines/webgpuEngine.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +34 -18
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +12 -0
- package/Materials/Textures/rawTexture3D.js +18 -0
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +1 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/effect.d.ts +11 -0
- package/Materials/effect.js +20 -0
- package/Materials/effect.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +46 -46
- package/Materials/materialPluginBase.js +46 -60
- package/Materials/materialPluginBase.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +0 -16
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +17 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +3 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +91 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js +194 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +11 -4
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +8 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js +22 -6
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInterceptorBlock.d.ts +5 -0
- package/Meshes/Node/Blocks/geometryInterceptorBlock.js +5 -1
- package/Meshes/Node/Blocks/geometryInterceptorBlock.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +5 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js +4 -0
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +12 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +2 -0
- package/Meshes/abstractMesh.hotSpot.d.ts +30 -0
- package/Meshes/abstractMesh.hotSpot.js +84 -0
- package/Meshes/abstractMesh.hotSpot.js.map +1 -0
- package/Meshes/abstractMesh.js +2 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/index.d.ts +3 -0
- package/Meshes/index.js +3 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/lattice.d.ts +110 -0
- package/Meshes/lattice.js +224 -0
- package/Meshes/lattice.js.map +1 -0
- package/Meshes/lattice.material.d.ts +82 -0
- package/Meshes/lattice.material.js +259 -0
- package/Meshes/lattice.material.js.map +1 -0
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +1 -2
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/screenshotTools.js +0 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +63 -0
- package/Misc/snapshotRenderingHelper.js +182 -0
- package/Misc/snapshotRenderingHelper.js.map +1 -0
- package/Morph/morphTargetManager.js +0 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Shaders/spriteMap.fragment.d.ts +4 -0
- package/Shaders/spriteMap.fragment.js +16 -3
- package/Shaders/spriteMap.fragment.js.map +1 -1
- package/Shaders/spriteMap.vertex.d.ts +3 -0
- package/Shaders/spriteMap.vertex.js +14 -2
- package/Shaders/spriteMap.vertex.js.map +1 -1
- package/ShadersWGSL/bilateralBlurQuality.fragment.js +1 -1
- package/ShadersWGSL/bilateralBlurQuality.fragment.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +1 -1
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +2 -2
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +2 -2
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +1 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/rsmFullGlobalIllumination.fragment.js +1 -1
- package/ShadersWGSL/rsmFullGlobalIllumination.fragment.js.map +1 -1
- package/Sprites/spriteManager.d.ts +10 -1
- package/Sprites/spriteManager.js +3 -2
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.d.ts +7 -0
- package/Sprites/spriteMap.js +29 -1
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spritePackedManager.d.ts +6 -1
- package/Sprites/spritePackedManager.js +6 -2
- package/Sprites/spritePackedManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +16 -3
- package/Sprites/spriteRenderer.js +5 -3
- package/Sprites/spriteRenderer.js.map +1 -1
- package/package.json +1 -1
package/Meshes/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./abstractMesh";
|
|
2
2
|
import "./abstractMesh.decalMap";
|
|
3
|
+
export * from "./abstractMesh.hotSpot";
|
|
3
4
|
export * from "./Compression/index";
|
|
4
5
|
export * from "./csg";
|
|
5
6
|
export * from "./meshUVSpaceRenderer";
|
|
@@ -19,6 +20,8 @@ export * from "./polygonMesh";
|
|
|
19
20
|
export * from "./geodesicMesh";
|
|
20
21
|
export * from "./subMesh";
|
|
21
22
|
export * from "./subMesh.project";
|
|
23
|
+
export * from "./lattice";
|
|
24
|
+
export * from "./lattice.material";
|
|
22
25
|
export * from "./meshLODLevel";
|
|
23
26
|
export * from "./transformNode";
|
|
24
27
|
export * from "./Builders/index";
|
package/Meshes/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable import/no-internal-modules */
|
|
3
3
|
export * from "./abstractMesh.js";
|
|
4
4
|
import "./abstractMesh.decalMap.js";
|
|
5
|
+
export * from "./abstractMesh.hotSpot.js";
|
|
5
6
|
export * from "./Compression/index.js";
|
|
6
7
|
export * from "./csg.js";
|
|
7
8
|
export * from "./meshUVSpaceRenderer.js";
|
|
@@ -21,6 +22,8 @@ export * from "./polygonMesh.js";
|
|
|
21
22
|
export * from "./geodesicMesh.js";
|
|
22
23
|
export * from "./subMesh.js";
|
|
23
24
|
export * from "./subMesh.project.js";
|
|
25
|
+
export * from "./lattice.js";
|
|
26
|
+
export * from "./lattice.material.js";
|
|
24
27
|
export * from "./meshLODLevel.js";
|
|
25
28
|
export * from "./transformNode.js";
|
|
26
29
|
export * from "./Builders/index.js";
|
package/Meshes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+CAA+C;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAC5B,gDAAgD;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2CAA2C,CAAC;AAE1D,WAAW;AACX,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractMesh\";\r\nimport \"./abstractMesh.decalMap\";\r\nexport * from \"./Compression/index\";\r\nexport * from \"./csg\";\r\nexport * from \"./meshUVSpaceRenderer\";\r\nexport * from \"./geometry\";\r\nexport * from \"./groundMesh\";\r\nexport * from \"./goldbergMesh\";\r\nexport * from \"./trailMesh\";\r\nexport * from \"./instancedMesh\";\r\nexport * from \"./linesMesh\";\r\nexport * from \"./mesh\";\r\nexport * from \"./mesh.vertexData\";\r\nexport * from \"./meshBuilder\";\r\nexport * from \"./meshSimplification\";\r\nexport * from \"./meshSimplificationSceneComponent\";\r\nexport * from \"./meshUtils\";\r\nexport * from \"./polygonMesh\";\r\nexport * from \"./geodesicMesh\";\r\nexport * from \"./subMesh\";\r\nexport * from \"./subMesh.project\";\r\nexport * from \"./meshLODLevel\";\r\nexport * from \"./transformNode\";\r\nexport * from \"./Builders/index\";\r\nexport * from \"./WebGL/webGLDataBuffer\";\r\nexport * from \"./WebGPU/webgpuDataBuffer\";\r\nexport * from \"./GreasedLine/greasedLineMesh\";\r\nexport * from \"./GreasedLine/greasedLineRibbonMesh\";\r\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\r\nimport \"./thinInstanceMesh\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"./thinInstanceMesh\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMesh\";\r\n\r\n// LineMesh\r\nexport * from \"../Shaders/color.fragment\";\r\nexport * from \"../Shaders/color.vertex\";\r\nexport * from \"../ShadersWGSL/color.fragment\";\r\nexport * from \"../ShadersWGSL/color.vertex\";\r\n\r\n// MeshUVSPaceRenderer\r\nexport * from \"../Shaders/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.vertex\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+CAA+C;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAC5B,gDAAgD;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2CAA2C,CAAC;AAE1D,WAAW;AACX,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractMesh\";\r\nimport \"./abstractMesh.decalMap\";\r\nexport * from \"./abstractMesh.hotSpot\";\r\nexport * from \"./Compression/index\";\r\nexport * from \"./csg\";\r\nexport * from \"./meshUVSpaceRenderer\";\r\nexport * from \"./geometry\";\r\nexport * from \"./groundMesh\";\r\nexport * from \"./goldbergMesh\";\r\nexport * from \"./trailMesh\";\r\nexport * from \"./instancedMesh\";\r\nexport * from \"./linesMesh\";\r\nexport * from \"./mesh\";\r\nexport * from \"./mesh.vertexData\";\r\nexport * from \"./meshBuilder\";\r\nexport * from \"./meshSimplification\";\r\nexport * from \"./meshSimplificationSceneComponent\";\r\nexport * from \"./meshUtils\";\r\nexport * from \"./polygonMesh\";\r\nexport * from \"./geodesicMesh\";\r\nexport * from \"./subMesh\";\r\nexport * from \"./subMesh.project\";\r\nexport * from \"./lattice\";\r\nexport * from \"./lattice.material\";\r\nexport * from \"./meshLODLevel\";\r\nexport * from \"./transformNode\";\r\nexport * from \"./Builders/index\";\r\nexport * from \"./WebGL/webGLDataBuffer\";\r\nexport * from \"./WebGPU/webgpuDataBuffer\";\r\nexport * from \"./GreasedLine/greasedLineMesh\";\r\nexport * from \"./GreasedLine/greasedLineRibbonMesh\";\r\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\r\nimport \"./thinInstanceMesh\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"./thinInstanceMesh\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMesh\";\r\n\r\n// LineMesh\r\nexport * from \"../Shaders/color.fragment\";\r\nexport * from \"../Shaders/color.vertex\";\r\nexport * from \"../ShadersWGSL/color.fragment\";\r\nexport * from \"../ShadersWGSL/color.vertex\";\r\n\r\n// MeshUVSPaceRenderer\r\nexport * from \"../Shaders/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.vertex\";\r\n"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Vector3 } from "../Maths/math.vector.js";
|
|
2
|
+
import type { Mesh } from "./mesh";
|
|
3
|
+
import type { FloatArray } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Interface used to define options for creating a lattice
|
|
6
|
+
*/
|
|
7
|
+
export interface ILatticeOptions {
|
|
8
|
+
/** resolution on x axis */
|
|
9
|
+
resolutionX: number;
|
|
10
|
+
/** resolution on y axis */
|
|
11
|
+
resolutionY: number;
|
|
12
|
+
/** resolution on z axis */
|
|
13
|
+
resolutionZ: number;
|
|
14
|
+
/** the lattice position in object space */
|
|
15
|
+
position: Vector3;
|
|
16
|
+
/** size of the lattice along each axis in object space */
|
|
17
|
+
size: Vector3;
|
|
18
|
+
/** Optional mesh to adapt the size to */
|
|
19
|
+
autoAdaptToMesh?: Mesh;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Class used to represent a lattice
|
|
23
|
+
* #MDVD75#18 - Moving lattice bounds
|
|
24
|
+
* #MDVD75#23 - Twist
|
|
25
|
+
*/
|
|
26
|
+
export declare class Lattice {
|
|
27
|
+
private _resolutionX;
|
|
28
|
+
private _resolutionY;
|
|
29
|
+
private _resolutionZ;
|
|
30
|
+
private _position;
|
|
31
|
+
private _size;
|
|
32
|
+
private _cellSize;
|
|
33
|
+
private _data;
|
|
34
|
+
private _min;
|
|
35
|
+
private _max;
|
|
36
|
+
private _localPos;
|
|
37
|
+
private _tmpVector;
|
|
38
|
+
private _lerpVector0;
|
|
39
|
+
private _lerpVector1;
|
|
40
|
+
private _lerpVector2;
|
|
41
|
+
private _lerpVector3;
|
|
42
|
+
private _lerpVector4;
|
|
43
|
+
private _lerpVector5;
|
|
44
|
+
/**
|
|
45
|
+
* @returns the string "Lattice"
|
|
46
|
+
*/
|
|
47
|
+
getClassName(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the resolution on x axis
|
|
50
|
+
*/
|
|
51
|
+
get resolutionX(): number;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the resolution on y axis
|
|
54
|
+
*/
|
|
55
|
+
get resolutionY(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the resolution on z axis
|
|
58
|
+
*/
|
|
59
|
+
get resolutionZ(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the size of the lattice along each axis in object space
|
|
62
|
+
* Updating the size requires you to call update afterwards
|
|
63
|
+
*/
|
|
64
|
+
get size(): Vector3;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the lattice position in object space
|
|
67
|
+
*/
|
|
68
|
+
get position(): Vector3;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the data of the lattice
|
|
71
|
+
*/
|
|
72
|
+
get data(): Vector3[][][];
|
|
73
|
+
/**
|
|
74
|
+
* Gets the size of each cell in the lattice
|
|
75
|
+
*/
|
|
76
|
+
get cellSize(): Vector3;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the min bounds of the lattice
|
|
79
|
+
*/
|
|
80
|
+
get min(): Vector3;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the max bounds of the lattice
|
|
83
|
+
*/
|
|
84
|
+
get max(): Vector3;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new Lattice
|
|
87
|
+
* @param options options for creating
|
|
88
|
+
*/
|
|
89
|
+
constructor(options?: Partial<ILatticeOptions>);
|
|
90
|
+
private _allocateData;
|
|
91
|
+
/**
|
|
92
|
+
* Update of the lattice data
|
|
93
|
+
*/
|
|
94
|
+
update(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Apply the lattice to a mesh
|
|
97
|
+
* @param mesh mesh to deform
|
|
98
|
+
*/
|
|
99
|
+
deformMesh(mesh: Mesh): void;
|
|
100
|
+
/**
|
|
101
|
+
* Update the lattice internals (like min, max and cell size)
|
|
102
|
+
*/
|
|
103
|
+
updateInternals(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Apply the lattice to a set of points
|
|
106
|
+
* @param positions vertex data to deform
|
|
107
|
+
* @param target optional target array to store the result (operation will be done in place in not defined)
|
|
108
|
+
*/
|
|
109
|
+
deform(positions: FloatArray, target?: FloatArray): void;
|
|
110
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Vector3 } from "../Maths/math.vector.js";
|
|
2
|
+
import { VertexBuffer } from "./buffer.js";
|
|
3
|
+
import { Clamp } from "../Maths/math.scalar.functions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Class used to represent a lattice
|
|
6
|
+
* #MDVD75#18 - Moving lattice bounds
|
|
7
|
+
* #MDVD75#23 - Twist
|
|
8
|
+
*/
|
|
9
|
+
export class Lattice {
|
|
10
|
+
/**
|
|
11
|
+
* @returns the string "Lattice"
|
|
12
|
+
*/
|
|
13
|
+
getClassName() {
|
|
14
|
+
return "Lattice";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the resolution on x axis
|
|
18
|
+
*/
|
|
19
|
+
get resolutionX() {
|
|
20
|
+
return this._resolutionX;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the resolution on y axis
|
|
24
|
+
*/
|
|
25
|
+
get resolutionY() {
|
|
26
|
+
return this._resolutionY;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the resolution on z axis
|
|
30
|
+
*/
|
|
31
|
+
get resolutionZ() {
|
|
32
|
+
return this._resolutionZ;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets the size of the lattice along each axis in object space
|
|
36
|
+
* Updating the size requires you to call update afterwards
|
|
37
|
+
*/
|
|
38
|
+
get size() {
|
|
39
|
+
return this._size;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets the lattice position in object space
|
|
43
|
+
*/
|
|
44
|
+
get position() {
|
|
45
|
+
return this._position;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the data of the lattice
|
|
49
|
+
*/
|
|
50
|
+
get data() {
|
|
51
|
+
return this._data;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the size of each cell in the lattice
|
|
55
|
+
*/
|
|
56
|
+
get cellSize() {
|
|
57
|
+
return this._cellSize;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the min bounds of the lattice
|
|
61
|
+
*/
|
|
62
|
+
get min() {
|
|
63
|
+
return this._min;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets the max bounds of the lattice
|
|
67
|
+
*/
|
|
68
|
+
get max() {
|
|
69
|
+
return this._max;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new Lattice
|
|
73
|
+
* @param options options for creating
|
|
74
|
+
*/
|
|
75
|
+
constructor(options) {
|
|
76
|
+
this._cellSize = new Vector3();
|
|
77
|
+
// Cache
|
|
78
|
+
this._min = new Vector3(-0.5, -0.5, -0.5);
|
|
79
|
+
this._max = new Vector3(0.5, 0.5, 0.5);
|
|
80
|
+
this._localPos = new Vector3();
|
|
81
|
+
this._tmpVector = new Vector3();
|
|
82
|
+
this._lerpVector0 = new Vector3();
|
|
83
|
+
this._lerpVector1 = new Vector3();
|
|
84
|
+
this._lerpVector2 = new Vector3();
|
|
85
|
+
this._lerpVector3 = new Vector3();
|
|
86
|
+
this._lerpVector4 = new Vector3();
|
|
87
|
+
this._lerpVector5 = new Vector3();
|
|
88
|
+
const localOptions = {
|
|
89
|
+
resolutionX: 3,
|
|
90
|
+
resolutionY: 3,
|
|
91
|
+
resolutionZ: 3,
|
|
92
|
+
position: Vector3.Zero(),
|
|
93
|
+
size: Vector3.One(),
|
|
94
|
+
...options,
|
|
95
|
+
};
|
|
96
|
+
this._resolutionX = localOptions.resolutionX;
|
|
97
|
+
this._resolutionY = localOptions.resolutionY;
|
|
98
|
+
this._resolutionZ = localOptions.resolutionZ;
|
|
99
|
+
this._position = localOptions.position;
|
|
100
|
+
this._size = localOptions.autoAdaptToMesh ? localOptions.autoAdaptToMesh.getBoundingInfo().boundingBox.extendSize.scale(2) : localOptions.size;
|
|
101
|
+
// Allocate data
|
|
102
|
+
this._allocateData();
|
|
103
|
+
this.update();
|
|
104
|
+
}
|
|
105
|
+
_allocateData() {
|
|
106
|
+
this._data = new Array(this.resolutionX);
|
|
107
|
+
for (let i = 0; i < this.resolutionX; i++) {
|
|
108
|
+
this._data[i] = new Array(this.resolutionY);
|
|
109
|
+
for (let j = 0; j < this.resolutionY; j++) {
|
|
110
|
+
this._data[i][j] = new Array(this.resolutionZ);
|
|
111
|
+
for (let k = 0; k < this.resolutionZ; k++) {
|
|
112
|
+
this._data[i][j][k] = Vector3.Zero();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Update of the lattice data
|
|
119
|
+
*/
|
|
120
|
+
update() {
|
|
121
|
+
for (let i = 0; i < this.resolutionX; i++) {
|
|
122
|
+
for (let j = 0; j < this.resolutionY; j++) {
|
|
123
|
+
for (let k = 0; k < this.resolutionZ; k++) {
|
|
124
|
+
const x = -this.size.x / 2 + this.size.x * (i / (this.resolutionX - 1));
|
|
125
|
+
const y = -this.size.y / 2 + this.size.y * (j / (this.resolutionY - 1));
|
|
126
|
+
const z = -this.size.z / 2 + this.size.z * (k / (this.resolutionZ - 1));
|
|
127
|
+
this._data[i][j][k].set(x, y, z);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Apply the lattice to a mesh
|
|
134
|
+
* @param mesh mesh to deform
|
|
135
|
+
*/
|
|
136
|
+
deformMesh(mesh) {
|
|
137
|
+
const positions = mesh.getVerticesData(VertexBuffer.PositionKind);
|
|
138
|
+
if (!positions) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Apply the lattice
|
|
142
|
+
this.deform(positions);
|
|
143
|
+
// Update back the mesh
|
|
144
|
+
mesh.setVerticesData(VertexBuffer.PositionKind, positions, true);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Update the lattice internals (like min, max and cell size)
|
|
148
|
+
*/
|
|
149
|
+
updateInternals() {
|
|
150
|
+
const nx = this._resolutionX;
|
|
151
|
+
const ny = this._resolutionY;
|
|
152
|
+
const nz = this._resolutionZ;
|
|
153
|
+
// Calculate the size of each cell in the lattice
|
|
154
|
+
this._cellSize.set(this.size.x / (nx - 1), this.size.y / (ny - 1), this.size.z / (nz - 1));
|
|
155
|
+
// Calculate the lattice bounds
|
|
156
|
+
this._min.set(this.position.x - this.size.x / 2, this.position.y - this.size.y / 2, this.position.z - this.size.z / 2);
|
|
157
|
+
this._min.addToRef(this._size, this._max);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Apply the lattice to a set of points
|
|
161
|
+
* @param positions vertex data to deform
|
|
162
|
+
* @param target optional target array to store the result (operation will be done in place in not defined)
|
|
163
|
+
*/
|
|
164
|
+
deform(positions, target) {
|
|
165
|
+
const nx = this._resolutionX;
|
|
166
|
+
const ny = this._resolutionY;
|
|
167
|
+
const nz = this._resolutionZ;
|
|
168
|
+
this.updateInternals();
|
|
169
|
+
const min = this._min;
|
|
170
|
+
const max = this._max;
|
|
171
|
+
// Loop over each vertex
|
|
172
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
173
|
+
const vertex = this._tmpVector.fromArray(positions, i);
|
|
174
|
+
// Check we are inside
|
|
175
|
+
if (vertex.x < min.x || vertex.x > max.x || vertex.y < min.y || vertex.y > max.y || vertex.z < min.z || vertex.z > max.z) {
|
|
176
|
+
if (target) {
|
|
177
|
+
vertex.toArray(target, i);
|
|
178
|
+
}
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// Map vertex position to lattice local coordinates
|
|
182
|
+
const localPos = this._localPos.set((vertex.x - min.x) / this._cellSize.x, (vertex.y - min.y) / this._cellSize.y, (vertex.z - min.z) / this._cellSize.z);
|
|
183
|
+
// Get integer lattice indices
|
|
184
|
+
const i0 = Math.floor(localPos.x);
|
|
185
|
+
const j0 = Math.floor(localPos.y);
|
|
186
|
+
const k0 = Math.floor(localPos.z);
|
|
187
|
+
const i1 = Math.min(i0 + 1, nx - 1);
|
|
188
|
+
const j1 = Math.min(j0 + 1, ny - 1);
|
|
189
|
+
const k1 = Math.min(k0 + 1, nz - 1);
|
|
190
|
+
// Compute interpolation weights
|
|
191
|
+
const tx = localPos.x - i0;
|
|
192
|
+
const ty = localPos.y - j0;
|
|
193
|
+
const tz = localPos.z - k0;
|
|
194
|
+
// Ensure indices are within bounds
|
|
195
|
+
const ii0 = Clamp(i0, 0, nx - 1);
|
|
196
|
+
const jj0 = Clamp(j0, 0, ny - 1);
|
|
197
|
+
const kk0 = Clamp(k0, 0, nz - 1);
|
|
198
|
+
const ii1 = Clamp(i1, 0, nx - 1);
|
|
199
|
+
const jj1 = Clamp(j1, 0, ny - 1);
|
|
200
|
+
const kk1 = Clamp(k1, 0, nz - 1);
|
|
201
|
+
// Get lattice control points
|
|
202
|
+
const p000 = this._data[ii0][jj0][kk0];
|
|
203
|
+
const p100 = this._data[ii1][jj0][kk0];
|
|
204
|
+
const p010 = this._data[ii0][jj1][kk0];
|
|
205
|
+
const p110 = this._data[ii1][jj1][kk0];
|
|
206
|
+
const p001 = this._data[ii0][jj0][kk1];
|
|
207
|
+
const p101 = this._data[ii1][jj0][kk1];
|
|
208
|
+
const p011 = this._data[ii0][jj1][kk1];
|
|
209
|
+
const p111 = this._data[ii1][jj1][kk1];
|
|
210
|
+
// Trilinear interpolation
|
|
211
|
+
const p00 = Vector3.LerpToRef(p000, p100, tx, this._lerpVector0);
|
|
212
|
+
const p01 = Vector3.LerpToRef(p001, p101, tx, this._lerpVector1);
|
|
213
|
+
const p10 = Vector3.LerpToRef(p010, p110, tx, this._lerpVector2);
|
|
214
|
+
const p11 = Vector3.LerpToRef(p011, p111, tx, this._lerpVector3);
|
|
215
|
+
const p0 = Vector3.LerpToRef(p00, p10, ty, this._lerpVector4);
|
|
216
|
+
const p1 = Vector3.LerpToRef(p01, p11, ty, this._lerpVector5);
|
|
217
|
+
const deformedPos = Vector3.LerpToRef(p0, p1, tz, this._lerpVector0);
|
|
218
|
+
deformedPos.addInPlace(this.position);
|
|
219
|
+
// Apply deformation to the vertex
|
|
220
|
+
deformedPos.toArray(target || positions, i);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=lattice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/lattice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gCAA+B;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,0CAAyC;AAoBzD;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAsBhB;;OAEG;IACI,YAAY;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,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AE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAEjE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC9D,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAE9D,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACrE,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEtC,kCAAkC;YAClC,WAAW,CAAC,OAAO,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC;SAC/C;IACL,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"./mesh\";\r\nimport type { FloatArray } from \"core/types\";\r\nimport { VertexBuffer } from \"./buffer\";\r\nimport { Clamp } from \"core/Maths/math.scalar.functions\";\r\n\r\n/**\r\n * Interface used to define options for creating a lattice\r\n */\r\nexport interface ILatticeOptions {\r\n /** resolution on x axis */\r\n resolutionX: number;\r\n /** resolution on y axis */\r\n resolutionY: number;\r\n /** resolution on z axis */\r\n resolutionZ: number;\r\n /** the lattice position in object space */\r\n position: Vector3;\r\n /** size of the lattice along each axis in object space */\r\n size: Vector3;\r\n /** Optional mesh to adapt the size to */\r\n autoAdaptToMesh?: Mesh;\r\n}\r\n\r\n/**\r\n * Class used to represent a lattice\r\n * #MDVD75#18 - Moving lattice bounds\r\n * #MDVD75#23 - Twist\r\n */\r\nexport class Lattice {\r\n private _resolutionX: number;\r\n private _resolutionY: number;\r\n private _resolutionZ: number;\r\n private _position: Vector3;\r\n private _size: Vector3;\r\n private _cellSize = new Vector3();\r\n\r\n private _data: Vector3[][][];\r\n\r\n // Cache\r\n private _min = new Vector3(-0.5, -0.5, -0.5);\r\n private _max = new Vector3(0.5, 0.5, 0.5);\r\n private _localPos = new Vector3();\r\n private _tmpVector = new Vector3();\r\n private _lerpVector0 = new Vector3();\r\n private _lerpVector1 = new Vector3();\r\n private _lerpVector2 = new Vector3();\r\n private _lerpVector3 = new Vector3();\r\n private _lerpVector4 = new Vector3();\r\n private _lerpVector5 = new Vector3();\r\n\r\n /**\r\n * @returns the string \"Lattice\"\r\n */\r\n public getClassName(): string {\r\n return \"Lattice\";\r\n }\r\n\r\n /**\r\n * Gets the resolution on x axis\r\n */\r\n public get resolutionX(): number {\r\n return this._resolutionX;\r\n }\r\n\r\n /**\r\n * Gets the resolution on y axis\r\n */\r\n public get resolutionY(): number {\r\n return this._resolutionY;\r\n }\r\n\r\n /**\r\n * Gets the resolution on z axis\r\n */\r\n public get resolutionZ(): number {\r\n return this._resolutionZ;\r\n }\r\n\r\n /**\r\n * Gets the size of the lattice along each axis in object space\r\n * Updating the size requires you to call update afterwards\r\n */\r\n public get size(): Vector3 {\r\n return this._size;\r\n }\r\n\r\n /**\r\n * Gets the lattice position in object space\r\n */\r\n public get position(): Vector3 {\r\n return this._position;\r\n }\r\n\r\n /**\r\n * Gets the data of the lattice\r\n */\r\n public get data(): Vector3[][][] {\r\n return this._data;\r\n }\r\n\r\n /**\r\n * Gets the size of each cell in the lattice\r\n */\r\n public get cellSize(): Vector3 {\r\n return this._cellSize;\r\n }\r\n\r\n /**\r\n * Gets the min bounds of the lattice\r\n */\r\n public get min(): Vector3 {\r\n return this._min;\r\n }\r\n\r\n /**\r\n * Gets the max bounds of the lattice\r\n */\r\n public get max(): Vector3 {\r\n return this._max;\r\n }\r\n\r\n /**\r\n * Creates a new Lattice\r\n * @param options options for creating\r\n */\r\n public constructor(options?: Partial<ILatticeOptions>) {\r\n const localOptions: ILatticeOptions = {\r\n resolutionX: 3,\r\n resolutionY: 3,\r\n resolutionZ: 3,\r\n position: Vector3.Zero(),\r\n size: Vector3.One(),\r\n ...options,\r\n };\r\n\r\n this._resolutionX = localOptions.resolutionX;\r\n this._resolutionY = localOptions.resolutionY;\r\n this._resolutionZ = localOptions.resolutionZ;\r\n this._position = localOptions.position;\r\n this._size = localOptions.autoAdaptToMesh ? localOptions.autoAdaptToMesh.getBoundingInfo().boundingBox.extendSize.scale(2) : localOptions.size;\r\n\r\n // Allocate data\r\n this._allocateData();\r\n this.update();\r\n }\r\n\r\n private _allocateData() {\r\n this._data = new Array<Array<Array<Vector3>>>(this.resolutionX);\r\n for (let i = 0; i < this.resolutionX; i++) {\r\n this._data[i] = new Array<Array<Vector3>>(this.resolutionY);\r\n for (let j = 0; j < this.resolutionY; j++) {\r\n this._data[i][j] = new Array<Vector3>(this.resolutionZ);\r\n for (let k = 0; k < this.resolutionZ; k++) {\r\n this._data[i][j][k] = Vector3.Zero();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update of the lattice data\r\n */\r\n public update() {\r\n for (let i = 0; i < this.resolutionX; i++) {\r\n for (let j = 0; j < this.resolutionY; j++) {\r\n for (let k = 0; k < this.resolutionZ; k++) {\r\n const x = -this.size.x / 2 + this.size.x * (i / (this.resolutionX - 1));\r\n const y = -this.size.y / 2 + this.size.y * (j / (this.resolutionY - 1));\r\n const z = -this.size.z / 2 + this.size.z * (k / (this.resolutionZ - 1));\r\n\r\n this._data[i][j][k].set(x, y, z);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Apply the lattice to a mesh\r\n * @param mesh mesh to deform\r\n */\r\n public deformMesh(mesh: Mesh) {\r\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!positions) {\r\n return;\r\n }\r\n\r\n // Apply the lattice\r\n this.deform(positions);\r\n\r\n // Update back the mesh\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positions, true);\r\n }\r\n\r\n /**\r\n * Update the lattice internals (like min, max and cell size)\r\n */\r\n public updateInternals() {\r\n const nx = this._resolutionX;\r\n const ny = this._resolutionY;\r\n const nz = this._resolutionZ;\r\n\r\n // Calculate the size of each cell in the lattice\r\n this._cellSize.set(this.size.x / (nx - 1), this.size.y / (ny - 1), this.size.z / (nz - 1));\r\n\r\n // Calculate the lattice bounds\r\n this._min.set(this.position.x - this.size.x / 2, this.position.y - this.size.y / 2, this.position.z - this.size.z / 2);\r\n this._min.addToRef(this._size, this._max);\r\n }\r\n\r\n /**\r\n * Apply the lattice to a set of points\r\n * @param positions vertex data to deform\r\n * @param target optional target array to store the result (operation will be done in place in not defined)\r\n */\r\n public deform(positions: FloatArray, target?: FloatArray) {\r\n const nx = this._resolutionX;\r\n const ny = this._resolutionY;\r\n const nz = this._resolutionZ;\r\n\r\n this.updateInternals();\r\n\r\n const min = this._min;\r\n const max = this._max;\r\n\r\n // Loop over each vertex\r\n for (let i = 0; i < positions.length; i += 3) {\r\n const vertex = this._tmpVector.fromArray(positions, i);\r\n\r\n // Check we are inside\r\n if (vertex.x < min.x || vertex.x > max.x || vertex.y < min.y || vertex.y > max.y || vertex.z < min.z || vertex.z > max.z) {\r\n if (target) {\r\n vertex.toArray(target, i);\r\n }\r\n continue;\r\n }\r\n\r\n // Map vertex position to lattice local coordinates\r\n const localPos = this._localPos.set((vertex.x - min.x) / this._cellSize.x, (vertex.y - min.y) / this._cellSize.y, (vertex.z - min.z) / this._cellSize.z);\r\n\r\n // Get integer lattice indices\r\n const i0 = Math.floor(localPos.x);\r\n const j0 = Math.floor(localPos.y);\r\n const k0 = Math.floor(localPos.z);\r\n\r\n const i1 = Math.min(i0 + 1, nx - 1);\r\n const j1 = Math.min(j0 + 1, ny - 1);\r\n const k1 = Math.min(k0 + 1, nz - 1);\r\n\r\n // Compute interpolation weights\r\n const tx = localPos.x - i0;\r\n const ty = localPos.y - j0;\r\n const tz = localPos.z - k0;\r\n\r\n // Ensure indices are within bounds\r\n const ii0 = Clamp(i0, 0, nx - 1);\r\n const jj0 = Clamp(j0, 0, ny - 1);\r\n const kk0 = Clamp(k0, 0, nz - 1);\r\n const ii1 = Clamp(i1, 0, nx - 1);\r\n const jj1 = Clamp(j1, 0, ny - 1);\r\n const kk1 = Clamp(k1, 0, nz - 1);\r\n\r\n // Get lattice control points\r\n const p000 = this._data[ii0][jj0][kk0];\r\n const p100 = this._data[ii1][jj0][kk0];\r\n const p010 = this._data[ii0][jj1][kk0];\r\n const p110 = this._data[ii1][jj1][kk0];\r\n const p001 = this._data[ii0][jj0][kk1];\r\n const p101 = this._data[ii1][jj0][kk1];\r\n const p011 = this._data[ii0][jj1][kk1];\r\n const p111 = this._data[ii1][jj1][kk1];\r\n\r\n // Trilinear interpolation\r\n const p00 = Vector3.LerpToRef(p000, p100, tx, this._lerpVector0);\r\n const p01 = Vector3.LerpToRef(p001, p101, tx, this._lerpVector1);\r\n const p10 = Vector3.LerpToRef(p010, p110, tx, this._lerpVector2);\r\n const p11 = Vector3.LerpToRef(p011, p111, tx, this._lerpVector3);\r\n\r\n const p0 = Vector3.LerpToRef(p00, p10, ty, this._lerpVector4);\r\n const p1 = Vector3.LerpToRef(p01, p11, ty, this._lerpVector5);\r\n\r\n const deformedPos = Vector3.LerpToRef(p0, p1, tz, this._lerpVector0);\r\n deformedPos.addInPlace(this.position);\r\n\r\n // Apply deformation to the vertex\r\n deformedPos.toArray(target || positions, i);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Material } from "../Materials/material.js";
|
|
2
|
+
import { MaterialPluginBase } from "../Materials/materialPluginBase.js";
|
|
3
|
+
import type { Lattice } from "./lattice";
|
|
4
|
+
import { ShaderLanguage } from "../Materials/shaderLanguage.js";
|
|
5
|
+
import type { UniformBuffer } from "../Materials/uniformBuffer.js";
|
|
6
|
+
/**
|
|
7
|
+
* Material plugin to add hardware accelerated lattice support
|
|
8
|
+
* #HBZD72#5 - webgl2
|
|
9
|
+
* #HBZD72#6 - webgpu
|
|
10
|
+
*/
|
|
11
|
+
export declare class LatticePluginMaterial extends MaterialPluginBase {
|
|
12
|
+
private _lattice;
|
|
13
|
+
private _latticeDataTexture;
|
|
14
|
+
private _latticeData;
|
|
15
|
+
private _code;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new LatticePluginMaterial
|
|
18
|
+
* @param lattice defines the lattice this plugin is associated with
|
|
19
|
+
* @param material defines the material this plugin is associated with
|
|
20
|
+
*/
|
|
21
|
+
constructor(lattice: Lattice, material: Material);
|
|
22
|
+
/**
|
|
23
|
+
* Get the class name of the plugin
|
|
24
|
+
* @returns the string "LatticePluginMaterial"
|
|
25
|
+
*/
|
|
26
|
+
getClassName(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Defines if the plugin supports the specified shader language
|
|
29
|
+
* @param shaderLanguage defines the shader language to check
|
|
30
|
+
* @returns true if supported, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
isCompatible(shaderLanguage: ShaderLanguage): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Must be called when the lattice data was updated
|
|
35
|
+
*/
|
|
36
|
+
refreshData(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the description of the uniforms to add to the ubo (if engine supports ubos) or to inject directly in the vertex/fragment shaders (if engine does not support ubos)
|
|
39
|
+
* @param shaderLanguage The shader language to use.
|
|
40
|
+
* @returns the description of the uniforms
|
|
41
|
+
*/
|
|
42
|
+
getUniforms(shaderLanguage: ShaderLanguage): {
|
|
43
|
+
ubo: {
|
|
44
|
+
name: string;
|
|
45
|
+
size: number;
|
|
46
|
+
type: string;
|
|
47
|
+
}[];
|
|
48
|
+
vertex?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
ubo: {
|
|
51
|
+
name: string;
|
|
52
|
+
size: number;
|
|
53
|
+
type: string;
|
|
54
|
+
}[];
|
|
55
|
+
vertex: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Binds the material data.
|
|
59
|
+
* @param uniformBuffer defines the Uniform buffer to fill in.
|
|
60
|
+
*/
|
|
61
|
+
bindForSubMesh(uniformBuffer: UniformBuffer): void;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the samplers used by the plugin.
|
|
64
|
+
* @param samplers list that the sampler names should be added to.
|
|
65
|
+
*/
|
|
66
|
+
getSamplers(samplers: string[]): void;
|
|
67
|
+
private _prepareCode;
|
|
68
|
+
/**
|
|
69
|
+
* Returns a list of custom shader code fragments to customize the shader.
|
|
70
|
+
* @param shaderType "vertex" or "fragment"
|
|
71
|
+
* @param shaderLanguage The shader language to use.
|
|
72
|
+
* @returns null if no code to be added, or a list of pointName =\> code.
|
|
73
|
+
*/
|
|
74
|
+
getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): {
|
|
75
|
+
CUSTOM_VERTEX_DEFINITIONS: string;
|
|
76
|
+
CUSTOM_VERTEX_UPDATE_POSITION: string;
|
|
77
|
+
} | null;
|
|
78
|
+
/**
|
|
79
|
+
* Disposes the resources of the material.
|
|
80
|
+
*/
|
|
81
|
+
dispose(): void;
|
|
82
|
+
}
|