@babylonjs/core 6.23.0 → 6.24.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/animationGroup.d.ts +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +0 -5
- package/Behaviors/Cameras/framingBehavior.js +2 -34
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Buffers/buffer.d.ts +64 -1
- package/Buffers/buffer.js +30 -23
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/storageBuffer.d.ts +3 -1
- package/Buffers/storageBuffer.js +4 -2
- package/Buffers/storageBuffer.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +4 -0
- package/Cameras/arcRotateCamera.js +22 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +4 -4
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Debug/physicsViewer.js +4 -4
- package/Debug/physicsViewer.js.map +1 -1
- package/Debug/rayHelper.js +1 -1
- package/Debug/rayHelper.js.map +1 -1
- package/Engines/Extensions/engine.storageBuffer.d.ts +2 -1
- package/Engines/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/Extensions/engine.uniformBuffer.d.ts +4 -2
- package/Engines/Extensions/engine.uniformBuffer.js +2 -2
- package/Engines/Extensions/engine.uniformBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +2 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +3 -3
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.uniformBuffer.js +5 -5
- package/Engines/WebGPU/Extensions/engine.uniformBuffer.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.d.ts +3 -2
- package/Engines/WebGPU/webgpuBufferManager.js +16 -3
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +2 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +61 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +3 -0
- package/Engines/WebGPU/webgpuPipelineContext.js +1 -0
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessor.js +5 -0
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +11 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +32 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +5 -3
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +5 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +7 -3
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +9 -4
- package/Engines/webgpuEngine.js +16 -11
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/flowGraph.js +1 -1
- package/FlowGraph/flowGraph.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +21 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -0
- package/Materials/Textures/texture.js +8 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +4 -0
- package/Materials/Textures/videoTexture.js +21 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.d.ts +8 -3
- package/Materials/effect.js +25 -19
- package/Materials/effect.js.map +1 -1
- package/Materials/material.js +8 -6
- package/Materials/material.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +1 -1
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +1 -0
- package/Materials/uniformBuffer.js +9 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +66 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +100 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBlock.d.ts +5 -30
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js +2 -52
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.d.ts +31 -0
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js +101 -0
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.d.ts +43 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js +139 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +2 -0
- package/Meshes/Node/index.js +2 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/geometry.js +8 -2
- package/Meshes/geometry.js.map +1 -1
- package/Misc/videoRecorder.js +3 -3
- package/Misc/videoRecorder.js.map +1 -1
- package/Physics/physicsHelper.js +3 -3
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +64 -56
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +4 -4
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +1 -0
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.d.ts +2 -0
- package/XR/features/WebXRSpaceWarp.js +6 -1
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/webXRSessionManager.js +1 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +4 -4
- package/scene.js.map +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometryExecutionContext";
|
|
4
|
+
import type { VertexData } from "../../../mesh.vertexData";
|
|
5
|
+
import type { INodeGeometryInstancingContext } from "../../Interfaces/nodeGeometryInstancingContext";
|
|
6
|
+
/**
|
|
7
|
+
* Block used as a base for InstantiateXXX blocks
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class InstantiateBaseBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {
|
|
10
|
+
protected _vertexData: VertexData;
|
|
11
|
+
protected _currentIndex: number;
|
|
12
|
+
/**
|
|
13
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
14
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
15
|
+
*/
|
|
16
|
+
evaluateContext: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new InstantiateBaseBlock
|
|
19
|
+
* @param name defines the block name
|
|
20
|
+
*/
|
|
21
|
+
constructor(name: string);
|
|
22
|
+
/**
|
|
23
|
+
* Gets the current instance index in the current flow
|
|
24
|
+
* @returns the current index
|
|
25
|
+
*/
|
|
26
|
+
getInstanceIndex(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the current index in the current flow
|
|
29
|
+
* @returns the current index
|
|
30
|
+
*/
|
|
31
|
+
getExecutionIndex(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the current loop index in the current flow
|
|
34
|
+
* @returns the current loop index
|
|
35
|
+
*/
|
|
36
|
+
getExecutionLoopIndex(): number;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the current face index in the current flow
|
|
39
|
+
* @returns the current face index
|
|
40
|
+
*/
|
|
41
|
+
getExecutionFaceIndex(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the current class name
|
|
44
|
+
* @returns the class name
|
|
45
|
+
*/
|
|
46
|
+
getClassName(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the instance input component
|
|
49
|
+
*/
|
|
50
|
+
get instance(): NodeGeometryConnectionPoint;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the count input component
|
|
53
|
+
*/
|
|
54
|
+
get count(): NodeGeometryConnectionPoint;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the geometry output component
|
|
57
|
+
*/
|
|
58
|
+
get output(): NodeGeometryConnectionPoint;
|
|
59
|
+
protected _dumpPropertiesCode(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Serializes this block in a JSON representation
|
|
62
|
+
* @returns the serialized block object
|
|
63
|
+
*/
|
|
64
|
+
serialize(): any;
|
|
65
|
+
_deserialize(serializationObject: any): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __decorate } from "../../../../tslib.es6.js";
|
|
2
|
+
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used as a base for InstantiateXXX blocks
|
|
7
|
+
*/
|
|
8
|
+
export class InstantiateBaseBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Create a new InstantiateBaseBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
/**
|
|
16
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
17
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
18
|
+
*/
|
|
19
|
+
this.evaluateContext = true;
|
|
20
|
+
this.registerInput("instance", NodeGeometryBlockConnectionPointTypes.Geometry, true);
|
|
21
|
+
this.registerInput("count", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
|
|
22
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current instance index in the current flow
|
|
26
|
+
* @returns the current index
|
|
27
|
+
*/
|
|
28
|
+
getInstanceIndex() {
|
|
29
|
+
return this._currentIndex;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the current index in the current flow
|
|
33
|
+
* @returns the current index
|
|
34
|
+
*/
|
|
35
|
+
getExecutionIndex() {
|
|
36
|
+
return this._currentIndex;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the current loop index in the current flow
|
|
40
|
+
* @returns the current loop index
|
|
41
|
+
*/
|
|
42
|
+
getExecutionLoopIndex() {
|
|
43
|
+
return this._currentIndex;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current face index in the current flow
|
|
47
|
+
* @returns the current face index
|
|
48
|
+
*/
|
|
49
|
+
getExecutionFaceIndex() {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the current class name
|
|
54
|
+
* @returns the class name
|
|
55
|
+
*/
|
|
56
|
+
getClassName() {
|
|
57
|
+
return "InstantiateBaseBlock";
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the instance input component
|
|
61
|
+
*/
|
|
62
|
+
get instance() {
|
|
63
|
+
return this._inputs[0];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets the count input component
|
|
67
|
+
*/
|
|
68
|
+
get count() {
|
|
69
|
+
return this._inputs[1];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the geometry output component
|
|
73
|
+
*/
|
|
74
|
+
get output() {
|
|
75
|
+
return this._outputs[0];
|
|
76
|
+
}
|
|
77
|
+
_dumpPropertiesCode() {
|
|
78
|
+
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
79
|
+
return codeString;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Serializes this block in a JSON representation
|
|
83
|
+
* @returns the serialized block object
|
|
84
|
+
*/
|
|
85
|
+
serialize() {
|
|
86
|
+
const serializationObject = super.serialize();
|
|
87
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
88
|
+
return serializationObject;
|
|
89
|
+
}
|
|
90
|
+
_deserialize(serializationObject) {
|
|
91
|
+
super._deserialize(serializationObject);
|
|
92
|
+
if (serializationObject.evaluateContext !== undefined) {
|
|
93
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
__decorate([
|
|
98
|
+
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
99
|
+
], InstantiateBaseBlock.prototype, "evaluateContext", void 0);
|
|
100
|
+
//# sourceMappingURL=instantiateBaseBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instantiateBaseBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateBaseBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAGrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gDAAsC;AAG/F;;GAEG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,iBAAiB;I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AU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY,CAAC,mBAAwB;QACxC,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE;YACnD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AApGU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;6DAC3F","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used as a base for InstantiateXXX blocks\r\n */\r\nexport abstract class InstantiateBaseBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n protected _vertexData: VertexData;\r\n protected _currentIndex: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new InstantiateBaseBlock\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(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"InstantiateBaseBlock\";\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { NodeGeometryBlock } from "../../nodeGeometryBlock";
|
|
2
1
|
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
3
2
|
import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
3
|
+
import type { VertexData } from "../../../mesh.vertexData";
|
|
4
|
+
import { InstantiateBaseBlock } from "./instantiateBaseBlock";
|
|
6
5
|
/**
|
|
7
6
|
* Block used to instantiate a geometry inside a loop
|
|
8
7
|
*/
|
|
9
|
-
export declare class InstantiateBlock extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Gets or sets a boolean indicating that this block can evaluate context
|
|
14
|
-
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
15
|
-
*/
|
|
16
|
-
evaluateContext: boolean;
|
|
8
|
+
export declare class InstantiateBlock extends InstantiateBaseBlock {
|
|
9
|
+
protected _vertexData: VertexData;
|
|
10
|
+
protected _currentIndex: number;
|
|
17
11
|
/**
|
|
18
12
|
* Create a new InstantiateBlock
|
|
19
13
|
* @param name defines the block name
|
|
@@ -44,14 +38,6 @@ export declare class InstantiateBlock extends NodeGeometryBlock implements INode
|
|
|
44
38
|
* @returns the class name
|
|
45
39
|
*/
|
|
46
40
|
getClassName(): string;
|
|
47
|
-
/**
|
|
48
|
-
* Gets the instance input component
|
|
49
|
-
*/
|
|
50
|
-
get instance(): NodeGeometryConnectionPoint;
|
|
51
|
-
/**
|
|
52
|
-
* Gets the instance input component
|
|
53
|
-
*/
|
|
54
|
-
get count(): NodeGeometryConnectionPoint;
|
|
55
41
|
/**
|
|
56
42
|
* Gets the matrix input component
|
|
57
43
|
*/
|
|
@@ -68,16 +54,5 @@ export declare class InstantiateBlock extends NodeGeometryBlock implements INode
|
|
|
68
54
|
* Gets the scaling input component
|
|
69
55
|
*/
|
|
70
56
|
get scaling(): NodeGeometryConnectionPoint;
|
|
71
|
-
/**
|
|
72
|
-
* Gets the geometry output component
|
|
73
|
-
*/
|
|
74
|
-
get output(): NodeGeometryConnectionPoint;
|
|
75
57
|
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
76
|
-
protected _dumpPropertiesCode(): string;
|
|
77
|
-
/**
|
|
78
|
-
* Serializes this block in a JSON representation
|
|
79
|
-
* @returns the serialized block object
|
|
80
|
-
*/
|
|
81
|
-
serialize(): any;
|
|
82
|
-
_deserialize(serializationObject: any): void;
|
|
83
58
|
}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
import { __decorate } from "../../../../tslib.es6.js";
|
|
2
|
-
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
3
1
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
4
2
|
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
3
|
import { Vector3 } from "../../../../Maths/math.vector.js";
|
|
6
|
-
import {
|
|
4
|
+
import { InstantiateBaseBlock } from "./instantiateBaseBlock.js";
|
|
7
5
|
/**
|
|
8
6
|
* Block used to instantiate a geometry inside a loop
|
|
9
7
|
*/
|
|
10
|
-
export class InstantiateBlock extends
|
|
8
|
+
export class InstantiateBlock extends InstantiateBaseBlock {
|
|
11
9
|
/**
|
|
12
10
|
* Create a new InstantiateBlock
|
|
13
11
|
* @param name defines the block name
|
|
14
12
|
*/
|
|
15
13
|
constructor(name) {
|
|
16
14
|
super(name);
|
|
17
|
-
/**
|
|
18
|
-
* Gets or sets a boolean indicating that this block can evaluate context
|
|
19
|
-
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
20
|
-
*/
|
|
21
|
-
this.evaluateContext = true;
|
|
22
|
-
this.registerInput("instance", NodeGeometryBlockConnectionPointTypes.Geometry, true);
|
|
23
|
-
this.registerInput("count", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
|
|
24
15
|
this.registerInput("matrix", NodeGeometryBlockConnectionPointTypes.Matrix, true);
|
|
25
16
|
this.registerInput("position", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
26
17
|
this.registerInput("rotation", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
27
18
|
this.registerInput("scaling", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());
|
|
28
19
|
this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
29
|
-
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
30
20
|
}
|
|
31
21
|
/**
|
|
32
22
|
* Gets the current instance index in the current flow
|
|
@@ -63,18 +53,6 @@ export class InstantiateBlock extends NodeGeometryBlock {
|
|
|
63
53
|
getClassName() {
|
|
64
54
|
return "InstantiateBlock";
|
|
65
55
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Gets the instance input component
|
|
68
|
-
*/
|
|
69
|
-
get instance() {
|
|
70
|
-
return this._inputs[0];
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Gets the instance input component
|
|
74
|
-
*/
|
|
75
|
-
get count() {
|
|
76
|
-
return this._inputs[1];
|
|
77
|
-
}
|
|
78
56
|
/**
|
|
79
57
|
* Gets the matrix input component
|
|
80
58
|
*/
|
|
@@ -99,12 +77,6 @@ export class InstantiateBlock extends NodeGeometryBlock {
|
|
|
99
77
|
get scaling() {
|
|
100
78
|
return this._inputs[5];
|
|
101
79
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Gets the geometry output component
|
|
104
|
-
*/
|
|
105
|
-
get output() {
|
|
106
|
-
return this._outputs[0];
|
|
107
|
-
}
|
|
108
80
|
_buildBlock(state) {
|
|
109
81
|
const func = (state) => {
|
|
110
82
|
state.pushExecutionContext(this);
|
|
@@ -155,28 +127,6 @@ export class InstantiateBlock extends NodeGeometryBlock {
|
|
|
155
127
|
this.output._storedValue = func(state);
|
|
156
128
|
}
|
|
157
129
|
}
|
|
158
|
-
_dumpPropertiesCode() {
|
|
159
|
-
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
160
|
-
return codeString;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Serializes this block in a JSON representation
|
|
164
|
-
* @returns the serialized block object
|
|
165
|
-
*/
|
|
166
|
-
serialize() {
|
|
167
|
-
const serializationObject = super.serialize();
|
|
168
|
-
serializationObject.evaluateContext = this.evaluateContext;
|
|
169
|
-
return serializationObject;
|
|
170
|
-
}
|
|
171
|
-
_deserialize(serializationObject) {
|
|
172
|
-
super._deserialize(serializationObject);
|
|
173
|
-
if (serializationObject.evaluateContext !== undefined) {
|
|
174
|
-
this.evaluateContext = serializationObject.evaluateContext;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
130
|
}
|
|
178
|
-
__decorate([
|
|
179
|
-
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
180
|
-
], InstantiateBlock.prototype, "evaluateContext", void 0);
|
|
181
131
|
RegisterClass("BABYLON.InstantiateBlock", InstantiateBlock);
|
|
182
132
|
//# sourceMappingURL=instantiateBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instantiateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EA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AC,eAAe,KAAK,SAAS,EAAE;YACnD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AA9LU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;yDAC3F;AAgMlC,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used to instantiate a geometry inside a loop\r\n */\r\nexport class InstantiateBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentIndex: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new InstantiateBlock\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(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 1);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"InstantiateBlock\";\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n // Processing\r\n const iterationCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {\r\n const instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n const clone = instanceGeometry.clone();\r\n\r\n // Transform\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithMatrix(clone, transform, additionalVertexData);\r\n } else {\r\n const position = this.position.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n state._instantiate(clone, position, rotation, scaling, additionalVertexData);\r\n }\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateBlock\", InstantiateBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"instantiateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAGrG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,oBAAoB;IAItD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,UAAU,E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K,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;iBAChF;aACJ;YAED,QAAQ;YACR,IAAI,oBAAoB,CAAC,MAAM,EAAE;gBAC7B,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE;oBACnC,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;iBAC9C;qBAAM;oBACH,sEAAsE;oBACtE,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChF;aACJ;YAED,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAChC,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,WAAW,CAAC;QAC5B,CAAC,CAAC;QAEF,UAAU;QAEV,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { InstantiateBaseBlock } from \"./instantiateBaseBlock\";\r\n\r\n/**\r\n * Block used to instantiate a geometry inside a loop\r\n */\r\nexport class InstantiateBlock extends InstantiateBaseBlock {\r\n protected _vertexData: VertexData;\r\n protected _currentIndex: number;\r\n\r\n /**\r\n * Create a new InstantiateBlock\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(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"InstantiateBlock\";\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n // Processing\r\n const iterationCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {\r\n const instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n const clone = instanceGeometry.clone();\r\n\r\n // Transform\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithMatrix(clone, transform, additionalVertexData);\r\n } else {\r\n const position = this.position.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n state._instantiate(clone, position, rotation, scaling, additionalVertexData);\r\n }\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateBlock\", InstantiateBlock);\r\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
2
|
+
import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
|
|
3
|
+
import { InstantiateBaseBlock } from "./instantiateBaseBlock";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to clone geometry along a line
|
|
6
|
+
*/
|
|
7
|
+
export declare class InstantiateLinearBlock extends InstantiateBaseBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new Instantiate Linear Block
|
|
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 direction input component
|
|
20
|
+
*/
|
|
21
|
+
get direction(): NodeGeometryConnectionPoint;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the rotation input component
|
|
24
|
+
*/
|
|
25
|
+
get rotation(): NodeGeometryConnectionPoint;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the scaling input component
|
|
28
|
+
*/
|
|
29
|
+
get scaling(): NodeGeometryConnectionPoint;
|
|
30
|
+
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
2
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
3
|
+
import { Matrix, Quaternion, Vector3 } from "../../../../Maths/math.vector.js";
|
|
4
|
+
import { InstantiateBaseBlock } from "./instantiateBaseBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to clone geometry along a line
|
|
7
|
+
*/
|
|
8
|
+
export class InstantiateLinearBlock extends InstantiateBaseBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Create a new Instantiate Linear Block
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
// Direction is magnitude per step
|
|
16
|
+
this.registerInput("direction", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(1, 0, 0));
|
|
17
|
+
// Rotation is magnitude per step
|
|
18
|
+
this.registerInput("rotation", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));
|
|
19
|
+
// Scaling is magnitude per step
|
|
20
|
+
this.registerInput("scaling", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));
|
|
21
|
+
this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets the current class name
|
|
25
|
+
* @returns the class name
|
|
26
|
+
*/
|
|
27
|
+
getClassName() {
|
|
28
|
+
return "InstantiateLinearBlock";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the direction input component
|
|
32
|
+
*/
|
|
33
|
+
get direction() {
|
|
34
|
+
return this._inputs[2];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the rotation input component
|
|
38
|
+
*/
|
|
39
|
+
get rotation() {
|
|
40
|
+
return this._inputs[3];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the scaling input component
|
|
44
|
+
*/
|
|
45
|
+
get scaling() {
|
|
46
|
+
return this._inputs[4];
|
|
47
|
+
}
|
|
48
|
+
_buildBlock(state) {
|
|
49
|
+
const func = (state) => {
|
|
50
|
+
state.pushExecutionContext(this);
|
|
51
|
+
state.pushInstancingContext(this);
|
|
52
|
+
const iterationCount = this.count.getConnectedValue(state);
|
|
53
|
+
const additionalVertexData = [];
|
|
54
|
+
const transformMatrix = Matrix.Identity();
|
|
55
|
+
const transformOffset = Vector3.Zero();
|
|
56
|
+
const rotationOffset = Vector3.Zero();
|
|
57
|
+
const scaleOffset = Vector3.Zero();
|
|
58
|
+
for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {
|
|
59
|
+
const instanceGeometry = this.instance.getConnectedValue(state);
|
|
60
|
+
if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
// Clone the instance
|
|
64
|
+
const clone = instanceGeometry.clone();
|
|
65
|
+
const direction = this.direction.getConnectedValue(state);
|
|
66
|
+
const rotation = this.rotation.getConnectedValue(state);
|
|
67
|
+
const scale = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);
|
|
68
|
+
transformOffset.copyFrom(direction.clone().scale(this._currentIndex));
|
|
69
|
+
rotationOffset.copyFrom(rotation.clone().scale(this._currentIndex));
|
|
70
|
+
scaleOffset.copyFrom(scale.clone().scale(this._currentIndex));
|
|
71
|
+
scaleOffset.addInPlaceFromFloats(1, 1, 1);
|
|
72
|
+
Matrix.ComposeToRef(scaleOffset, Quaternion.FromEulerAngles(rotationOffset.x, rotationOffset.y, rotationOffset.z), transformOffset, transformMatrix);
|
|
73
|
+
state._instantiateWithMatrix(clone, transformMatrix, additionalVertexData);
|
|
74
|
+
}
|
|
75
|
+
// Merge
|
|
76
|
+
if (additionalVertexData.length) {
|
|
77
|
+
if (additionalVertexData.length === 1) {
|
|
78
|
+
this._vertexData = additionalVertexData[0];
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// We do not merge the main one as user can use a merge node if wanted
|
|
82
|
+
const main = additionalVertexData.splice(0, 1)[0];
|
|
83
|
+
this._vertexData = main.merge(additionalVertexData, true, false, true, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
state.restoreExecutionContext();
|
|
87
|
+
state.restoreInstancingContext();
|
|
88
|
+
// Storage
|
|
89
|
+
return this._vertexData;
|
|
90
|
+
};
|
|
91
|
+
if (this.evaluateContext) {
|
|
92
|
+
this.output._storedFunction = func;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.output._storedFunction = null;
|
|
96
|
+
this.output._storedValue = func(state);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
RegisterClass("BABYLON.InstantiateLinearBlock", InstantiateLinearBlock);
|
|
101
|
+
//# sourceMappingURL=instantiateLinearBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instantiateLinearBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateLinearBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,oBAAoB;IAC5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,kCAAkC;QAClC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE3G,iCAAiC;QACjC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE1G,gCAAgC;QAChC,IAAI,CA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,CAAC,CAAC;aAC9E;YAED,QAAQ;YACR,IAAI,oBAAoB,CAAC,MAAM,EAAE;gBAC7B,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE;oBACnC,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;iBAC9C;qBAAM;oBACH,sEAAsE;oBACtE,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChF;aACJ;YAED,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAChC,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,UAAU;YACV,OAAO,IAAI,CAAC,WAAW,CAAC;QAC5B,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ;AAED,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Quaternion, Vector3 } from \"../../../../Maths/math.vector\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { InstantiateBaseBlock } from \"./instantiateBaseBlock\";\r\n\r\n/**\r\n * Block used to clone geometry along a line\r\n */\r\nexport class InstantiateLinearBlock extends InstantiateBaseBlock {\r\n /**\r\n * Create a new Instantiate Linear Block\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n // Direction is magnitude per step\r\n this.registerInput(\"direction\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(1, 0, 0));\r\n\r\n // Rotation is magnitude per step\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n\r\n // Scaling is magnitude per step\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\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 \"InstantiateLinearBlock\";\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get direction(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n const iterationCount = this.count.getConnectedValue(state) as number;\r\n\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n const transformMatrix = Matrix.Identity();\r\n const transformOffset = Vector3.Zero();\r\n const rotationOffset = Vector3.Zero();\r\n const scaleOffset = Vector3.Zero();\r\n\r\n for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {\r\n const instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n // Clone the instance\r\n const clone = instanceGeometry.clone();\r\n\r\n const direction = this.direction.getConnectedValue(state) as Vector3;\r\n const rotation = this.rotation.getConnectedValue(state) as Vector3;\r\n const scale = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n\r\n transformOffset.copyFrom(direction.clone().scale(this._currentIndex));\r\n rotationOffset.copyFrom(rotation.clone().scale(this._currentIndex));\r\n scaleOffset.copyFrom(scale.clone().scale(this._currentIndex));\r\n scaleOffset.addInPlaceFromFloats(1, 1, 1);\r\n\r\n Matrix.ComposeToRef(scaleOffset, Quaternion.FromEulerAngles(rotationOffset.x, rotationOffset.y, rotationOffset.z), transformOffset, transformMatrix);\r\n\r\n state._instantiateWithMatrix(clone, transformMatrix, additionalVertexData);\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n // Storage\r\n return this._vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateLinearBlock\", InstantiateLinearBlock);\r\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
2
|
+
import { type NodeGeometryBuildState } from "../../nodeGeometryBuildState";
|
|
3
|
+
import { InstantiateBaseBlock } from "./instantiateBaseBlock";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to clone geometry in a radial shape
|
|
6
|
+
*/
|
|
7
|
+
export declare class InstantiateRadialBlock extends InstantiateBaseBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new InstantiateRadialBlock
|
|
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 direction input component
|
|
20
|
+
*/
|
|
21
|
+
get radius(): NodeGeometryConnectionPoint;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the direction input component
|
|
24
|
+
*/
|
|
25
|
+
get angleStart(): NodeGeometryConnectionPoint;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the direction input component
|
|
28
|
+
*/
|
|
29
|
+
get angleEnd(): NodeGeometryConnectionPoint;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the transform input component
|
|
32
|
+
*/
|
|
33
|
+
get transform(): NodeGeometryConnectionPoint;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the rotation input component
|
|
36
|
+
*/
|
|
37
|
+
get rotation(): NodeGeometryConnectionPoint;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the scaling input component
|
|
40
|
+
*/
|
|
41
|
+
get scaling(): NodeGeometryConnectionPoint;
|
|
42
|
+
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
43
|
+
}
|