@babylonjs/core 6.19.0 → 6.20.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/Actions/actionManager.js +2 -2
- package/Actions/actionManager.js.map +1 -1
- package/Animations/runtimeAnimation.js +2 -2
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +4 -4
- package/Cameras/Inputs/BaseCameraPointersInput.js +4 -6
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +3 -2
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +3 -2
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +2 -7
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +2 -7
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +4 -14
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +2 -1
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +2 -7
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +2 -0
- package/Cameras/camera.js +8 -0
- package/Cameras/camera.js.map +1 -1
- package/Compute/computeShader.d.ts +15 -0
- package/Compute/computeShader.js +39 -0
- package/Compute/computeShader.js.map +1 -1
- package/Debug/physicsViewer.d.ts +33 -0
- package/Debug/physicsViewer.js +205 -0
- package/Debug/physicsViewer.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +2 -1
- package/Engines/Extensions/engine.computeShader.js +1 -0
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +15 -0
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphAddBlock.d.ts +23 -0
- package/FlowGraph/Blocks/Data/flowGraphAddBlock.js +18 -0
- package/FlowGraph/Blocks/Data/flowGraphAddBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +30 -0
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +22 -0
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +33 -0
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +30 -0
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/index.d.ts +3 -1
- package/FlowGraph/Blocks/Data/index.js +3 -1
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +12 -10
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +25 -29
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +25 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +31 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +3 -7
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +11 -11
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.d.ts +24 -0
- package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.js +23 -0
- package/FlowGraph/Blocks/Execution/flowGraphConditionalBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.d.ts +10 -13
- package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.js +28 -22
- package/FlowGraph/Blocks/Execution/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +5 -5
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +8 -6
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.d.ts +56 -0
- package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.js +66 -0
- package/FlowGraph/Blocks/Execution/flowGraphPlayAnimationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +18 -0
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +19 -0
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +26 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +36 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +23 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +25 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.d.ts +16 -0
- package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.js +18 -0
- package/FlowGraph/Blocks/Execution/flowGraphStopAnimationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.d.ts +32 -0
- package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.js +62 -0
- package/FlowGraph/Blocks/Execution/flowGraphTimerBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/index.d.ts +7 -0
- package/FlowGraph/Blocks/Execution/index.js +7 -0
- package/FlowGraph/Blocks/Execution/index.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +42 -12
- package/FlowGraph/flowGraph.js +37 -23
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +29 -0
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +21 -0
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -0
- package/FlowGraph/flowGraphBlock.d.ts +9 -11
- package/FlowGraph/flowGraphBlock.js +12 -8
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +17 -7
- package/FlowGraph/flowGraphConnection.js +26 -9
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +102 -0
- package/FlowGraph/flowGraphContext.js +111 -0
- package/FlowGraph/flowGraphContext.js.map +1 -0
- package/FlowGraph/flowGraphCustomEvent.d.ts +5 -0
- package/FlowGraph/flowGraphCustomEvent.js +2 -0
- package/FlowGraph/flowGraphCustomEvent.js.map +1 -0
- package/FlowGraph/flowGraphDataConnection.d.ts +10 -2
- package/FlowGraph/flowGraphDataConnection.js +16 -8
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +5 -12
- package/FlowGraph/flowGraphEventBlock.js +5 -5
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphEventCoordinator.d.ts +23 -0
- package/FlowGraph/flowGraphEventCoordinator.js +37 -0
- package/FlowGraph/flowGraphEventCoordinator.js.map +1 -0
- package/FlowGraph/flowGraphExecutionBlock.d.ts +5 -5
- package/FlowGraph/flowGraphExecutionBlock.js +3 -3
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +28 -0
- package/FlowGraph/flowGraphRichTypes.js +43 -0
- package/FlowGraph/flowGraphRichTypes.js.map +1 -0
- package/FlowGraph/flowGraphSignalConnection.d.ts +7 -1
- package/FlowGraph/flowGraphSignalConnection.js +11 -4
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/flowGraphVariableDefinitions.d.ts +12 -0
- package/FlowGraph/flowGraphVariableDefinitions.js +22 -0
- package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -0
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +10 -2
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +8 -2
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
- package/FlowGraph/index.d.ts +3 -0
- package/FlowGraph/index.js +3 -0
- package/FlowGraph/index.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -1
- package/Materials/Node/nodeMaterial.js +26 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +5 -0
- package/Materials/Textures/videoTexture.js +6 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/materialHelper.js +1 -0
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -0
- package/Materials/standardMaterial.js +1 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +7 -0
- package/Materials/uniformBuffer.js +8 -0
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.d.ts +5 -0
- package/Maths/math.vector.js +7 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBlock.d.ts +11 -5
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js +20 -10
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +15 -9
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +20 -11
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +15 -9
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +20 -11
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +15 -9
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +20 -11
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +12 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +62 -27
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +7 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +19 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +12 -0
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +62 -27
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +12 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +54 -19
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +12 -0
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +62 -27
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +5 -0
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +65 -46
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/debugBlock.js +5 -1
- package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/intFloatConverterBlock.js +2 -2
- package/Meshes/Node/Blocks/intFloatConverterBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mapRangeBlock.js +8 -1
- package/Meshes/Node/Blocks/mapRangeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +1 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/matrixComposeBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/matrixComposeBlock.js +55 -0
- package/Meshes/Node/Blocks/matrixComposeBlock.js.map +1 -0
- package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +3 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js +2 -0
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.d.ts +10 -0
- package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.js +2 -0
- package/Meshes/Node/Interfaces/nodeGeometryInstancingContext.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.d.ts +5 -0
- package/Meshes/Node/nodeGeometryBuildState.js +20 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/abstractMesh.js +4 -1
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.js +10 -10
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.js +7 -5
- package/Meshes/mesh.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +2 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/dumpTools.js +3 -2
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/equirectangularCapture.d.ts +39 -0
- package/Misc/equirectangularCapture.js +56 -0
- package/Misc/equirectangularCapture.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +4 -0
- package/Particles/solidParticleSystem.js +16 -1
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +10 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +8 -1
- package/Physics/v2/Plugins/havokPlugin.js +34 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +11 -1
- package/Physics/v2/physicsConstraint.js +7 -0
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +6 -0
- package/Rendering/prePassRenderer.js +14 -0
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/default.fragment.js +4 -0
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/equirectangularPanorama.fragment.d.ts +5 -0
- package/Shaders/equirectangularPanorama.fragment.js +17 -0
- package/Shaders/equirectangularPanorama.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +4 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.d.ts +0 -34
- package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.js +0 -29
- package/FlowGraph/Blocks/Data/flowGraphBinaryOpBlocks.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { __decorate } from "../../../../tslib.es6.js";
|
|
1
2
|
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
2
3
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
4
6
|
/**
|
|
5
7
|
* Block used to set normals for a geometry
|
|
6
8
|
*/
|
|
@@ -11,6 +13,11 @@ export class SetNormalsBlock extends NodeGeometryBlock {
|
|
|
11
13
|
*/
|
|
12
14
|
constructor(name) {
|
|
13
15
|
super(name);
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
18
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
19
|
+
*/
|
|
20
|
+
this.evaluateContext = true;
|
|
14
21
|
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
15
22
|
this.registerInput("normals", NodeGeometryBlockConnectionPointTypes.Vector3);
|
|
16
23
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
@@ -62,37 +69,65 @@ export class SetNormalsBlock extends NodeGeometryBlock {
|
|
|
62
69
|
return this._outputs[0];
|
|
63
70
|
}
|
|
64
71
|
_buildBlock(state) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
const func = (state) => {
|
|
73
|
+
state.executionContext = this;
|
|
74
|
+
this._vertexData = this.geometry.getConnectedValue(state);
|
|
75
|
+
state.geometryContext = this._vertexData;
|
|
76
|
+
if (!this._vertexData || !this._vertexData.positions) {
|
|
77
|
+
state.executionContext = null;
|
|
78
|
+
state.geometryContext = null;
|
|
79
|
+
this.output._storedValue = null;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!this.normals.isConnected) {
|
|
83
|
+
state.executionContext = null;
|
|
84
|
+
state.geometryContext = null;
|
|
85
|
+
this.output._storedValue = this._vertexData;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!this._vertexData.normals) {
|
|
89
|
+
this._vertexData.normals = [];
|
|
90
|
+
}
|
|
91
|
+
// Processing
|
|
92
|
+
const vertexCount = this._vertexData.positions.length / 3;
|
|
93
|
+
for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {
|
|
94
|
+
const tempVector3 = this.normals.getConnectedValue(state);
|
|
95
|
+
if (tempVector3) {
|
|
96
|
+
tempVector3.toArray(this._vertexData.normals, this._currentIndex * 3);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Storage
|
|
100
|
+
return this._vertexData;
|
|
101
|
+
};
|
|
102
|
+
if (this.evaluateContext) {
|
|
103
|
+
this.output._storedFunction = func;
|
|
79
104
|
}
|
|
80
|
-
|
|
81
|
-
this.
|
|
105
|
+
else {
|
|
106
|
+
this.output._storedValue = func(state);
|
|
82
107
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
}
|
|
109
|
+
_dumpPropertiesCode() {
|
|
110
|
+
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
111
|
+
return codeString;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Serializes this block in a JSON representation
|
|
115
|
+
* @returns the serialized block object
|
|
116
|
+
*/
|
|
117
|
+
serialize() {
|
|
118
|
+
const serializationObject = super.serialize();
|
|
119
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
120
|
+
return serializationObject;
|
|
121
|
+
}
|
|
122
|
+
_deserialize(serializationObject) {
|
|
123
|
+
super._deserialize(serializationObject);
|
|
124
|
+
if (serializationObject.evaluateContext !== undefined) {
|
|
125
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
90
126
|
}
|
|
91
|
-
// Storage
|
|
92
|
-
this.output._storedValue = this._vertexData;
|
|
93
|
-
state.executionContext = null;
|
|
94
|
-
state.geometryContext = null;
|
|
95
127
|
}
|
|
96
128
|
}
|
|
129
|
+
__decorate([
|
|
130
|
+
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
131
|
+
], SetNormalsBlock.prototype, "evaluateContext", void 0);
|
|
97
132
|
RegisterClass("BABYLON.SetNormalsBlock", SetNormalsBlock);
|
|
98
133
|
//# sourceMappingURL=setNormalsBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setNormalsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setNormalsBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"setNormalsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setNormalsBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAKrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IAWlD;;;OAGG;IACH,YAAmB,IAAY;QAC3B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M,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,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;AAzIU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;wDAC3F;AA2IlC,aAAa,CAAC,yBAAyB,EAAE,eAAe,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 type { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to set normals for a geometry\r\n */\r\nexport class SetNormalsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\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 SetNormalsBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"normals\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"SetNormalsBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the normals input component\r\n */\r\n public get normals(): 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 _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.executionContext = this;\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.geometryContext = this._vertexData;\r\n\r\n if (!this._vertexData || !this._vertexData.positions) {\r\n state.executionContext = null;\r\n state.geometryContext = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n if (!this.normals.isConnected) {\r\n state.executionContext = null;\r\n state.geometryContext = null;\r\n this.output._storedValue = this._vertexData;\r\n return;\r\n }\r\n\r\n if (!this._vertexData.normals) {\r\n this._vertexData.normals = [];\r\n }\r\n\r\n // Processing\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n const tempVector3 = this.normals.getConnectedValue(state) as Vector3;\r\n if (tempVector3) {\r\n tempVector3.toArray(this._vertexData.normals, this._currentIndex * 3);\r\n }\r\n }\r\n\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._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.SetNormalsBlock\", SetNormalsBlock);\r\n"]}
|
|
@@ -8,6 +8,11 @@ import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometr
|
|
|
8
8
|
export declare class SetPositionsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {
|
|
9
9
|
private _vertexData;
|
|
10
10
|
private _currentIndex;
|
|
11
|
+
/**
|
|
12
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
13
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
14
|
+
*/
|
|
15
|
+
evaluateContext: boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Create a new SetPositionsBlock
|
|
13
18
|
* @param name defines the block name
|
|
@@ -46,4 +51,11 @@ export declare class SetPositionsBlock extends NodeGeometryBlock implements INod
|
|
|
46
51
|
*/
|
|
47
52
|
get output(): NodeGeometryConnectionPoint;
|
|
48
53
|
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
54
|
+
protected _dumpPropertiesCode(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Serializes this block in a JSON representation
|
|
57
|
+
* @returns the serialized block object
|
|
58
|
+
*/
|
|
59
|
+
serialize(): any;
|
|
60
|
+
_deserialize(serializationObject: any): void;
|
|
49
61
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { __decorate } from "../../../../tslib.es6.js";
|
|
1
2
|
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
2
3
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
4
6
|
/**
|
|
5
7
|
* Block used to set positions for a geometry
|
|
6
8
|
*/
|
|
@@ -11,6 +13,11 @@ export class SetPositionsBlock extends NodeGeometryBlock {
|
|
|
11
13
|
*/
|
|
12
14
|
constructor(name) {
|
|
13
15
|
super(name);
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
18
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
19
|
+
*/
|
|
20
|
+
this.evaluateContext = true;
|
|
14
21
|
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
15
22
|
this.registerInput("positions", NodeGeometryBlockConnectionPointTypes.Vector3);
|
|
16
23
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
@@ -62,28 +69,56 @@ export class SetPositionsBlock extends NodeGeometryBlock {
|
|
|
62
69
|
return this._outputs[0];
|
|
63
70
|
}
|
|
64
71
|
_buildBlock(state) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
tempVector3
|
|
72
|
+
const func = (state) => {
|
|
73
|
+
state.executionContext = this;
|
|
74
|
+
this._vertexData = this.geometry.getConnectedValue(state);
|
|
75
|
+
state.geometryContext = this._vertexData;
|
|
76
|
+
if (!this._vertexData || !this._vertexData.positions || !this.positions.isConnected) {
|
|
77
|
+
state.executionContext = null;
|
|
78
|
+
state.geometryContext = null;
|
|
79
|
+
this.output._storedValue = null;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Processing
|
|
83
|
+
const vertexCount = this._vertexData.positions.length / 3;
|
|
84
|
+
for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {
|
|
85
|
+
const tempVector3 = this.positions.getConnectedValue(state);
|
|
86
|
+
if (tempVector3) {
|
|
87
|
+
tempVector3.toArray(this._vertexData.positions, this._currentIndex * 3);
|
|
88
|
+
}
|
|
80
89
|
}
|
|
90
|
+
// Storage
|
|
91
|
+
return this._vertexData;
|
|
92
|
+
};
|
|
93
|
+
if (this.evaluateContext) {
|
|
94
|
+
this.output._storedFunction = func;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.output._storedValue = func(state);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_dumpPropertiesCode() {
|
|
101
|
+
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
102
|
+
return codeString;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Serializes this block in a JSON representation
|
|
106
|
+
* @returns the serialized block object
|
|
107
|
+
*/
|
|
108
|
+
serialize() {
|
|
109
|
+
const serializationObject = super.serialize();
|
|
110
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
111
|
+
return serializationObject;
|
|
112
|
+
}
|
|
113
|
+
_deserialize(serializationObject) {
|
|
114
|
+
super._deserialize(serializationObject);
|
|
115
|
+
if (serializationObject.evaluateContext !== undefined) {
|
|
116
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
81
117
|
}
|
|
82
|
-
// Storage
|
|
83
|
-
this.output._storedValue = this._vertexData;
|
|
84
|
-
state.executionContext = null;
|
|
85
|
-
state.geometryContext = null;
|
|
86
118
|
}
|
|
87
119
|
}
|
|
120
|
+
__decorate([
|
|
121
|
+
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
122
|
+
], SetPositionsBlock.prototype, "evaluateContext", void 0);
|
|
88
123
|
RegisterClass("BABYLON.SetPositionsBlock", SetPositionsBlock);
|
|
89
124
|
//# sourceMappingURL=setPositionsBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setPositionsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setPositionsBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"setPositionsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setPositionsBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAKrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAWpD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS1B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAE/E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,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AAM;YACH,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;IAES,mBAAmB;QACzB,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,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;AA9HU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DAC3F;AAgIlC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,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 \"../../../../Meshes/mesh.vertexData\";\r\nimport type { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to set positions for a geometry\r\n */\r\nexport class SetPositionsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\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 SetPositionsBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"positions\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"SetPositionsBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the positions input component\r\n */\r\n public get positions(): 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 _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.executionContext = this;\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.geometryContext = this._vertexData;\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this.positions.isConnected) {\r\n state.executionContext = null;\r\n state.geometryContext = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n const tempVector3 = this.positions.getConnectedValue(state) as Vector3;\r\n if (tempVector3) {\r\n tempVector3.toArray(this._vertexData.positions, this._currentIndex * 3);\r\n }\r\n }\r\n\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._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.SetPositionsBlock\", SetPositionsBlock);\r\n"]}
|
|
@@ -8,6 +8,11 @@ import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometr
|
|
|
8
8
|
export declare class SetTangentsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {
|
|
9
9
|
private _vertexData;
|
|
10
10
|
private _currentIndex;
|
|
11
|
+
/**
|
|
12
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
13
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
14
|
+
*/
|
|
15
|
+
evaluateContext: boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Create a new SetTangentsBlock
|
|
13
18
|
* @param name defines the block name
|
|
@@ -46,4 +51,11 @@ export declare class SetTangentsBlock extends NodeGeometryBlock implements INode
|
|
|
46
51
|
*/
|
|
47
52
|
get output(): NodeGeometryConnectionPoint;
|
|
48
53
|
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
54
|
+
protected _dumpPropertiesCode(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Serializes this block in a JSON representation
|
|
57
|
+
* @returns the serialized block object
|
|
58
|
+
*/
|
|
59
|
+
serialize(): any;
|
|
60
|
+
_deserialize(serializationObject: any): void;
|
|
49
61
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { __decorate } from "../../../../tslib.es6.js";
|
|
1
2
|
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
2
3
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
4
6
|
/**
|
|
5
7
|
* Block used to set tangents for a geometry
|
|
6
8
|
*/
|
|
@@ -11,6 +13,11 @@ export class SetTangentsBlock extends NodeGeometryBlock {
|
|
|
11
13
|
*/
|
|
12
14
|
constructor(name) {
|
|
13
15
|
super(name);
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
18
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
19
|
+
*/
|
|
20
|
+
this.evaluateContext = true;
|
|
14
21
|
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
15
22
|
this.registerInput("tangents", NodeGeometryBlockConnectionPointTypes.Vector4);
|
|
16
23
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
@@ -62,37 +69,65 @@ export class SetTangentsBlock extends NodeGeometryBlock {
|
|
|
62
69
|
return this._outputs[0];
|
|
63
70
|
}
|
|
64
71
|
_buildBlock(state) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
const func = (state) => {
|
|
73
|
+
state.executionContext = this;
|
|
74
|
+
this._vertexData = this.geometry.getConnectedValue(state);
|
|
75
|
+
state.geometryContext = this._vertexData;
|
|
76
|
+
if (!this._vertexData || !this._vertexData.positions) {
|
|
77
|
+
state.executionContext = null;
|
|
78
|
+
state.geometryContext = null;
|
|
79
|
+
this.output._storedValue = null;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!this.tangents.isConnected) {
|
|
83
|
+
state.executionContext = null;
|
|
84
|
+
state.geometryContext = null;
|
|
85
|
+
this.output._storedValue = this._vertexData;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!this._vertexData.tangents) {
|
|
89
|
+
this._vertexData.tangents = [];
|
|
90
|
+
}
|
|
91
|
+
// Processing
|
|
92
|
+
const vertexCount = this._vertexData.positions.length / 3;
|
|
93
|
+
for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {
|
|
94
|
+
const tempVector4 = this.tangents.getConnectedValue(state);
|
|
95
|
+
if (tempVector4) {
|
|
96
|
+
tempVector4.toArray(this._vertexData.tangents, this._currentIndex * 4);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Storage
|
|
100
|
+
return this._vertexData;
|
|
101
|
+
};
|
|
102
|
+
if (this.evaluateContext) {
|
|
103
|
+
this.output._storedFunction = func;
|
|
79
104
|
}
|
|
80
|
-
|
|
81
|
-
this.
|
|
105
|
+
else {
|
|
106
|
+
this.output._storedValue = func(state);
|
|
82
107
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
}
|
|
109
|
+
_dumpPropertiesCode() {
|
|
110
|
+
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
111
|
+
return codeString;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Serializes this block in a JSON representation
|
|
115
|
+
* @returns the serialized block object
|
|
116
|
+
*/
|
|
117
|
+
serialize() {
|
|
118
|
+
const serializationObject = super.serialize();
|
|
119
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
120
|
+
return serializationObject;
|
|
121
|
+
}
|
|
122
|
+
_deserialize(serializationObject) {
|
|
123
|
+
super._deserialize(serializationObject);
|
|
124
|
+
if (serializationObject.evaluateContext !== undefined) {
|
|
125
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
90
126
|
}
|
|
91
|
-
// Storage
|
|
92
|
-
this.output._storedValue = this._vertexData;
|
|
93
|
-
state.executionContext = null;
|
|
94
|
-
state.geometryContext = null;
|
|
95
127
|
}
|
|
96
128
|
}
|
|
129
|
+
__decorate([
|
|
130
|
+
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
131
|
+
], SetTangentsBlock.prototype, "evaluateContext", void 0);
|
|
97
132
|
RegisterClass("BABYLON.SetTangentsBlock", SetTangentsBlock);
|
|
98
133
|
//# sourceMappingURL=setTangentsBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTangentsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setTangentsBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"setTangentsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setTangentsBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAKrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAWnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS1B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAE9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,CAAC,C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IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AAzIU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;yDAC3F;AA2IlC,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 type { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to set tangents for a geometry\r\n */\r\nexport class SetTangentsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\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 SetTangentsBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"tangents\", NodeGeometryBlockConnectionPointTypes.Vector4);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"SetTangentsBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the tangents input component\r\n */\r\n public get tangents(): 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 _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.executionContext = this;\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.geometryContext = this._vertexData;\r\n\r\n if (!this._vertexData || !this._vertexData.positions) {\r\n state.executionContext = null;\r\n state.geometryContext = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n if (!this.tangents.isConnected) {\r\n state.executionContext = null;\r\n state.geometryContext = null;\r\n this.output._storedValue = this._vertexData;\r\n return;\r\n }\r\n\r\n if (!this._vertexData.tangents) {\r\n this._vertexData.tangents = [];\r\n }\r\n\r\n // Processing\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n const tempVector4 = this.tangents.getConnectedValue(state) as Vector4;\r\n if (tempVector4) {\r\n tempVector4.toArray(this._vertexData.tangents, this._currentIndex * 4);\r\n }\r\n }\r\n\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._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.SetTangentsBlock\", SetTangentsBlock);\r\n"]}
|
|
@@ -8,6 +8,11 @@ import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometr
|
|
|
8
8
|
export declare class SetUVsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {
|
|
9
9
|
private _vertexData;
|
|
10
10
|
private _currentIndex;
|
|
11
|
+
/**
|
|
12
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
13
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
14
|
+
*/
|
|
15
|
+
evaluateContext: boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Gets or sets a value indicating which UV to set
|
|
13
18
|
*/
|