@babylonjs/core 6.43.0 → 6.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animatable.js +2 -2
- package/Animations/animatable.js.map +1 -1
- package/Animations/animationGroup.d.ts +4 -2
- package/Animations/animationGroup.js +22 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Buffers/buffer.d.ts +22 -22
- package/Buffers/buffer.js +16 -15
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/camera.d.ts +5 -5
- package/Cameras/camera.js +19 -19
- package/Cameras/camera.js.map +1 -1
- package/Culling/ray.d.ts +12 -1
- package/Culling/ray.js +20 -3
- package/Culling/ray.js.map +1 -1
- package/Debug/skeletonViewer.d.ts +2 -0
- package/Debug/skeletonViewer.js +111 -50
- package/Debug/skeletonViewer.js.map +1 -1
- package/Engines/ICanvas.d.ts +2 -1
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/constants.d.ts +96 -0
- package/Engines/constants.js +96 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +14 -3
- package/Engines/engine.js +11 -0
- package/Engines/engine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -0
- package/Engines/nullEngine.js +3 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +4 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Gizmos/gizmo.d.ts +14 -0
- package/Gizmos/gizmo.js +16 -0
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +12 -0
- package/Gizmos/gizmoManager.js +26 -0
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +16 -2
- package/Gizmos/positionGizmo.js +12 -2
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +8 -0
- package/Gizmos/rotationGizmo.js +9 -0
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +15 -1
- package/Gizmos/scaleGizmo.js +11 -1
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +2 -2
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +4 -4
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +5 -5
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +16 -16
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +8 -8
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +2 -2
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +6 -6
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +7 -7
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +50 -0
- package/Materials/Node/nodeMaterial.js +53 -3
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +3 -3
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +41 -41
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +10 -10
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +6 -6
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +6 -6
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +7 -7
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/dynamicTexture.js +1 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/texture.js +1 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/material.decalMapConfiguration.js +3 -3
- package/Materials/material.decalMapConfiguration.js.map +1 -1
- package/Materials/material.detailMapConfiguration.js +3 -3
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +2 -2
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.d.ts +1 -4
- package/Materials/materialHelper.functions.d.ts +275 -0
- package/Materials/materialHelper.functions.js +823 -0
- package/Materials/materialHelper.functions.js.map +1 -0
- package/Materials/materialHelper.js +64 -589
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +1 -1
- package/Materials/materialPluginBase.js +1 -1
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/shaderMaterial.js +8 -8
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +33 -33
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +23 -2
- package/Meshes/Compression/dracoCompression.js +76 -236
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.d.ts +44 -0
- package/Meshes/Compression/dracoCompressionWorker.js +189 -0
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +4 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/Node/Blocks/geometryDistanceBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryDistanceBlock.js +63 -0
- package/Meshes/Node/Blocks/geometryDistanceBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryDotBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryDotBlock.js +63 -0
- package/Meshes/Node/Blocks/geometryDotBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryLengthBlock.d.ts +26 -0
- package/Meshes/Node/Blocks/geometryLengthBlock.js +52 -0
- package/Meshes/Node/Blocks/geometryLengthBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryPosterizeBlock.d.ts +31 -0
- package/Meshes/Node/Blocks/geometryPosterizeBlock.js +63 -0
- package/Meshes/Node/Blocks/geometryPosterizeBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.d.ts +38 -0
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +88 -0
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryRotate2dBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js +59 -0
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +6 -0
- package/Meshes/Node/index.js +6 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/trailMesh.js +1 -1
- package/Meshes/trailMesh.js.map +1 -1
- package/Misc/basis.d.ts +6 -1
- package/Misc/basis.js +11 -231
- package/Misc/basis.js.map +1 -1
- package/Misc/basisWorker.d.ts +13 -0
- package/Misc/basisWorker.js +249 -0
- package/Misc/basisWorker.js.map +1 -0
- package/Misc/khronosTextureContainer2.d.ts +25 -3
- package/Misc/khronosTextureContainer2.js +35 -106
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/khronosTextureContainer2Worker.d.ts +12 -0
- package/Misc/khronosTextureContainer2Worker.js +136 -0
- package/Misc/khronosTextureContainer2Worker.js.map +1 -0
- package/Navigation/Plugins/recastJSPlugin.d.ts +1 -1
- package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
- package/Particles/gpuParticleSystem.js +3 -3
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +7 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +8 -0
- package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +7 -1
- package/Physics/v2/Plugins/havokPlugin.js +19 -1
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +2 -2
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/depthRenderer.js +4 -4
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +5 -5
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +4 -4
- package/Rendering/outlineRenderer.js.map +1 -1
- package/XR/features/Layers/WebXRCompositionLayer.d.ts +48 -0
- package/XR/features/Layers/WebXRCompositionLayer.js +94 -0
- package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -0
- package/XR/features/Layers/WebXRProjectionLayer.d.ts +10 -0
- package/XR/features/Layers/WebXRProjectionLayer.js +51 -0
- package/XR/features/Layers/WebXRProjectionLayer.js.map +1 -0
- package/XR/features/WebXRControllerPointerSelection.js +4 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +11 -10
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +7 -1
- package/XR/features/WebXRHandTracking.js +28 -26
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLayers.d.ts +44 -26
- package/XR/features/WebXRLayers.js +204 -153
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +16 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/webXRCamera.js +10 -0
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +9 -0
- package/XR/webXRDefaultExperience.js +8 -0
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRExperienceHelper.js +1 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +8 -2
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRLayerWrapper.d.ts +12 -3
- package/XR/webXRLayerWrapper.js +18 -2
- package/XR/webXRLayerWrapper.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +0 -5
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +9 -1
- package/XR/webXRSessionManager.js +24 -5
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +13 -5
- package/scene.js +4 -4
- package/scene.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryLengthBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryLengthBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD;;;OAG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NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to get the length of a vector\r\n */\r\nexport class GeometryLengthBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryLengthBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Float);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryLengthBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n return value.length();\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryLengthBlock\", GeometryLengthBlock);\r\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to posterize a value
|
|
5
|
+
* @see https://en.wikipedia.org/wiki/Posterization
|
|
6
|
+
*/
|
|
7
|
+
export declare class GeometryPosterizeBlock extends NodeGeometryBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new GeometryPosterizeBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
/**
|
|
14
|
+
* Gets the current class name
|
|
15
|
+
* @returns the class name
|
|
16
|
+
*/
|
|
17
|
+
getClassName(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the value input component
|
|
20
|
+
*/
|
|
21
|
+
get value(): NodeGeometryConnectionPoint;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the steps input component
|
|
24
|
+
*/
|
|
25
|
+
get steps(): NodeGeometryConnectionPoint;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the output component
|
|
28
|
+
*/
|
|
29
|
+
get output(): NodeGeometryConnectionPoint;
|
|
30
|
+
protected _buildBlock(): this | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
2
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
3
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to posterize a value
|
|
6
|
+
* @see https://en.wikipedia.org/wiki/Posterization
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryPosterizeBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryPosterizeBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("steps", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
18
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
19
|
+
this._linkConnectionTypes(0, 1);
|
|
20
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
21
|
+
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets the current class name
|
|
25
|
+
* @returns the class name
|
|
26
|
+
*/
|
|
27
|
+
getClassName() {
|
|
28
|
+
return "GeometryPosterizeBlock";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the value input component
|
|
32
|
+
*/
|
|
33
|
+
get value() {
|
|
34
|
+
return this._inputs[0];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the steps input component
|
|
38
|
+
*/
|
|
39
|
+
get steps() {
|
|
40
|
+
return this._inputs[1];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the output component
|
|
44
|
+
*/
|
|
45
|
+
get output() {
|
|
46
|
+
return this._outputs[0];
|
|
47
|
+
}
|
|
48
|
+
_buildBlock() {
|
|
49
|
+
if (!this.value.isConnected || !this.steps.isConnected) {
|
|
50
|
+
this.output._storedFunction = null;
|
|
51
|
+
this.output._storedValue = null;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.output._storedFunction = (state) => {
|
|
55
|
+
const source = this.value.getConnectedValue(state);
|
|
56
|
+
const steps = this.steps.getConnectedValue(state);
|
|
57
|
+
return Math.floor((source / (1.0 / steps)) * (1.0 / steps));
|
|
58
|
+
};
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
RegisterClass("BABYLON.GeometryPosterizeBlock", GeometryPosterizeBlock);
|
|
63
|
+
//# sourceMappingURL=geometryPosterizeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAES,WAAW;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACpD,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;YAChC,OAAO;SACV;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Block used to posterize a value\r\n * @see https://en.wikipedia.org/wiki/Posterization\r\n */\r\nexport class GeometryPosterizeBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryPosterizeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"steps\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryPosterizeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the steps input component\r\n */\r\n public get steps(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected || !this.steps.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const source = this.value.getConnectedValue(state);\r\n const steps = this.steps.getConnectedValue(state);\r\n return Math.floor((source / (1.0 / steps)) * (1.0 / steps));\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryPosterizeBlock\", GeometryPosterizeBlock);\r\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to replace a color by another one
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryReplaceColorBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryReplaceColorBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the value input component
|
|
19
|
+
*/
|
|
20
|
+
get value(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the reference input component
|
|
23
|
+
*/
|
|
24
|
+
get reference(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the distance input component
|
|
27
|
+
*/
|
|
28
|
+
get distance(): NodeGeometryConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the replacement input component
|
|
31
|
+
*/
|
|
32
|
+
get replacement(): NodeGeometryConnectionPoint;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the output component
|
|
35
|
+
*/
|
|
36
|
+
get output(): NodeGeometryConnectionPoint;
|
|
37
|
+
protected _buildBlock(): this | undefined;
|
|
38
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
2
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
3
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to replace a color by another one
|
|
6
|
+
*/
|
|
7
|
+
export class GeometryReplaceColorBlock extends NodeGeometryBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new GeometryReplaceColorBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name) {
|
|
13
|
+
super(name);
|
|
14
|
+
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
15
|
+
this.registerInput("reference", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("distance", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
+
this.registerInput("replacement", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
18
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
|
+
this._linkConnectionTypes(0, 1);
|
|
21
|
+
this._linkConnectionTypes(0, 3);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
23
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
24
|
+
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
25
|
+
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
26
|
+
this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
27
|
+
this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current class name
|
|
31
|
+
* @returns the class name
|
|
32
|
+
*/
|
|
33
|
+
getClassName() {
|
|
34
|
+
return "GeometryReplaceColorBlock";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the value input component
|
|
38
|
+
*/
|
|
39
|
+
get value() {
|
|
40
|
+
return this._inputs[0];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the reference input component
|
|
44
|
+
*/
|
|
45
|
+
get reference() {
|
|
46
|
+
return this._inputs[1];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the distance input component
|
|
50
|
+
*/
|
|
51
|
+
get distance() {
|
|
52
|
+
return this._inputs[2];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Gets the replacement input component
|
|
56
|
+
*/
|
|
57
|
+
get replacement() {
|
|
58
|
+
return this._inputs[3];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the output component
|
|
62
|
+
*/
|
|
63
|
+
get output() {
|
|
64
|
+
return this._outputs[0];
|
|
65
|
+
}
|
|
66
|
+
_buildBlock() {
|
|
67
|
+
if (!this.value.isConnected || !this.reference.isConnected || !this.distance.isConnected || !this.replacement.isConnected) {
|
|
68
|
+
this.output._storedFunction = null;
|
|
69
|
+
this.output._storedValue = null;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.output._storedFunction = (state) => {
|
|
73
|
+
const value = this.value.getConnectedValue(state);
|
|
74
|
+
const reference = this.reference.getConnectedValue(state);
|
|
75
|
+
const distance = this.distance.getConnectedValue(state);
|
|
76
|
+
const replacement = this.replacement.getConnectedValue(state);
|
|
77
|
+
if (value.subtract(reference).length() < distance) {
|
|
78
|
+
return replacement;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
RegisterClass("BABYLON.GeometryReplaceColorBlock", GeometryReplaceColorBlock);
|
|
88
|
+
//# sourceMappingURL=geometryReplaceColorBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryReplaceColorBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryReplaceColorBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,yBAA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,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACxD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAE9D,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,GAAG,QAAQ,EAAE;gBAC/C,OAAO,WAAW,CAAC;aACtB;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to replace a color by another one\r\n */\r\nexport class GeometryReplaceColorBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryReplaceColorBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"reference\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"distance\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerInput(\"replacement\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n this._linkConnectionTypes(0, 3);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryReplaceColorBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the reference input component\r\n */\r\n public get reference(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the distance input component\r\n */\r\n public get distance(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the replacement input component\r\n */\r\n public get replacement(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected || !this.reference.isConnected || !this.distance.isConnected || !this.replacement.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const reference = this.reference.getConnectedValue(state);\r\n const distance = this.distance.getConnectedValue(state);\r\n const replacement = this.replacement.getConnectedValue(state);\r\n\r\n if (value.subtract(reference).length() < distance) {\r\n return replacement;\r\n } else {\r\n return value;\r\n }\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryReplaceColorBlock\", GeometryReplaceColorBlock);\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to rotate a 2d vector by a given angle
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryRotate2dBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryRotate2dBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the input vector
|
|
19
|
+
*/
|
|
20
|
+
get input(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the input angle
|
|
23
|
+
*/
|
|
24
|
+
get angle(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeGeometryConnectionPoint;
|
|
29
|
+
protected _buildBlock(): this | undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Vector2 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to rotate a 2d vector by a given angle
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryRotate2dBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryRotate2dBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("input", NodeGeometryBlockConnectionPointTypes.Vector2);
|
|
16
|
+
this.registerInput("angle", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Vector2);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the current class name
|
|
21
|
+
* @returns the class name
|
|
22
|
+
*/
|
|
23
|
+
getClassName() {
|
|
24
|
+
return "GeometryRotate2dBlock";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets the input vector
|
|
28
|
+
*/
|
|
29
|
+
get input() {
|
|
30
|
+
return this._inputs[0];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the input angle
|
|
34
|
+
*/
|
|
35
|
+
get angle() {
|
|
36
|
+
return this._inputs[1];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the output component
|
|
40
|
+
*/
|
|
41
|
+
get output() {
|
|
42
|
+
return this._outputs[0];
|
|
43
|
+
}
|
|
44
|
+
_buildBlock() {
|
|
45
|
+
if (!this.angle.isConnected || !this.input.isConnected) {
|
|
46
|
+
this.output._storedFunction = null;
|
|
47
|
+
this.output._storedValue = null;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.output._storedFunction = (state) => {
|
|
51
|
+
const input = this.input.getConnectedValue(state);
|
|
52
|
+
const angle = this.angle.getConnectedValue(state);
|
|
53
|
+
return new Vector2(Math.cos(angle) * input.x - Math.sin(angle) * input.y, Math.sin(angle) * input.x + Math.cos(angle) * input.y);
|
|
54
|
+
};
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
RegisterClass("BABYLON.GeometryRotate2dBlock", GeometryRotate2dBlock);
|
|
59
|
+
//# sourceMappingURL=geometryRotate2dBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryRotate2dBlock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AI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAY,CAAC;YAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrI,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Block used to rotate a 2d vector by a given angle\r\n */\r\nexport class GeometryRotate2dBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryRotate2dBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerInput(\"angle\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryRotate2dBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input vector\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the input angle\r\n */\r\n public get angle(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.angle.isConnected || !this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const input = this.input.getConnectedValue(state) as Vector2;\r\n const angle = this.angle.getConnectedValue(state);\r\n return new Vector2(Math.cos(angle) * input.x - Math.sin(angle) * input.y, Math.sin(angle) * input.x + Math.cos(angle) * input.y);\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryRotate2dBlock\", GeometryRotate2dBlock);\r\n"]}
|
package/Meshes/Node/index.d.ts
CHANGED
|
@@ -72,3 +72,9 @@ export * from "./Blocks/geometryClampBlock";
|
|
|
72
72
|
export * from "./Blocks/geometryCrossBlock";
|
|
73
73
|
export * from "./Blocks/geometryCurveBlock";
|
|
74
74
|
export * from "./Blocks/geometryDesaturateBlock";
|
|
75
|
+
export * from "./Blocks/geometryPosterizeBlock";
|
|
76
|
+
export * from "./Blocks/geometryReplaceColorBlock";
|
|
77
|
+
export * from "./Blocks/geometryDistanceBlock";
|
|
78
|
+
export * from "./Blocks/geometryDotBlock";
|
|
79
|
+
export * from "./Blocks/geometryLengthBlock";
|
|
80
|
+
export * from "./Blocks/geometryRotate2dBlock";
|
package/Meshes/Node/index.js
CHANGED
|
@@ -72,4 +72,10 @@ export * from "./Blocks/geometryClampBlock.js";
|
|
|
72
72
|
export * from "./Blocks/geometryCrossBlock.js";
|
|
73
73
|
export * from "./Blocks/geometryCurveBlock.js";
|
|
74
74
|
export * from "./Blocks/geometryDesaturateBlock.js";
|
|
75
|
+
export * from "./Blocks/geometryPosterizeBlock.js";
|
|
76
|
+
export * from "./Blocks/geometryReplaceColorBlock.js";
|
|
77
|
+
export * from "./Blocks/geometryDistanceBlock.js";
|
|
78
|
+
export * from "./Blocks/geometryDotBlock.js";
|
|
79
|
+
export * from "./Blocks/geometryLengthBlock.js";
|
|
80
|
+
export * from "./Blocks/geometryRotate2dBlock.js";
|
|
75
81
|
//# sourceMappingURL=index.js.map
|
package/Meshes/Node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,w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;AAC5C,cAAc,kCAAkC,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\nexport * from \"./Blocks/geometryPosterizeBlock\";\r\nexport * from \"./Blocks/geometryReplaceColorBlock\";\r\nexport * from \"./Blocks/geometryDistanceBlock\";\r\nexport * from \"./Blocks/geometryDotBlock\";\r\nexport * from \"./Blocks/geometryLengthBlock\";\r\nexport * from \"./Blocks/geometryRotate2dBlock\";\r\n"]}
|
package/Meshes/trailMesh.js
CHANGED
|
@@ -53,7 +53,7 @@ export class TrailMesh extends Mesh {
|
|
|
53
53
|
meshCenter = this._generator.getBoundingInfo().boundingBox.centerWorld;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
meshCenter = this._generator.
|
|
56
|
+
meshCenter = this._generator.absolutePosition;
|
|
57
57
|
}
|
|
58
58
|
const alpha = (2 * Math.PI) / this._sectionPolygonPointsCount;
|
|
59
59
|
for (let i = 0; i <= this._sectionPolygonPointsCount; i++) {
|
package/Meshes/trailMesh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trailMesh.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/trailMesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,IAAI,CAAC,gBAAgB,GAAG,CAAC,UAAe,EAAE,KAAY,EAAE,EAAE;IACtD,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,IAAI;IAe/B;;;;;;;;OAQG;IACH,YAAY,IAAY,EAAE,SAAwB,EAAE,KAAa,EAAE,WAAmB,CAAC,EAAE,SAAiB,EAAE,EAAE,YAAqB,IAAI;QACnI,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAff,+BAA0B,GAAW,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AC;IAED;;;OAGG;IACI,SAAS,CAAC,mBAAwB;QACrC,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAErC,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,UAAe,EAAE,KAAY;QAC7C,MAAM,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAE1H,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;SACvF;QAED,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACpJ,CAAC;CACJ","sourcesContent":["import { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\n\r\nMesh._TrailMeshParser = (parsedMesh: any, scene: Scene) => {\r\n return TrailMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * Class used to create a trail following a mesh\r\n */\r\nexport class TrailMesh extends Mesh {\r\n /**\r\n * The diameter of the trail, i.e. the width of the ribbon.\r\n */\r\n public diameter: number;\r\n\r\n private _generator: TransformNode;\r\n private _autoStart: boolean;\r\n private _running: boolean;\r\n private _length: number;\r\n private _sectionPolygonPointsCount: number = 4;\r\n private _sectionVectors: Array<Vector3>;\r\n private _sectionNormalVectors: Array<Vector3>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n\r\n /**\r\n * Creates a new TrailMesh.\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param generator The mesh or transform node to generate a trail.\r\n * @param scene The scene to add this mesh to.\r\n * @param diameter Diameter of trailing mesh. Default is 1.\r\n * @param length Length of trailing mesh. Default is 60.\r\n * @param autoStart Automatically start trailing mesh. Default true.\r\n */\r\n constructor(name: string, generator: TransformNode, scene?: Scene, diameter: number = 1, length: number = 60, autoStart: boolean = true) {\r\n super(name, scene);\r\n\r\n this._running = false;\r\n this._autoStart = autoStart;\r\n this._generator = generator;\r\n this.diameter = diameter;\r\n this._length = length;\r\n this._sectionVectors = [];\r\n this._sectionNormalVectors = [];\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n this._sectionVectors[i] = Vector3.Zero();\r\n this._sectionNormalVectors[i] = Vector3.Zero();\r\n }\r\n this._createMesh();\r\n }\r\n\r\n /**\r\n * \"TrailMesh\"\r\n * @returns \"TrailMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"TrailMesh\";\r\n }\r\n\r\n private _createMesh(): void {\r\n const data: VertexData = new VertexData();\r\n const positions: Array<number> = [];\r\n const normals: Array<number> = [];\r\n const indices: Array<number> = [];\r\n const uvs: Array<number> = [];\r\n let meshCenter = Vector3.Zero();\r\n if (this._generator instanceof AbstractMesh && this._generator.hasBoundingInfo) {\r\n meshCenter = this._generator.getBoundingInfo().boundingBox.centerWorld;\r\n } else {\r\n meshCenter = this._generator.position;\r\n }\r\n const alpha: number = (2 * Math.PI) / this._sectionPolygonPointsCount;\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n const angle = i !== this._sectionPolygonPointsCount ? i * alpha : 0;\r\n positions.push(meshCenter.x + Math.cos(angle) * this.diameter, meshCenter.y + Math.sin(angle) * this.diameter, meshCenter.z);\r\n uvs.push(i / this._sectionPolygonPointsCount, 0);\r\n }\r\n for (let i: number = 1; i <= this._length; i++) {\r\n for (let j: number = 0; j <= this._sectionPolygonPointsCount; j++) {\r\n const angle = j !== this._sectionPolygonPointsCount ? j * alpha : 0;\r\n positions.push(meshCenter.x + Math.cos(angle) * this.diameter, meshCenter.y + Math.sin(angle) * this.diameter, meshCenter.z);\r\n uvs.push(j / this._sectionPolygonPointsCount, i / this._length);\r\n }\r\n const l: number = positions.length / 3 - 2 * (this._sectionPolygonPointsCount + 1);\r\n for (let j: number = 0; j <= this._sectionPolygonPointsCount; j++) {\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount, l + j + this._sectionPolygonPointsCount + 1);\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount + 1, l + j + 1);\r\n }\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n data.positions = positions;\r\n data.normals = normals;\r\n data.indices = indices;\r\n data.uvs = uvs;\r\n data.applyToMesh(this, true);\r\n if (this._autoStart) {\r\n this.start();\r\n }\r\n }\r\n\r\n /**\r\n * Start trailing mesh.\r\n */\r\n public start(): void {\r\n if (!this._running) {\r\n this._running = true;\r\n this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(() => {\r\n this.update();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stop trailing mesh.\r\n */\r\n public stop(): void {\r\n if (this._beforeRenderObserver && this._running) {\r\n this._running = false;\r\n this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Update trailing mesh geometry.\r\n */\r\n public update(): void {\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n const wm = this._generator.getWorldMatrix();\r\n if (positions && normals) {\r\n for (let i: number = 3 * (this._sectionPolygonPointsCount + 1); i < positions.length; i++) {\r\n positions[i - 3 * (this._sectionPolygonPointsCount + 1)] = positions[i] - (normals[i] / this._length) * this.diameter;\r\n }\r\n for (let i: number = 3 * (this._sectionPolygonPointsCount + 1); i < normals.length; i++) {\r\n normals[i - 3 * (this._sectionPolygonPointsCount + 1)] = normals[i];\r\n }\r\n const l: number = positions.length - 3 * (this._sectionPolygonPointsCount + 1);\r\n const alpha: number = (2 * Math.PI) / this._sectionPolygonPointsCount;\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n const angle = i !== this._sectionPolygonPointsCount ? i * alpha : 0;\r\n this._sectionVectors[i].copyFromFloats(Math.cos(angle) * this.diameter, Math.sin(angle) * this.diameter, 0);\r\n this._sectionNormalVectors[i].copyFromFloats(Math.cos(angle), Math.sin(angle), 0);\r\n Vector3.TransformCoordinatesToRef(this._sectionVectors[i], wm, this._sectionVectors[i]);\r\n Vector3.TransformNormalToRef(this._sectionNormalVectors[i], wm, this._sectionNormalVectors[i]);\r\n }\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n positions[l + 3 * i] = this._sectionVectors[i].x;\r\n positions[l + 3 * i + 1] = this._sectionVectors[i].y;\r\n positions[l + 3 * i + 2] = this._sectionVectors[i].z;\r\n normals[l + 3 * i] = this._sectionNormalVectors[i].x;\r\n normals[l + 3 * i + 1] = this._sectionNormalVectors[i].y;\r\n normals[l + 3 * i + 2] = this._sectionNormalVectors[i].z;\r\n }\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions, true, false);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals, true, false);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a new TrailMesh object.\r\n * @param name is a string, the name given to the new mesh\r\n * @param newGenerator use new generator object for cloned trail mesh\r\n * @returns a new mesh\r\n */\r\n public clone(name: string = \"\", newGenerator: TransformNode): TrailMesh {\r\n return new TrailMesh(name, newGenerator ?? this._generator, this.getScene(), this.diameter, this._length, this._autoStart);\r\n }\r\n\r\n /**\r\n * Serializes this trail mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n\r\n serializationObject.generatorId = this._generator.id;\r\n }\r\n\r\n /**\r\n * Parses a serialized trail mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the trail mesh in\r\n * @returns the created trail mesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): TrailMesh {\r\n const generator = scene.getLastMeshById(parsedMesh.generatorId) ?? scene.getLastTransformNodeById(parsedMesh.generatorId);\r\n\r\n if (!generator) {\r\n throw new Error(\"TrailMesh: generator not found with ID \" + parsedMesh.generatorId);\r\n }\r\n\r\n return new TrailMesh(parsedMesh.name, generator, scene, parsedMesh.diameter ?? parsedMesh._diameter, parsedMesh._length, parsedMesh._autoStart);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"trailMesh.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/trailMesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,IAAI,CAAC,gBAAgB,GAAG,CAAC,UAAe,EAAE,KAAY,EAAE,EAAE;IACtD,OAAO,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,IAAI;IAe/B;;;;;;;;OAQG;IACH,YAAY,IAAY,EAAE,SAAwB,EAAE,KAAa,EAAE,WAAmB,CAAC,EAAE,SAAiB,EAAE,EAAE,YAAqB,IAAI;QACnI,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAff,+BAA0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IAC/H,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,mBAAwB;QACrC,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAErC,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,UAAe,EAAE,KAAY;QAC7C,MAAM,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAE1H,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;SACvF;QAED,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACpJ,CAAC;CACJ","sourcesContent":["import { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\n\r\nMesh._TrailMeshParser = (parsedMesh: any, scene: Scene) => {\r\n return TrailMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * Class used to create a trail following a mesh\r\n */\r\nexport class TrailMesh extends Mesh {\r\n /**\r\n * The diameter of the trail, i.e. the width of the ribbon.\r\n */\r\n public diameter: number;\r\n\r\n private _generator: TransformNode;\r\n private _autoStart: boolean;\r\n private _running: boolean;\r\n private _length: number;\r\n private _sectionPolygonPointsCount: number = 4;\r\n private _sectionVectors: Array<Vector3>;\r\n private _sectionNormalVectors: Array<Vector3>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n\r\n /**\r\n * Creates a new TrailMesh.\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param generator The mesh or transform node to generate a trail.\r\n * @param scene The scene to add this mesh to.\r\n * @param diameter Diameter of trailing mesh. Default is 1.\r\n * @param length Length of trailing mesh. Default is 60.\r\n * @param autoStart Automatically start trailing mesh. Default true.\r\n */\r\n constructor(name: string, generator: TransformNode, scene?: Scene, diameter: number = 1, length: number = 60, autoStart: boolean = true) {\r\n super(name, scene);\r\n\r\n this._running = false;\r\n this._autoStart = autoStart;\r\n this._generator = generator;\r\n this.diameter = diameter;\r\n this._length = length;\r\n this._sectionVectors = [];\r\n this._sectionNormalVectors = [];\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n this._sectionVectors[i] = Vector3.Zero();\r\n this._sectionNormalVectors[i] = Vector3.Zero();\r\n }\r\n this._createMesh();\r\n }\r\n\r\n /**\r\n * \"TrailMesh\"\r\n * @returns \"TrailMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"TrailMesh\";\r\n }\r\n\r\n private _createMesh(): void {\r\n const data: VertexData = new VertexData();\r\n const positions: Array<number> = [];\r\n const normals: Array<number> = [];\r\n const indices: Array<number> = [];\r\n const uvs: Array<number> = [];\r\n let meshCenter = Vector3.Zero();\r\n if (this._generator instanceof AbstractMesh && this._generator.hasBoundingInfo) {\r\n meshCenter = this._generator.getBoundingInfo().boundingBox.centerWorld;\r\n } else {\r\n meshCenter = this._generator.absolutePosition;\r\n }\r\n const alpha: number = (2 * Math.PI) / this._sectionPolygonPointsCount;\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n const angle = i !== this._sectionPolygonPointsCount ? i * alpha : 0;\r\n positions.push(meshCenter.x + Math.cos(angle) * this.diameter, meshCenter.y + Math.sin(angle) * this.diameter, meshCenter.z);\r\n uvs.push(i / this._sectionPolygonPointsCount, 0);\r\n }\r\n for (let i: number = 1; i <= this._length; i++) {\r\n for (let j: number = 0; j <= this._sectionPolygonPointsCount; j++) {\r\n const angle = j !== this._sectionPolygonPointsCount ? j * alpha : 0;\r\n positions.push(meshCenter.x + Math.cos(angle) * this.diameter, meshCenter.y + Math.sin(angle) * this.diameter, meshCenter.z);\r\n uvs.push(j / this._sectionPolygonPointsCount, i / this._length);\r\n }\r\n const l: number = positions.length / 3 - 2 * (this._sectionPolygonPointsCount + 1);\r\n for (let j: number = 0; j <= this._sectionPolygonPointsCount; j++) {\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount, l + j + this._sectionPolygonPointsCount + 1);\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount + 1, l + j + 1);\r\n }\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n data.positions = positions;\r\n data.normals = normals;\r\n data.indices = indices;\r\n data.uvs = uvs;\r\n data.applyToMesh(this, true);\r\n if (this._autoStart) {\r\n this.start();\r\n }\r\n }\r\n\r\n /**\r\n * Start trailing mesh.\r\n */\r\n public start(): void {\r\n if (!this._running) {\r\n this._running = true;\r\n this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(() => {\r\n this.update();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stop trailing mesh.\r\n */\r\n public stop(): void {\r\n if (this._beforeRenderObserver && this._running) {\r\n this._running = false;\r\n this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Update trailing mesh geometry.\r\n */\r\n public update(): void {\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n const wm = this._generator.getWorldMatrix();\r\n if (positions && normals) {\r\n for (let i: number = 3 * (this._sectionPolygonPointsCount + 1); i < positions.length; i++) {\r\n positions[i - 3 * (this._sectionPolygonPointsCount + 1)] = positions[i] - (normals[i] / this._length) * this.diameter;\r\n }\r\n for (let i: number = 3 * (this._sectionPolygonPointsCount + 1); i < normals.length; i++) {\r\n normals[i - 3 * (this._sectionPolygonPointsCount + 1)] = normals[i];\r\n }\r\n const l: number = positions.length - 3 * (this._sectionPolygonPointsCount + 1);\r\n const alpha: number = (2 * Math.PI) / this._sectionPolygonPointsCount;\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n const angle = i !== this._sectionPolygonPointsCount ? i * alpha : 0;\r\n this._sectionVectors[i].copyFromFloats(Math.cos(angle) * this.diameter, Math.sin(angle) * this.diameter, 0);\r\n this._sectionNormalVectors[i].copyFromFloats(Math.cos(angle), Math.sin(angle), 0);\r\n Vector3.TransformCoordinatesToRef(this._sectionVectors[i], wm, this._sectionVectors[i]);\r\n Vector3.TransformNormalToRef(this._sectionNormalVectors[i], wm, this._sectionNormalVectors[i]);\r\n }\r\n for (let i: number = 0; i <= this._sectionPolygonPointsCount; i++) {\r\n positions[l + 3 * i] = this._sectionVectors[i].x;\r\n positions[l + 3 * i + 1] = this._sectionVectors[i].y;\r\n positions[l + 3 * i + 2] = this._sectionVectors[i].z;\r\n normals[l + 3 * i] = this._sectionNormalVectors[i].x;\r\n normals[l + 3 * i + 1] = this._sectionNormalVectors[i].y;\r\n normals[l + 3 * i + 2] = this._sectionNormalVectors[i].z;\r\n }\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions, true, false);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals, true, false);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a new TrailMesh object.\r\n * @param name is a string, the name given to the new mesh\r\n * @param newGenerator use new generator object for cloned trail mesh\r\n * @returns a new mesh\r\n */\r\n public clone(name: string = \"\", newGenerator: TransformNode): TrailMesh {\r\n return new TrailMesh(name, newGenerator ?? this._generator, this.getScene(), this.diameter, this._length, this._autoStart);\r\n }\r\n\r\n /**\r\n * Serializes this trail mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n\r\n serializationObject.generatorId = this._generator.id;\r\n }\r\n\r\n /**\r\n * Parses a serialized trail mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the trail mesh in\r\n * @returns the created trail mesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): TrailMesh {\r\n const generator = scene.getLastMeshById(parsedMesh.generatorId) ?? scene.getLastTransformNodeById(parsedMesh.generatorId);\r\n\r\n if (!generator) {\r\n throw new Error(\"TrailMesh: generator not found with ID \" + parsedMesh.generatorId);\r\n }\r\n\r\n return new TrailMesh(parsedMesh.name, generator, scene, parsedMesh.diameter ?? parsedMesh._diameter, parsedMesh._length, parsedMesh._autoStart);\r\n }\r\n}\r\n"]}
|
package/Misc/basis.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Engine } from "../Engines/engine";
|
|
|
3
3
|
/**
|
|
4
4
|
* Info about the .basis files
|
|
5
5
|
*/
|
|
6
|
-
declare class BasisFileInfo {
|
|
6
|
+
export declare class BasisFileInfo {
|
|
7
7
|
/**
|
|
8
8
|
* If the file has alpha
|
|
9
9
|
*/
|
|
@@ -95,6 +95,11 @@ export declare const BasisToolsOptions: {
|
|
|
95
95
|
* @returns internal format corresponding to the Basis format
|
|
96
96
|
*/
|
|
97
97
|
export declare const GetInternalFormatFromBasisFormat: (basisFormat: number, engine: Engine) => number;
|
|
98
|
+
/**
|
|
99
|
+
* Set the worker to use for transcoding
|
|
100
|
+
* @param worker The worker that will be used for transcoding
|
|
101
|
+
*/
|
|
102
|
+
export declare const SetBasisTranscoderWorker: (worker: Worker) => void;
|
|
98
103
|
/**
|
|
99
104
|
* Transcodes a loaded image file to compressed pixel data
|
|
100
105
|
* @param data image data to transcode
|