@babylonjs/core 6.20.2 → 6.21.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/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +16 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +7 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +19 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +49 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +57 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +126 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +42 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +98 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -0
- package/Meshes/Node/Blocks/boundingBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/boundingBlock.js +64 -0
- package/Meshes/Node/Blocks/boundingBlock.js.map +1 -0
- package/Meshes/Node/Blocks/debugBlock.js +1 -0
- package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInfoBlock.js +6 -5
- package/Meshes/Node/Blocks/geometryInfoBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mapRangeBlock.js +1 -0
- package/Meshes/Node/Blocks/mapRangeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +2 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/normalizeVectorBlock.js +1 -0
- package/Meshes/Node/Blocks/normalizeVectorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +2 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.d.ts +2 -0
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js +2 -0
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +9 -0
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.js +2 -0
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -0
- 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.js +0 -5
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/mesh.vertexData.js +6 -3
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +15 -16
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +16 -23
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +14 -19
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to fetch a color from texture data
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryTextureFetchBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Gets or sets a boolean indicating if coordinates should be clamped between 0 and 1
|
|
9
|
+
*/
|
|
10
|
+
clampCoordinates: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new GeometryTextureFetchBlock
|
|
13
|
+
* @param name defines the block name
|
|
14
|
+
*/
|
|
15
|
+
constructor(name: string);
|
|
16
|
+
/**
|
|
17
|
+
* Gets the current class name
|
|
18
|
+
* @returns the class name
|
|
19
|
+
*/
|
|
20
|
+
getClassName(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the texture component
|
|
23
|
+
*/
|
|
24
|
+
get texture(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the coordinates component
|
|
27
|
+
*/
|
|
28
|
+
get coordinates(): NodeGeometryConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the color component
|
|
31
|
+
*/
|
|
32
|
+
get color(): NodeGeometryConnectionPoint;
|
|
33
|
+
private _repeatClamp;
|
|
34
|
+
protected _buildBlock(): void;
|
|
35
|
+
protected _dumpPropertiesCode(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Serializes this block in a JSON representation
|
|
38
|
+
* @returns the serialized block object
|
|
39
|
+
*/
|
|
40
|
+
serialize(): any;
|
|
41
|
+
_deserialize(serializationObject: any): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { __decorate } from "../../../../tslib.es6.js";
|
|
2
|
+
import { Vector4 } from "../../../../Maths/math.vector.js";
|
|
3
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
4
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
6
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
7
|
+
/**
|
|
8
|
+
* Block used to fetch a color from texture data
|
|
9
|
+
*/
|
|
10
|
+
export class GeometryTextureFetchBlock extends NodeGeometryBlock {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new GeometryTextureFetchBlock
|
|
13
|
+
* @param name defines the block name
|
|
14
|
+
*/
|
|
15
|
+
constructor(name) {
|
|
16
|
+
super(name);
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets a boolean indicating if coordinates should be clamped between 0 and 1
|
|
19
|
+
*/
|
|
20
|
+
this.clampCoordinates = true;
|
|
21
|
+
this.registerInput("texture", NodeGeometryBlockConnectionPointTypes.Texture);
|
|
22
|
+
this.registerInput("coordinates", NodeGeometryBlockConnectionPointTypes.Vector2);
|
|
23
|
+
this.registerOutput("color", NodeGeometryBlockConnectionPointTypes.Vector4);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current class name
|
|
27
|
+
* @returns the class name
|
|
28
|
+
*/
|
|
29
|
+
getClassName() {
|
|
30
|
+
return "GeometryTextureFetchBlock";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the texture component
|
|
34
|
+
*/
|
|
35
|
+
get texture() {
|
|
36
|
+
return this.inputs[0];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the coordinates component
|
|
40
|
+
*/
|
|
41
|
+
get coordinates() {
|
|
42
|
+
return this.inputs[1];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the color component
|
|
46
|
+
*/
|
|
47
|
+
get color() {
|
|
48
|
+
return this._outputs[0];
|
|
49
|
+
}
|
|
50
|
+
_repeatClamp(num) {
|
|
51
|
+
if (num >= 0) {
|
|
52
|
+
return num % 1;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return 1 - (Math.abs(num) % 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_buildBlock() {
|
|
59
|
+
this.color._storedFunction = (state) => {
|
|
60
|
+
const textureData = this.texture.getConnectedValue(state);
|
|
61
|
+
if (!textureData || !textureData.data) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const uv = this.coordinates.getConnectedValue(state);
|
|
65
|
+
if (!uv) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const u = this.clampCoordinates ? Math.max(0, Math.min(uv.x, 1.0)) : this._repeatClamp(uv.x);
|
|
69
|
+
const v = this.clampCoordinates ? Math.max(0, Math.min(uv.y, 1.0)) : this._repeatClamp(uv.y);
|
|
70
|
+
const x = Math.floor(u * (textureData.width - 1));
|
|
71
|
+
const y = Math.floor(v * (textureData.height - 1));
|
|
72
|
+
const index = x + textureData.width * y;
|
|
73
|
+
return Vector4.FromArray(textureData.data, index * 4);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
_dumpPropertiesCode() {
|
|
77
|
+
const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.clampCoordinates = ${this.clampCoordinates};\n`;
|
|
78
|
+
return codeString;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Serializes this block in a JSON representation
|
|
82
|
+
* @returns the serialized block object
|
|
83
|
+
*/
|
|
84
|
+
serialize() {
|
|
85
|
+
const serializationObject = super.serialize();
|
|
86
|
+
serializationObject.clampCoordinates = this.clampCoordinates;
|
|
87
|
+
return serializationObject;
|
|
88
|
+
}
|
|
89
|
+
_deserialize(serializationObject) {
|
|
90
|
+
super._deserialize(serializationObject);
|
|
91
|
+
this.clampCoordinates = serializationObject.clampCoordinates;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
__decorate([
|
|
95
|
+
editableInPropertyPage("Clamp Coordinates", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
96
|
+
], GeometryTextureFetchBlock.prototype, "clampCoordinates", void 0);
|
|
97
|
+
RegisterClass("BABYLON.GeometryTextureFetchBlock", GeometryTextureFetchBlock);
|
|
98
|
+
//# sourceMappingURL=geometryTextureFetchBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryTextureFetchBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAgB,yCAA+B;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAO5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAXhB;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QACjF,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;IAChF,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO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B,CAAC,CAAC","sourcesContent":["import { Vector4, type Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryTextureData } from \"../../Interfaces/nodeGeometryTextureData\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to fetch a color from texture data\r\n */\r\nexport class GeometryTextureFetchBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating if coordinates should be clamped between 0 and 1\r\n */\r\n @editableInPropertyPage(\"Clamp Coordinates\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public clampCoordinates = true;\r\n\r\n /**\r\n * Creates a new GeometryTextureFetchBlock\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(\"texture\", NodeGeometryBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"coordinates\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"color\", NodeGeometryBlockConnectionPointTypes.Vector4);\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 \"GeometryTextureFetchBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture component\r\n */\r\n public get texture(): NodeGeometryConnectionPoint {\r\n return this.inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the coordinates component\r\n */\r\n public get coordinates(): NodeGeometryConnectionPoint {\r\n return this.inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color component\r\n */\r\n public get color(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _repeatClamp(num: number) {\r\n if (num >= 0) {\r\n return num % 1;\r\n } else {\r\n return 1 - (Math.abs(num) % 1);\r\n }\r\n }\r\n\r\n protected _buildBlock() {\r\n this.color._storedFunction = (state) => {\r\n const textureData = this.texture.getConnectedValue(state) as INodeGeometryTextureData;\r\n if (!textureData || !textureData.data) {\r\n return null;\r\n }\r\n\r\n const uv = this.coordinates.getConnectedValue(state) as Vector2;\r\n\r\n if (!uv) {\r\n return null;\r\n }\r\n\r\n const u = this.clampCoordinates ? Math.max(0, Math.min(uv.x, 1.0)) : this._repeatClamp(uv.x);\r\n const v = this.clampCoordinates ? Math.max(0, Math.min(uv.y, 1.0)) : this._repeatClamp(uv.y);\r\n\r\n const x = Math.floor(u * (textureData.width - 1));\r\n const y = Math.floor(v * (textureData.height - 1));\r\n const index = x + textureData.width * y;\r\n\r\n return Vector4.FromArray(textureData.data, index * 4);\r\n };\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.clampCoordinates = ${this.clampCoordinates};\\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.clampCoordinates = this.clampCoordinates;\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.clampCoordinates = serializationObject.clampCoordinates;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTextureFetchBlock\", GeometryTextureFetchBlock);\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to get the bounding info of a geometry
|
|
5
|
+
*/
|
|
6
|
+
export declare class BoundingBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new BoundingBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the geometry input component
|
|
19
|
+
*/
|
|
20
|
+
get geometry(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the min output component
|
|
23
|
+
*/
|
|
24
|
+
get min(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the max output component
|
|
27
|
+
*/
|
|
28
|
+
get max(): NodeGeometryConnectionPoint;
|
|
29
|
+
protected _buildBlock(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { extractMinAndMax } from "../../../Maths/math.functions.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to get the bounding info of a geometry
|
|
7
|
+
*/
|
|
8
|
+
export class BoundingBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Create a new BoundingBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
16
|
+
this.registerOutput("min", NodeGeometryBlockConnectionPointTypes.Vector3);
|
|
17
|
+
this.registerOutput("max", NodeGeometryBlockConnectionPointTypes.Vector3);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the current class name
|
|
21
|
+
* @returns the class name
|
|
22
|
+
*/
|
|
23
|
+
getClassName() {
|
|
24
|
+
return "BoundingBlock";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets the geometry input component
|
|
28
|
+
*/
|
|
29
|
+
get geometry() {
|
|
30
|
+
return this._inputs[0];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the min output component
|
|
34
|
+
*/
|
|
35
|
+
get min() {
|
|
36
|
+
return this._outputs[0];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the max output component
|
|
40
|
+
*/
|
|
41
|
+
get max() {
|
|
42
|
+
return this._outputs[1];
|
|
43
|
+
}
|
|
44
|
+
_buildBlock() {
|
|
45
|
+
this.min._storedFunction = (state) => {
|
|
46
|
+
const geometry = this.geometry.getConnectedValue(state);
|
|
47
|
+
if (!geometry) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);
|
|
51
|
+
return boundingInfo.minimum;
|
|
52
|
+
};
|
|
53
|
+
this.max._storedFunction = (state) => {
|
|
54
|
+
const geometry = this.geometry.getConnectedValue(state);
|
|
55
|
+
if (!geometry) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);
|
|
59
|
+
return boundingInfo.maximum;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
RegisterClass("BABYLON.BoundingBlock", BoundingBlock);
|
|
64
|
+
//# sourceMappingURL=boundingBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundingBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/boundingBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;A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AI,CAAC,GAAG,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAExD,IAAI,CAAC,QAAQ,EAAE;gBACX,OAAO,IAAI,CAAC;aACf;YAED,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,SAAU,EAAE,CAAC,EAAE,QAAQ,CAAC,SAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC9F,OAAO,YAAY,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,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 { extractMinAndMax } from \"../../../Maths/math.functions\";\r\n\r\n/**\r\n * Block used to get the bounding info of a geometry\r\n */\r\nexport class BoundingBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new BoundingBlock\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(\"min\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"max\", NodeGeometryBlockConnectionPointTypes.Vector3);\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 \"BoundingBlock\";\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 min output component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max output component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n protected _buildBlock() {\r\n this.min._storedFunction = (state) => {\r\n const geometry = this.geometry.getConnectedValue(state);\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n const boundingInfo = extractMinAndMax(geometry.positions!, 0, geometry.positions!.length / 3);\r\n return boundingInfo.minimum;\r\n };\r\n\r\n this.max._storedFunction = (state) => {\r\n const geometry = this.geometry.getConnectedValue(state);\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n const boundingInfo = extractMinAndMax(geometry.positions!, 0, geometry.positions!.length / 3);\r\n return boundingInfo.maximum;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoundingBlock\", BoundingBlock);\r\n"]}
|
|
@@ -20,6 +20,7 @@ export class DebugBlock extends NodeGeometryBlock {
|
|
|
20
20
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
21
21
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
22
22
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
23
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Gets the time spent to build this block (in ms)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/debugBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,UAA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AAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Defines a block used to debug values going through it\r\n */\r\nexport class DebugBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets the log entries\r\n */\r\n public log: string[] = [];\r\n\r\n /**\r\n * Create a new DebugBlock\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._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\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 \"DebugBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.log = [];\r\n this.output._storedFunction = (state) => {\r\n const input = this.input.getConnectedValue(state);\r\n\r\n if (input === null || input === undefined) {\r\n this.log.push(\"null\");\r\n return input;\r\n }\r\n\r\n this.log.push(input.toString());\r\n\r\n return input;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DebugBlock\", DebugBlock);\r\n"]}
|
|
@@ -76,22 +76,23 @@ export class GeometryInfoBlock extends NodeGeometryBlock {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
this.output._storedFunction = (state) => {
|
|
79
|
-
|
|
79
|
+
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
80
|
+
return this._currentVertexData;
|
|
80
81
|
};
|
|
81
82
|
this.id._storedFunction = (state) => {
|
|
82
|
-
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
83
|
+
this._currentVertexData = this._currentVertexData || this.geometry.getConnectedValue(state);
|
|
83
84
|
return this._currentVertexData.uniqueId;
|
|
84
85
|
};
|
|
85
86
|
this.collectionId._storedFunction = (state) => {
|
|
86
|
-
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
87
|
+
this._currentVertexData = this._currentVertexData || this.geometry.getConnectedValue(state);
|
|
87
88
|
return this._currentVertexData.metadata ? this._currentVertexData.metadata.collectionId : 0;
|
|
88
89
|
};
|
|
89
90
|
this.verticesCount._storedFunction = (state) => {
|
|
90
|
-
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
91
|
+
this._currentVertexData = this._currentVertexData || this.geometry.getConnectedValue(state);
|
|
91
92
|
return this._currentVertexData.positions ? this._currentVertexData.positions.length / 3 : 0;
|
|
92
93
|
};
|
|
93
94
|
this.facesCount._storedFunction = (state) => {
|
|
94
|
-
this._currentVertexData = this.geometry.getConnectedValue(state);
|
|
95
|
+
this._currentVertexData = this._currentVertexData || this.geometry.getConnectedValue(state);
|
|
95
96
|
return this._currentVertexData.indices ? this._currentVertexData.indices.length / 3 : 0;
|
|
96
97
|
};
|
|
97
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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kB,IAAK,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAgB,CAAC;YAC5G,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,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,kBAAkB,IAAK,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAgB,CAAC;YAC5G,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,kBAAkB,IAAK,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAgB,CAAC;YAC5G,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 this._currentVertexData = this.geometry.getConnectedValue(state) as VertexData;\r\n return this._currentVertexData;\r\n };\r\n this.id._storedFunction = (state: NodeGeometryBuildState) => {\r\n this._currentVertexData = 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._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._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._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"]}
|
|
@@ -33,6 +33,7 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
33
33
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
34
34
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
35
35
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
36
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Gets the current class name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.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,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAczD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlBR,oBAAe,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,mBAAc,GAAG,IAAI,MAAM,EAAE,CAAC;QAC9B,uBAAkB,GAAG,IAAI,MAAM,EAAE,CAAC;QAClC,2BAAsB,GAAG,IAAI,MAAM,EAAE,CAAC;QACtC,qBAAgB,GAAG,IAAI,MAAM,EAAE,CAAC;QAExC;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS1B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACvG,IAAI,CAAC,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B,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;AA1JU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC3F;AA4JlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,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 { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\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 GeometryTransformBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state);\r\n const rotation = this.rotation.getConnectedValue(state);\r\n const translation = this.translation.getConnectedValue(state);\r\n\r\n // Transform\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x, translation.y, translation.z, this._translationMatrix);\r\n\r\n this._scalingMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n 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.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.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,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAczD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlBR,oBAAe,GAAG,IAAI,MAAM,EAAE,CAAC;QAC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AAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC3F;AA6JlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,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 { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\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 GeometryTransformBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state);\r\n const rotation = this.rotation.getConnectedValue(state);\r\n const translation = this.translation.getConnectedValue(state);\r\n\r\n // Transform\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x, translation.y, translation.z, this._translationMatrix);\r\n\r\n this._scalingMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n 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.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
|
|
@@ -67,6 +67,7 @@ export class GeometryTrigonometryBlock extends NodeGeometryBlock {
|
|
|
67
67
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
68
68
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
69
69
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
70
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
73
|
* Gets the current class name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCAuCX;AAvCD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,YAAY;IACZ,+FAAK,CAAA;IACL,YAAY;IACZ,+FAAK,CAAA;IACL,cAAc;IACd,mGAAO,CAAA;IACP,kBAAkB;IAClB,6FAAI,CAAA;IACJ,UAAU;IACV,2FAAG,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,KAAK,EAAE,mCAAmC,CAAC,GAAG,EAAE;YAChE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mCAAmC,CAAC,GAAG,EAAE;YAChE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,mCAAmC,CAAC,IAAI,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,CAAC,QAAQ,EAAE;YAC1E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,CAAC,UAAU,EAAE;YAC9E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;SAC/E;KACJ,CAAC;4DACyD;AAwL/D,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.input._storedFunction = null;\r\n this.input._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func!(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func!(source.x), func!(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func!(source.x), func!(source.y), func!(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func!(source.x), func!(source.y), func!(source.z), func!(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\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.operation = serializationObject.operation;\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCAuCX;AAvCD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,YAAY;IACZ,+FAAK,CAAA;IACL,YAAY;IACZ,+FAAK,CAAA;IACL,cAAc;IACd,mGAAO,CAAA;IACP,kBAAkB;IAClB,6FAAI,CAAA;IACJ,UAAU;IACV,2FAAG,CAAA;IACH,cAAc;IACd,2FAAG,CAAA;IACH,kBAAkB;IAClB,kGAAM,CAAA;IACN,kBAAkB;IAClB,kGAAM,CAAA;IACN,gBAAgB;IAChB,kGAAM,CAAA;IACN,WAAW;IACX,8FAAI,CAAA;IACJ,aAAa;IACb,kGAAM,CAAA;IACN,eAAe;IACf,sGAAQ,CAAA;IACR,iBAAiB;IACjB,0GAAU,CAAA;IACV,gBAAgB;IAChB,wGAAS,CAAA;IACT,gBAAgB;IAChB,wGAAS,CAAA;AACb,CAAC,EAvCW,mCAAmC,KAAnC,mCAAmC,QAuC9C;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IA8B5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlChB;;WAEG;QAyBI,cAAS,GA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AClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,CAAC,QAAQ,EAAE;YAC1E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,CAAC,UAAU,EAAE;YAC9E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;SAC/E;KACJ,CAAC;4DACyD;AAyL/D,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.input._storedFunction = null;\r\n this.input._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func!(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func!(source.x), func!(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func!(source.x), func!(source.y), func!(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func!(source.x), func!(source.y), func!(source.z), func!(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\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.operation = serializationObject.operation;\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
|
|
@@ -22,6 +22,7 @@ export class MapRangeBlock extends NodeGeometryBlock {
|
|
|
22
22
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector4);
|
|
23
23
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
24
24
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
25
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
25
26
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
26
27
|
}
|
|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,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACtD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAElD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;YAEnF,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,qCAAqC,CAAC,GAAG,EAAE;gBAChE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC7B;YAED,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Defines a block used to move a value from a range to another\r\n */\r\nexport class MapRangeBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new MapRangeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"fromMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"fromMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"toMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"toMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._outputs[0]._typeConnectionSource = this._inputs[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 \"MapRangeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the fromMin input component\r\n */\r\n public get fromMin(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the fromMax input component\r\n */\r\n public get fromMax(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the toMin input component\r\n */\r\n public get toMin(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the toMax input component\r\n */\r\n public get toMax(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const fromMin = this.fromMin.getConnectedValue(state);\r\n const fromMax = this.fromMax.getConnectedValue(state);\r\n const toMin = this.toMin.getConnectedValue(state);\r\n const toMax = this.toMax.getConnectedValue(state);\r\n\r\n const result = ((value - fromMin) / (fromMax - fromMin)) * (toMax - toMin) + toMin;\r\n\r\n if (this.output.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return Math.floor(result);\r\n }\r\n\r\n return result;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MapRangeBlock\", MapRangeBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"mapRangeBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mapRangeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpF,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpF,IAAI,CAAC,aAAa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AEnF,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,qCAAqC,CAAC,GAAG,EAAE;gBAChE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC7B;YAED,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Defines a block used to move a value from a range to another\r\n */\r\nexport class MapRangeBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new MapRangeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"fromMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"fromMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"toMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"toMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n this._outputs[0]._typeConnectionSource = this._inputs[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 \"MapRangeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the fromMin input component\r\n */\r\n public get fromMin(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the fromMax input component\r\n */\r\n public get fromMax(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the toMin input component\r\n */\r\n public get toMin(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the toMax input component\r\n */\r\n public get toMax(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const fromMin = this.fromMin.getConnectedValue(state);\r\n const fromMax = this.fromMax.getConnectedValue(state);\r\n const toMin = this.toMin.getConnectedValue(state);\r\n const toMax = this.toMax.getConnectedValue(state);\r\n\r\n const result = ((value - fromMin) / (fromMax - fromMin)) * (toMax - toMin) + toMin;\r\n\r\n if (this.output.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return Math.floor(result);\r\n }\r\n\r\n return result;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MapRangeBlock\", MapRangeBlock);\r\n"]}
|
|
@@ -42,8 +42,10 @@ export class MathBlock extends NodeGeometryBlock {
|
|
|
42
42
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
43
43
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
44
44
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
45
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
45
46
|
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
46
47
|
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
48
|
+
this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
47
49
|
this._inputs[1].acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
48
50
|
this._linkConnectionTypes(0, 1);
|
|
49
51
|
}
|