@babylonjs/core 6.16.2 → 6.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animatable.d.ts +4 -0
- package/Animations/animatable.js +7 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animationGroup.d.ts +16 -0
- package/Animations/animationGroup.js +50 -0
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroupMask.d.ts +63 -0
- package/Animations/animationGroupMask.js +83 -0
- package/Animations/animationGroupMask.js.map +1 -0
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/Audio/audioEngine.d.ts +1 -1
- package/Audio/audioEngine.js +24 -13
- package/Audio/audioEngine.js.map +1 -1
- package/Bones/skeleton.d.ts +3 -1
- package/Bones/skeleton.js +11 -2
- package/Bones/skeleton.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +26 -1
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/greasedLinePluginMaterial.d.ts +7 -2
- package/Materials/greasedLinePluginMaterial.js +46 -21
- package/Materials/greasedLinePluginMaterial.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +77 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +198 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js +6 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +76 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +163 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.d.ts +43 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.js +100 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/noiseBlock.d.ts +10 -2
- package/Meshes/Node/Blocks/noiseBlock.js +22 -4
- package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +5 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js +4 -0
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
- package/Meshes/Node/index.d.ts +3 -0
- package/Meshes/Node/index.js +3 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +7 -0
- package/Meshes/Node/nodeGeometry.js +17 -0
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +8 -3
- package/Meshes/Node/nodeGeometryBlock.js +24 -5
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +8 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +13 -0
- package/Meshes/mesh.vertexData.js +14 -0
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.js +7 -3
- package/Meshes/transformNode.js.map +1 -1
- package/Particles/IGPUParticleSystemPlatform.d.ts +2 -2
- package/Particles/IGPUParticleSystemPlatform.js.map +1 -1
- package/Particles/computeShaderParticleSystem.d.ts +2 -2
- package/Particles/computeShaderParticleSystem.js +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +2 -0
- package/Particles/gpuParticleSystem.js +16 -3
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +2 -0
- package/Particles/particleSystem.js +40 -7
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.d.ts +4 -2
- package/Particles/webgl2ParticleSystem.js +8 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +18 -1
- package/Physics/v2/physicsBody.js +26 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +5 -5
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/particles.vertex.js +5 -5
- package/Shaders/particles.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to get information about a geometry
|
|
6
|
+
*/
|
|
7
|
+
export class GeometryInfoBlock extends NodeGeometryBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new GeometryInfoBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name) {
|
|
13
|
+
super(name);
|
|
14
|
+
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
15
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
16
|
+
this.registerOutput("id", NodeGeometryBlockConnectionPointTypes.Int);
|
|
17
|
+
this.registerOutput("collectionId", NodeGeometryBlockConnectionPointTypes.Int);
|
|
18
|
+
this.registerOutput("verticesCount", NodeGeometryBlockConnectionPointTypes.Int);
|
|
19
|
+
this.registerOutput("facesCount", NodeGeometryBlockConnectionPointTypes.Int);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the current class name
|
|
23
|
+
* @returns the class name
|
|
24
|
+
*/
|
|
25
|
+
getClassName() {
|
|
26
|
+
return "GeometryInfoBlock";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the geometry input component
|
|
30
|
+
*/
|
|
31
|
+
get geometry() {
|
|
32
|
+
return this._inputs[0];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets the geometry output component
|
|
36
|
+
*/
|
|
37
|
+
get output() {
|
|
38
|
+
return this._outputs[0];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the id output component
|
|
42
|
+
*/
|
|
43
|
+
get id() {
|
|
44
|
+
return this._outputs[1];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the collectionId output component
|
|
48
|
+
*/
|
|
49
|
+
get collectionId() {
|
|
50
|
+
return this._outputs[2];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the verticesCount output component
|
|
54
|
+
*/
|
|
55
|
+
get verticesCount() {
|
|
56
|
+
return this._outputs[3];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the facesCount output component
|
|
60
|
+
*/
|
|
61
|
+
get facesCount() {
|
|
62
|
+
return this._outputs[4];
|
|
63
|
+
}
|
|
64
|
+
_buildBlock() {
|
|
65
|
+
if (!this.geometry.isConnected) {
|
|
66
|
+
this.id._storedValue = 0;
|
|
67
|
+
this.collectionId._storedValue = 0;
|
|
68
|
+
this.verticesCount._storedValue = 0;
|
|
69
|
+
this.facesCount._storedValue = 0;
|
|
70
|
+
this.output._storedValue = 0;
|
|
71
|
+
this.id._storedFunction = null;
|
|
72
|
+
this.collectionId._storedFunction = null;
|
|
73
|
+
this.verticesCount._storedFunction = null;
|
|
74
|
+
this.facesCount._storedFunction = null;
|
|
75
|
+
this.output._storedFunction = null;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.output._storedFunction = (state) => {
|
|
79
|
+
return this._currentVertexData || this.geometry.getConnectedValue(state);
|
|
80
|
+
};
|
|
81
|
+
this.id._storedFunction = (state) => {
|
|
82
|
+
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
83
|
+
return this._currentVertexData.uniqueId;
|
|
84
|
+
};
|
|
85
|
+
this.collectionId._storedFunction = (state) => {
|
|
86
|
+
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
87
|
+
return this._currentVertexData.metadata ? this._currentVertexData.metadata.collectionId : 0;
|
|
88
|
+
};
|
|
89
|
+
this.verticesCount._storedFunction = (state) => {
|
|
90
|
+
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
91
|
+
return this._currentVertexData.positions ? this._currentVertexData.positions.length / 3 : 0;
|
|
92
|
+
};
|
|
93
|
+
this.facesCount._storedFunction = (state) => {
|
|
94
|
+
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
95
|
+
return this._currentVertexData.indices ? this._currentVertexData.indices.length / 3 : 0;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
RegisterClass("BABYLON.GeometryInfoBlock", GeometryInfoBlock);
|
|
100
|
+
//# sourceMappingURL=geometryInfoBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryInfoBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryInfoBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAIlG;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAEpD;;;OAGG;IACH,YAAmB,IAAY;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CAAC,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,eAAe,GAAG,CAAC,KAA6B,EAAE,EAAE;YACnE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAe,CAAC;YAC/E,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,KAA6B,EAAE,EAAE;YAChE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAe,CAAC;YAC/E,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC;IACN,CAAC;CACJ;AAED,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 { VertexData } from \"../../mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to get information about a geometry\r\n */\r\nexport class GeometryInfoBlock extends NodeGeometryBlock {\r\n private _currentVertexData: VertexData;\r\n /**\r\n * Create a new GeometryInfoBlock\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\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerOutput(\"id\", NodeGeometryBlockConnectionPointTypes.Int);\r\n this.registerOutput(\"collectionId\", NodeGeometryBlockConnectionPointTypes.Int);\r\n this.registerOutput(\"verticesCount\", NodeGeometryBlockConnectionPointTypes.Int);\r\n this.registerOutput(\"facesCount\", NodeGeometryBlockConnectionPointTypes.Int);\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 \"GeometryInfoBlock\";\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 geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the id output component\r\n */\r\n public get id(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the collectionId output component\r\n */\r\n public get collectionId(): NodeGeometryConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the verticesCount output component\r\n */\r\n public get verticesCount(): NodeGeometryConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the facesCount output component\r\n */\r\n public get facesCount(): NodeGeometryConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.geometry.isConnected) {\r\n this.id._storedValue = 0;\r\n this.collectionId._storedValue = 0;\r\n this.verticesCount._storedValue = 0;\r\n this.facesCount._storedValue = 0;\r\n this.output._storedValue = 0;\r\n this.id._storedFunction = null;\r\n this.collectionId._storedFunction = null;\r\n this.verticesCount._storedFunction = null;\r\n this.facesCount._storedFunction = null;\r\n this.output._storedFunction = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state: NodeGeometryBuildState) => {\r\n return this._currentVertexData || (this.geometry.getConnectedValue(state) as VertexData);\r\n };\r\n this.id._storedFunction = (state: NodeGeometryBuildState) => {\r\n this._currentVertexData = this.geometry.getConnectedValue(state) as VertexData;\r\n return this._currentVertexData.uniqueId;\r\n };\r\n this.collectionId._storedFunction = (state: NodeGeometryBuildState) => {\r\n this._currentVertexData = this.geometry.getConnectedValue(state) as VertexData;\r\n return this._currentVertexData.metadata ? this._currentVertexData.metadata.collectionId : 0;\r\n };\r\n this.verticesCount._storedFunction = (state: NodeGeometryBuildState) => {\r\n this._currentVertexData = this.geometry.getConnectedValue(state) as VertexData;\r\n return this._currentVertexData.positions ? this._currentVertexData.positions.length / 3 : 0;\r\n };\r\n this.facesCount._storedFunction = (state: NodeGeometryBuildState) => {\r\n this._currentVertexData = this.geometry.getConnectedValue(state) as VertexData;\r\n return this._currentVertexData.indices ? this._currentVertexData.indices.length / 3 : 0;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryInfoBlock\", GeometryInfoBlock);\r\n"]}
|
|
@@ -68,6 +68,8 @@ export class GeometryInputBlock extends NodeGeometryBlock {
|
|
|
68
68
|
this._type = NodeGeometryBlockConnectionPointTypes.Vector2;
|
|
69
69
|
break;
|
|
70
70
|
case NodeGeometryContextualSources.VertexID:
|
|
71
|
+
case NodeGeometryContextualSources.GeometryID:
|
|
72
|
+
case NodeGeometryContextualSources.CollectionID:
|
|
71
73
|
case NodeGeometryContextualSources.FaceID:
|
|
72
74
|
this._type = NodeGeometryBlockConnectionPointTypes.Int;
|
|
73
75
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,E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AAC,IAAI,CAAC;QAEtC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,CAAC;QAEnE,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE;YAChC,OAAO;SACV;QAED,IAAI,mBAAmB,CAAC,SAAS,KAAK,QAAQ,EAAE;YAC5C,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC;SACjD;aAAM;YACH,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,SAAS,EAAE;gBACX,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;aACtE;SACJ;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../../Misc/observable\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class GeometryInputBlock extends NodeGeometryBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeGeometryBlockConnectionPointTypes = NodeGeometryBlockConnectionPointTypes.Undefined;\r\n private _contextualSource = NodeGeometryContextualSources.None;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<GeometryInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeGeometryBlockConnectionPointTypes {\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeGeometryBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Vector4\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeGeometryContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeGeometryContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeGeometryContextualSources) {\r\n this._contextualSource = value;\r\n\r\n switch (value) {\r\n case NodeGeometryContextualSources.Positions:\r\n case NodeGeometryContextualSources.Normals:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeGeometryContextualSources.Colors:\r\n case NodeGeometryContextualSources.Tangents:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector4;\r\n break;\r\n case NodeGeometryContextualSources.UV:\r\n case NodeGeometryContextualSources.UV2:\r\n case NodeGeometryContextualSources.UV3:\r\n case NodeGeometryContextualSources.UV4:\r\n case NodeGeometryContextualSources.UV5:\r\n case NodeGeometryContextualSources.UV6:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeGeometryContextualSources.VertexID:\r\n case NodeGeometryContextualSources.FaceID:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeGeometryBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeGeometryBlockConnectionPointTypes = NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeGeometryBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\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 \"GeometryInputBlock\";\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 /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n this.contextualValue = NodeGeometryContextualSources.None;\r\n switch (this.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n this.value = Vector4.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = this.value;\r\n }\r\n }\r\n\r\n public dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n\r\n if (this.isContextual) {\r\n return (\r\n super._dumpPropertiesCode() + `${variableName}.contextualValue = BABYLON.NodeGeometryContextualSources.${NodeGeometryContextualSources[this._contextualSource]};\\n`\r\n );\r\n }\r\n const codes: string[] = [];\r\n\r\n let valueString = \"\";\r\n\r\n switch (this.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Float:\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n valueString = `${this.value}`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n valueString = `new BABYLON.Vector2(${this.value.x}, ${this.value.y})`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n valueString = `new BABYLON.Vector3(${this.value.x}, ${this.value.y}, ${this.value.z})`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n valueString = `new BABYLON.Vector4(${this.value.x}, ${this.value.y}, ${this.value.z}, ${this.value.w})`;\r\n break;\r\n }\r\n\r\n // Common Property \"Value\"\r\n codes.push(`${variableName}.value = ${valueString}`);\r\n\r\n // Float-Value-Specific Properties\r\n if (this.type === NodeGeometryBlockConnectionPointTypes.Float || this.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n codes.push(`${variableName}.min = ${this.min}`, `${variableName}.max = ${this.max}`);\r\n }\r\n\r\n codes.push(\"\");\r\n\r\n return super._dumpPropertiesCode() + codes.join(\";\\n\");\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\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 this._type = serializationObject.type;\r\n\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryInputBlock\", GeometryInputBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAkBrD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC,CAAC,UAAU,EAAE;YACjE,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;gBACpB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;oBACpB,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAC,KAAK,CAAC;oBACzD,OAAO,IAAI,CAAC,KAAK,CAAC;iBACrB;gBAED,QAAQ,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE;oBAC/B,KAAK,SAAS;wBACV,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAC,OAAO,CAAC;wBAC3D,OAAO,IAAI,CAAC,KAAK,CAAC;oBACtB,KAAK,SAAS;wBACV,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAC,OAAO,CAAC;wBAC3D,OAAO,IAAI,CAAC,KAAK,CAAC;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ryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class GeometryInputBlock extends NodeGeometryBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeGeometryBlockConnectionPointTypes = NodeGeometryBlockConnectionPointTypes.Undefined;\r\n private _contextualSource = NodeGeometryContextualSources.None;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<GeometryInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeGeometryBlockConnectionPointTypes {\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeGeometryBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Vector4\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeGeometryBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeGeometryContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeGeometryContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeGeometryContextualSources) {\r\n this._contextualSource = value;\r\n\r\n switch (value) {\r\n case NodeGeometryContextualSources.Positions:\r\n case NodeGeometryContextualSources.Normals:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeGeometryContextualSources.Colors:\r\n case NodeGeometryContextualSources.Tangents:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector4;\r\n break;\r\n case NodeGeometryContextualSources.UV:\r\n case NodeGeometryContextualSources.UV2:\r\n case NodeGeometryContextualSources.UV3:\r\n case NodeGeometryContextualSources.UV4:\r\n case NodeGeometryContextualSources.UV5:\r\n case NodeGeometryContextualSources.UV6:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeGeometryContextualSources.VertexID:\r\n case NodeGeometryContextualSources.GeometryID:\r\n case NodeGeometryContextualSources.CollectionID:\r\n case NodeGeometryContextualSources.FaceID:\r\n this._type = NodeGeometryBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeGeometryBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeGeometryBlockConnectionPointTypes = NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeGeometryBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\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 \"GeometryInputBlock\";\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 /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n this.contextualValue = NodeGeometryContextualSources.None;\r\n switch (this.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n this.value = Vector4.Zero();\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = this.value;\r\n }\r\n }\r\n\r\n public dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n\r\n if (this.isContextual) {\r\n return (\r\n super._dumpPropertiesCode() + `${variableName}.contextualValue = BABYLON.NodeGeometryContextualSources.${NodeGeometryContextualSources[this._contextualSource]};\\n`\r\n );\r\n }\r\n const codes: string[] = [];\r\n\r\n let valueString = \"\";\r\n\r\n switch (this.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Float:\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n valueString = `${this.value}`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n valueString = `new BABYLON.Vector2(${this.value.x}, ${this.value.y})`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n valueString = `new BABYLON.Vector3(${this.value.x}, ${this.value.y}, ${this.value.z})`;\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n valueString = `new BABYLON.Vector4(${this.value.x}, ${this.value.y}, ${this.value.z}, ${this.value.w})`;\r\n break;\r\n }\r\n\r\n // Common Property \"Value\"\r\n codes.push(`${variableName}.value = ${valueString}`);\r\n\r\n // Float-Value-Specific Properties\r\n if (this.type === NodeGeometryBlockConnectionPointTypes.Float || this.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n codes.push(`${variableName}.min = ${this.min}`, `${variableName}.max = ${this.max}`);\r\n }\r\n\r\n codes.push(\"\");\r\n\r\n return super._dumpPropertiesCode() + codes.join(\";\\n\");\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\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 this._type = serializationObject.type;\r\n\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryInputBlock\", GeometryInputBlock);\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
2
|
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
-
import
|
|
3
|
+
import { Vector3 } from "../../../Maths/math.vector";
|
|
4
4
|
/**
|
|
5
5
|
* Block used to get a noise value
|
|
6
6
|
*/
|
|
@@ -15,6 +15,14 @@ export declare class NoiseBlock extends NodeGeometryBlock {
|
|
|
15
15
|
* @returns the class name
|
|
16
16
|
*/
|
|
17
17
|
getClassName(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the offset input component
|
|
20
|
+
*/
|
|
21
|
+
get offset(): NodeGeometryConnectionPoint;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the scale input component
|
|
24
|
+
*/
|
|
25
|
+
get scale(): NodeGeometryConnectionPoint;
|
|
18
26
|
/**
|
|
19
27
|
* Gets the octaves input component
|
|
20
28
|
*/
|
|
@@ -44,6 +52,6 @@ export declare class NoiseBlock extends NodeGeometryBlock {
|
|
|
44
52
|
* @returns a value between 0 and 1
|
|
45
53
|
* @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533
|
|
46
54
|
*/
|
|
47
|
-
noise(octaves: number, roughness: number,
|
|
55
|
+
noise(octaves: number, roughness: number, _position: Vector3, offset: Vector3, scale: number): number;
|
|
48
56
|
protected _buildBlock(): void;
|
|
49
57
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
2
2
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
3
|
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { Vector3 } from "../../../Maths/math.vector.js";
|
|
4
5
|
import { Scalar } from "../../../Maths/math.scalar.js";
|
|
5
6
|
import { NodeGeometryContextualSources } from "../Enums/nodeGeometryContextualSources.js";
|
|
6
7
|
/**
|
|
@@ -13,6 +14,8 @@ export class NoiseBlock extends NodeGeometryBlock {
|
|
|
13
14
|
*/
|
|
14
15
|
constructor(name) {
|
|
15
16
|
super(name);
|
|
17
|
+
this.registerInput("offset", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
18
|
+
this.registerInput("scale", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
16
19
|
this.registerInput("octaves", NodeGeometryBlockConnectionPointTypes.Float, true, 2, 0, 16);
|
|
17
20
|
this.registerInput("roughness", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5, 0, 1);
|
|
18
21
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Float);
|
|
@@ -24,17 +27,29 @@ export class NoiseBlock extends NodeGeometryBlock {
|
|
|
24
27
|
getClassName() {
|
|
25
28
|
return "NoiseBlock";
|
|
26
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the offset input component
|
|
32
|
+
*/
|
|
33
|
+
get offset() {
|
|
34
|
+
return this._inputs[0];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the scale input component
|
|
38
|
+
*/
|
|
39
|
+
get scale() {
|
|
40
|
+
return this._inputs[1];
|
|
41
|
+
}
|
|
27
42
|
/**
|
|
28
43
|
* Gets the octaves input component
|
|
29
44
|
*/
|
|
30
45
|
get octaves() {
|
|
31
|
-
return this._inputs[
|
|
46
|
+
return this._inputs[2];
|
|
32
47
|
}
|
|
33
48
|
/**
|
|
34
49
|
* Gets the roughtness input component
|
|
35
50
|
*/
|
|
36
51
|
get roughness() {
|
|
37
|
-
return this._inputs[
|
|
52
|
+
return this._inputs[3];
|
|
38
53
|
}
|
|
39
54
|
/**
|
|
40
55
|
* Gets the geometry output component
|
|
@@ -112,7 +127,8 @@ export class NoiseBlock extends NodeGeometryBlock {
|
|
|
112
127
|
* @returns a value between 0 and 1
|
|
113
128
|
* @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533
|
|
114
129
|
*/
|
|
115
|
-
noise(octaves, roughness,
|
|
130
|
+
noise(octaves, roughness, _position, offset, scale) {
|
|
131
|
+
const position = new Vector3(_position.x + offset.x * scale, _position.y + offset.y * scale, _position.z + offset.z * scale);
|
|
116
132
|
let fscale = 1.0;
|
|
117
133
|
let amp = 1.0;
|
|
118
134
|
let maxamp = 0.0;
|
|
@@ -141,7 +157,9 @@ export class NoiseBlock extends NodeGeometryBlock {
|
|
|
141
157
|
const position = state.getContextualValue(NodeGeometryContextualSources.Positions);
|
|
142
158
|
const octaves = this.octaves.getConnectedValue(state);
|
|
143
159
|
const roughness = this.roughness.getConnectedValue(state);
|
|
144
|
-
|
|
160
|
+
const offset = this.offset.getConnectedValue(state);
|
|
161
|
+
const scale = this.scale.getConnectedValue(state);
|
|
162
|
+
return this.noise(octaves, roughness, position, offset, scale);
|
|
145
163
|
};
|
|
146
164
|
}
|
|
147
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noiseBlock.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,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/C,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QACzB,GAAG,IAAI,MAAM,CAAC;QACd,IAAI,IAAI,MAAM,GAAG,GAAG,CAAC;QACrB,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IAC1C,CAAC;IAES,WAAW;QACjB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,SAAS,CAAY,CAAC;YAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACtD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,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 { Vector3 } from \"../../../Maths/math.vector\";\r\nimport { Scalar } from \"../../../Maths/math.scalar\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to get a noise value\r\n */\r\nexport class NoiseBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NoiseBlock\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(\"octaves\", NodeGeometryBlockConnectionPointTypes.Float, true, 2, 0, 16);\r\n this.registerInput(\"roughness\", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5, 0, 1);\r\n\r\n this.registerOutput(\"output\", 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 \"NoiseBlock\";\r\n }\r\n\r\n /**\r\n * Gets the octaves input component\r\n */\r\n public get octaves(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the roughtness input component\r\n */\r\n public get roughness(): 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 private _negateIf(value: number, condition: number) {\r\n return condition !== 0 ? -value : value;\r\n }\r\n\r\n private _noiseGrad(hash: number, x: number, y: number, z: number) {\r\n const h = hash & 15;\r\n const u = h < 8 ? x : y;\r\n const vt = h === 12 || h == 14 ? x : z;\r\n const v = h < 4 ? y : vt;\r\n return this._negateIf(u, h & u) + this._negateIf(v, h & 2);\r\n }\r\n\r\n private _fade(t: number) {\r\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\r\n }\r\n\r\n private _hashBitRotate(x: number, k: number) {\r\n return (x << k) | (x >> (32 - k));\r\n }\r\n\r\n private _hash(kx: number, ky: number, kz: number) {\r\n let a: number, b: number, c: number;\r\n a = b = c = 0xdeadbeef + (3 << 2) + 13;\r\n\r\n c += kz;\r\n b += ky;\r\n a += kx;\r\n\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 14);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 11);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 25);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 16);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 4);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 14);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 24);\r\n\r\n return c;\r\n }\r\n\r\n private _mix(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, x: number, y: number, z: number) {\r\n const x1 = 1.0 - x;\r\n const y1 = 1.0 - y;\r\n const z1 = 1.0 - z;\r\n return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) + z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));\r\n }\r\n\r\n private _perlinNoise(position: Vector3) {\r\n const X = (position.x | 0) - (position.x < 0 ? 1 : 0);\r\n const Y = (position.y | 0) - (position.y < 0 ? 1 : 0);\r\n const Z = (position.z | 0) - (position.z < 0 ? 1 : 0);\r\n\r\n const fx = position.x - X;\r\n const fy = position.y - Y;\r\n const fz = position.z - Z;\r\n\r\n const u = this._fade(fx);\r\n const v = this._fade(fy);\r\n const w = this._fade(fz);\r\n\r\n return this._mix(\r\n this._noiseGrad(this._hash(X, Y, Z), fx, fy, fz),\r\n this._noiseGrad(this._hash(X + 1, Y, Z), fx - 1, fy, fz),\r\n this._noiseGrad(this._hash(X, Y + 1, Z), fx, fy - 1, fz),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z), fx - 1, fy - 1, fz),\r\n this._noiseGrad(this._hash(X, Y, Z + 1), fx, fy, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y, Z + 1), fx - 1, fy, fz - 1),\r\n this._noiseGrad(this._hash(X, Y + 1, Z + 1), fx, fy - 1, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z + 1), fx - 1, fy - 1, fz - 1),\r\n u,\r\n v,\r\n w\r\n );\r\n }\r\n\r\n private _perlinSigned(position: Vector3) {\r\n return this._perlinNoise(position) * 0.982;\r\n }\r\n\r\n private _perlin(position: Vector3) {\r\n return this._perlinSigned(position) / 2.0 + 0.5;\r\n }\r\n\r\n /**\r\n * Gets a perlin noise value\r\n * @param octaves\r\n * @param roughness\r\n * @param position\r\n * @returns a value between 0 and 1\r\n * @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533\r\n */\r\n noise(octaves: number, roughness: number, position: Vector3) {\r\n let fscale = 1.0;\r\n let amp = 1.0;\r\n let maxamp = 0.0;\r\n let sum = 0.0;\r\n octaves = Scalar.Clamp(octaves, 0, 15.0);\r\n const step = octaves | 0;\r\n\r\n for (let i = 0; i <= step; i++) {\r\n const t = this._perlin(position.scale(fscale));\r\n sum += t * amp;\r\n maxamp += amp;\r\n amp *= Scalar.Clamp(roughness, 0.0, 1.0);\r\n fscale *= 2.0;\r\n }\r\n\r\n const rmd = octaves - Math.floor(octaves);\r\n if (rmd == 0.0) {\r\n return sum / maxamp;\r\n }\r\n\r\n const t = this._perlin(position.scale(fscale));\r\n let sum2 = sum + t * amp;\r\n sum /= maxamp;\r\n sum2 /= maxamp + amp;\r\n return (1.0 - rmd) * sum + rmd * sum2;\r\n }\r\n\r\n protected _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n const position = state.getContextualValue(NodeGeometryContextualSources.Positions) as Vector3;\r\n const octaves = this.octaves.getConnectedValue(state);\r\n const roughness = this.roughness.getConnectedValue(state);\r\n\r\n return this.noise(octaves, roughness, position);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NoiseBlock\", NoiseBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"noiseBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/noiseBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAA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AE,KAAK,CAAC,CAAC;QACnE,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,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 { Vector3 } from \"../../../Maths/math.vector\";\r\nimport { Scalar } from \"../../../Maths/math.scalar\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to get a noise value\r\n */\r\nexport class NoiseBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NoiseBlock\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(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scale\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n\r\n this.registerInput(\"octaves\", NodeGeometryBlockConnectionPointTypes.Float, true, 2, 0, 16);\r\n this.registerInput(\"roughness\", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5, 0, 1);\r\n\r\n this.registerOutput(\"output\", 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 \"NoiseBlock\";\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get scale(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the octaves input component\r\n */\r\n public get octaves(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the roughtness input component\r\n */\r\n public get roughness(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\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 private _negateIf(value: number, condition: number) {\r\n return condition !== 0 ? -value : value;\r\n }\r\n\r\n private _noiseGrad(hash: number, x: number, y: number, z: number) {\r\n const h = hash & 15;\r\n const u = h < 8 ? x : y;\r\n const vt = h === 12 || h == 14 ? x : z;\r\n const v = h < 4 ? y : vt;\r\n return this._negateIf(u, h & u) + this._negateIf(v, h & 2);\r\n }\r\n\r\n private _fade(t: number) {\r\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\r\n }\r\n\r\n private _hashBitRotate(x: number, k: number) {\r\n return (x << k) | (x >> (32 - k));\r\n }\r\n\r\n private _hash(kx: number, ky: number, kz: number) {\r\n let a: number, b: number, c: number;\r\n a = b = c = 0xdeadbeef + (3 << 2) + 13;\r\n\r\n c += kz;\r\n b += ky;\r\n a += kx;\r\n\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 14);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 11);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 25);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 16);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 4);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 14);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 24);\r\n\r\n return c;\r\n }\r\n\r\n private _mix(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, x: number, y: number, z: number) {\r\n const x1 = 1.0 - x;\r\n const y1 = 1.0 - y;\r\n const z1 = 1.0 - z;\r\n return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) + z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));\r\n }\r\n\r\n private _perlinNoise(position: Vector3) {\r\n const X = (position.x | 0) - (position.x < 0 ? 1 : 0);\r\n const Y = (position.y | 0) - (position.y < 0 ? 1 : 0);\r\n const Z = (position.z | 0) - (position.z < 0 ? 1 : 0);\r\n\r\n const fx = position.x - X;\r\n const fy = position.y - Y;\r\n const fz = position.z - Z;\r\n\r\n const u = this._fade(fx);\r\n const v = this._fade(fy);\r\n const w = this._fade(fz);\r\n\r\n return this._mix(\r\n this._noiseGrad(this._hash(X, Y, Z), fx, fy, fz),\r\n this._noiseGrad(this._hash(X + 1, Y, Z), fx - 1, fy, fz),\r\n this._noiseGrad(this._hash(X, Y + 1, Z), fx, fy - 1, fz),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z), fx - 1, fy - 1, fz),\r\n this._noiseGrad(this._hash(X, Y, Z + 1), fx, fy, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y, Z + 1), fx - 1, fy, fz - 1),\r\n this._noiseGrad(this._hash(X, Y + 1, Z + 1), fx, fy - 1, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z + 1), fx - 1, fy - 1, fz - 1),\r\n u,\r\n v,\r\n w\r\n );\r\n }\r\n\r\n private _perlinSigned(position: Vector3) {\r\n return this._perlinNoise(position) * 0.982;\r\n }\r\n\r\n private _perlin(position: Vector3) {\r\n return this._perlinSigned(position) / 2.0 + 0.5;\r\n }\r\n\r\n /**\r\n * Gets a perlin noise value\r\n * @param octaves\r\n * @param roughness\r\n * @param position\r\n * @returns a value between 0 and 1\r\n * @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533\r\n */\r\n noise(octaves: number, roughness: number, _position: Vector3, offset: Vector3, scale: number) {\r\n const position = new Vector3(_position.x + offset.x * scale, _position.y + offset.y * scale, _position.z + offset.z * scale);\r\n\r\n let fscale = 1.0;\r\n let amp = 1.0;\r\n let maxamp = 0.0;\r\n let sum = 0.0;\r\n octaves = Scalar.Clamp(octaves, 0, 15.0);\r\n const step = octaves | 0;\r\n\r\n for (let i = 0; i <= step; i++) {\r\n const t = this._perlin(position.scale(fscale));\r\n sum += t * amp;\r\n maxamp += amp;\r\n amp *= Scalar.Clamp(roughness, 0.0, 1.0);\r\n fscale *= 2.0;\r\n }\r\n\r\n const rmd = octaves - Math.floor(octaves);\r\n if (rmd == 0.0) {\r\n return sum / maxamp;\r\n }\r\n\r\n const t = this._perlin(position.scale(fscale));\r\n let sum2 = sum + t * amp;\r\n sum /= maxamp;\r\n sum2 /= maxamp + amp;\r\n return (1.0 - rmd) * sum + rmd * sum2;\r\n }\r\n\r\n protected _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n const position = state.getContextualValue(NodeGeometryContextualSources.Positions) as Vector3;\r\n const octaves = this.octaves.getConnectedValue(state);\r\n const roughness = this.roughness.getConnectedValue(state);\r\n\r\n const offset = this.offset.getConnectedValue(state) as Vector3;\r\n const scale = this.scale.getConnectedValue(state);\r\n\r\n return this.noise(octaves, roughness, position, offset, scale);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NoiseBlock\", NoiseBlock);\r\n"]}
|
|
@@ -29,5 +29,9 @@ export var NodeGeometryContextualSources;
|
|
|
29
29
|
NodeGeometryContextualSources[NodeGeometryContextualSources["VertexID"] = 11] = "VertexID";
|
|
30
30
|
/** FaceID */
|
|
31
31
|
NodeGeometryContextualSources[NodeGeometryContextualSources["FaceID"] = 12] = "FaceID";
|
|
32
|
+
/** GeometryID */
|
|
33
|
+
NodeGeometryContextualSources[NodeGeometryContextualSources["GeometryID"] = 13] = "GeometryID";
|
|
34
|
+
/** CollectionID */
|
|
35
|
+
NodeGeometryContextualSources[NodeGeometryContextualSources["CollectionID"] = 14] = "CollectionID";
|
|
32
36
|
})(NodeGeometryContextualSources || (NodeGeometryContextualSources = {}));
|
|
33
37
|
//# sourceMappingURL=nodeGeometryContextualSources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeGeometryContextualSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Enums/nodeGeometryContextualSources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"nodeGeometryContextualSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Enums/nodeGeometryContextualSources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,6BA+BX;AA/BD,WAAY,6BAA6B;IACrC,WAAW;IACX,iFAAa,CAAA;IACb,gBAAgB;IAChB,2FAAkB,CAAA;IAClB,cAAc;IACd,uFAAgB,CAAA;IAChB,eAAe;IACf,yFAAiB,CAAA;IACjB,SAAS;IACT,6EAAW,CAAA;IACX,UAAU;IACV,+EAAY,CAAA;IACZ,UAAU;IACV,+EAAY,CAAA;IACZ,UAAU;IACV,+EAAY,CAAA;IACZ,UAAU;IACV,+EAAY,CAAA;IACZ,UAAU;IACV,+EAAY,CAAA;IACZ,aAAa;IACb,sFAAe,CAAA;IACf,eAAe;IACf,0FAAiB,CAAA;IACjB,aAAa;IACb,sFAAe,CAAA;IACf,iBAAiB;IACjB,8FAAmB,CAAA;IACnB,mBAAmB;IACnB,kGAAqB,CAAA;AACzB,CAAC,EA/BW,6BAA6B,KAA7B,6BAA6B,QA+BxC","sourcesContent":["/**\r\n * Defines the kind of contextual sources for node geometry\r\n */\r\nexport enum NodeGeometryContextualSources {\r\n /** None */\r\n None = 0x0000,\r\n /** Positions */\r\n Positions = 0x0001,\r\n /** Normals */\r\n Normals = 0x0002,\r\n /** Tangents */\r\n Tangents = 0x0003,\r\n /** UV */\r\n UV = 0x0004,\r\n /** UV2 */\r\n UV2 = 0x0005,\r\n /** UV3 */\r\n UV3 = 0x0006,\r\n /** UV4 */\r\n UV4 = 0x0007,\r\n /** UV5 */\r\n UV5 = 0x0008,\r\n /** UV6 */\r\n UV6 = 0x0009,\r\n /** Colors */\r\n Colors = 0x000a,\r\n /** VertexID */\r\n VertexID = 0x000b,\r\n /** FaceID */\r\n FaceID = 0x000c,\r\n /** GeometryID */\r\n GeometryID = 0x000d,\r\n /** CollectionID */\r\n CollectionID = 0x000e,\r\n}\r\n"]}
|
package/Meshes/Node/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./Blocks/conditionBlock";
|
|
|
30
30
|
export * from "./Blocks/randomBlock";
|
|
31
31
|
export * from "./Blocks/noiseBlock";
|
|
32
32
|
export * from "./Blocks/mergeGeometryBlock";
|
|
33
|
+
export * from "./Blocks/geometryCollectionBlock";
|
|
33
34
|
export * from "./Blocks/geometryElbowBlock";
|
|
34
35
|
export * from "./Blocks/computeNormalsBlock";
|
|
35
36
|
export * from "./Blocks/vectorConverterBlock";
|
|
@@ -45,7 +46,9 @@ export * from "./Blocks/Matrices/alignBlock";
|
|
|
45
46
|
export * from "./Blocks/Matrices/translationBlock";
|
|
46
47
|
export * from "./Blocks/Instances/instantiateOnVerticesBlock";
|
|
47
48
|
export * from "./Blocks/Instances/instantiateOnFacesBlock";
|
|
49
|
+
export * from "./Blocks/Instances/instantiateOnVolumeBlock";
|
|
48
50
|
export * from "./Blocks/intFloatConverterBlock";
|
|
49
51
|
export * from "./Blocks/debugBlock";
|
|
52
|
+
export * from "./Blocks/geometryInfoBlock";
|
|
50
53
|
export * from "./Blocks/Teleport/teleportInBlock";
|
|
51
54
|
export * from "./Blocks/Teleport/teleportOutBlock";
|
package/Meshes/Node/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./Blocks/conditionBlock.js";
|
|
|
30
30
|
export * from "./Blocks/randomBlock.js";
|
|
31
31
|
export * from "./Blocks/noiseBlock.js";
|
|
32
32
|
export * from "./Blocks/mergeGeometryBlock.js";
|
|
33
|
+
export * from "./Blocks/geometryCollectionBlock.js";
|
|
33
34
|
export * from "./Blocks/geometryElbowBlock.js";
|
|
34
35
|
export * from "./Blocks/computeNormalsBlock.js";
|
|
35
36
|
export * from "./Blocks/vectorConverterBlock.js";
|
|
@@ -45,8 +46,10 @@ export * from "./Blocks/Matrices/alignBlock.js";
|
|
|
45
46
|
export * from "./Blocks/Matrices/translationBlock.js";
|
|
46
47
|
export * from "./Blocks/Instances/instantiateOnVerticesBlock.js";
|
|
47
48
|
export * from "./Blocks/Instances/instantiateOnFacesBlock.js";
|
|
49
|
+
export * from "./Blocks/Instances/instantiateOnVolumeBlock.js";
|
|
48
50
|
export * from "./Blocks/intFloatConverterBlock.js";
|
|
49
51
|
export * from "./Blocks/debugBlock.js";
|
|
52
|
+
export * from "./Blocks/geometryInfoBlock.js";
|
|
50
53
|
export * from "./Blocks/Teleport/teleportInBlock.js";
|
|
51
54
|
export * from "./Blocks/Teleport/teleportOutBlock.js";
|
|
52
55
|
//# sourceMappingURL=index.js.map
|
package/Meshes/Node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBl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AkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\n"]}
|
|
@@ -16,6 +16,7 @@ export interface INodeGeometryEditorOptions {
|
|
|
16
16
|
nodeGeometryEditorConfig?: {
|
|
17
17
|
backgroundColor?: Color4;
|
|
18
18
|
hostScene?: Scene;
|
|
19
|
+
hostMesh?: Mesh;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
@@ -115,6 +116,12 @@ export declare class NodeGeometry {
|
|
|
115
116
|
* @returns The new mesh
|
|
116
117
|
*/
|
|
117
118
|
createMesh(name: string, scene?: Nullable<Scene>): Nullable<Mesh>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a mesh from the geometry blocks
|
|
121
|
+
* @param mesh the mesh to update
|
|
122
|
+
* @returns True if successfully updated
|
|
123
|
+
*/
|
|
124
|
+
updateMesh(mesh: Mesh): false | Mesh;
|
|
118
125
|
private _initializeBlock;
|
|
119
126
|
/**
|
|
120
127
|
* Clear the current geometry
|
|
@@ -192,6 +192,23 @@ export class NodeGeometry {
|
|
|
192
192
|
mesh._internalMetadata.nodeGeometry = this;
|
|
193
193
|
return mesh;
|
|
194
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Creates a mesh from the geometry blocks
|
|
197
|
+
* @param mesh the mesh to update
|
|
198
|
+
* @returns True if successfully updated
|
|
199
|
+
*/
|
|
200
|
+
updateMesh(mesh) {
|
|
201
|
+
if (!this._buildWasSuccessful) {
|
|
202
|
+
this.build();
|
|
203
|
+
}
|
|
204
|
+
if (!this._vertexData) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
this._vertexData.applyToMesh(mesh);
|
|
208
|
+
mesh._internalMetadata = mesh._internalMetadata || {};
|
|
209
|
+
mesh._internalMetadata.nodeGeometry = this;
|
|
210
|
+
return mesh;
|
|
211
|
+
}
|
|
195
212
|
_initializeBlock(node, autoConfigure = true) {
|
|
196
213
|
node.initialize();
|
|
197
214
|
if (autoConfigure) {
|