@babylonjs/core 6.22.0 → 6.22.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/Behaviors/Meshes/pointerDragBehavior.d.ts +4 -3
- package/Behaviors/Meshes/pointerDragBehavior.js +4 -3
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +2 -2
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/{flowGraphConditionalBlock.js → flowGraphBranchBlock.js} +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +23 -0
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +18 -0
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +1 -0
- package/Gizmos/boundingBoxGizmo.js +13 -11
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +3 -1
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +5 -0
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +4 -0
- package/Gizmos/positionGizmo.js +6 -0
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +4 -0
- package/Gizmos/rotationGizmo.js +6 -0
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +4 -0
- package/Gizmos/scaleGizmo.js +6 -0
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Maths/math.vector.js +3 -3
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +58 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +135 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -0
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +0 -2
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/csg.d.ts +169 -1
- package/Meshes/csg.js +107 -43
- package/Meshes/csg.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +6 -0
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/package.json +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphConditionalBlock.js.map +0 -1
- /package/FlowGraph/Blocks/Execution/ControlFlow/{flowGraphConditionalBlock.d.ts → flowGraphBranchBlock.d.ts} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
import type { NodeGeometryBuildState } from "../nodeGeometryBuildState";
|
|
4
|
+
/**
|
|
5
|
+
* Operations supported by the boolean block
|
|
6
|
+
*/
|
|
7
|
+
export declare enum BooleanGeometryOperations {
|
|
8
|
+
/** Intersect */
|
|
9
|
+
Intersect = 0,
|
|
10
|
+
/** Subtract */
|
|
11
|
+
Subtract = 1,
|
|
12
|
+
/** Union */
|
|
13
|
+
Union = 2
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Block used to apply a boolean operation between 2 geometries
|
|
17
|
+
*/
|
|
18
|
+
export declare class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
19
|
+
/**
|
|
20
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
21
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
22
|
+
*/
|
|
23
|
+
evaluateContext: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Gets or sets the operation applied by the block
|
|
26
|
+
*/
|
|
27
|
+
operation: BooleanGeometryOperations;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new BooleanGeometryBlock
|
|
30
|
+
* @param name defines the block name
|
|
31
|
+
*/
|
|
32
|
+
constructor(name: string);
|
|
33
|
+
/**
|
|
34
|
+
* Gets the current class name
|
|
35
|
+
* @returns the class name
|
|
36
|
+
*/
|
|
37
|
+
getClassName(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the geometry0 input component
|
|
40
|
+
*/
|
|
41
|
+
get geometry0(): NodeGeometryConnectionPoint;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the geometry1 input component
|
|
44
|
+
*/
|
|
45
|
+
get geometry1(): NodeGeometryConnectionPoint;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the geometry output component
|
|
48
|
+
*/
|
|
49
|
+
get output(): NodeGeometryConnectionPoint;
|
|
50
|
+
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
51
|
+
protected _dumpPropertiesCode(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Serializes this block in a JSON representation
|
|
54
|
+
* @returns the serialized block object
|
|
55
|
+
*/
|
|
56
|
+
serialize(): any;
|
|
57
|
+
_deserialize(serializationObject: any): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { __decorate } from "../../../tslib.es6.js";
|
|
2
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
3
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
4
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
+
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
|
+
import { CSG } from "../../csg.js";
|
|
7
|
+
/**
|
|
8
|
+
* Operations supported by the boolean block
|
|
9
|
+
*/
|
|
10
|
+
export var BooleanGeometryOperations;
|
|
11
|
+
(function (BooleanGeometryOperations) {
|
|
12
|
+
/** Intersect */
|
|
13
|
+
BooleanGeometryOperations[BooleanGeometryOperations["Intersect"] = 0] = "Intersect";
|
|
14
|
+
/** Subtract */
|
|
15
|
+
BooleanGeometryOperations[BooleanGeometryOperations["Subtract"] = 1] = "Subtract";
|
|
16
|
+
/** Union */
|
|
17
|
+
BooleanGeometryOperations[BooleanGeometryOperations["Union"] = 2] = "Union";
|
|
18
|
+
})(BooleanGeometryOperations || (BooleanGeometryOperations = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Block used to apply a boolean operation between 2 geometries
|
|
21
|
+
*/
|
|
22
|
+
export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
23
|
+
/**
|
|
24
|
+
* Create a new BooleanGeometryBlock
|
|
25
|
+
* @param name defines the block name
|
|
26
|
+
*/
|
|
27
|
+
constructor(name) {
|
|
28
|
+
super(name);
|
|
29
|
+
/**
|
|
30
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
31
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
32
|
+
*/
|
|
33
|
+
this.evaluateContext = false;
|
|
34
|
+
/**
|
|
35
|
+
* Gets or sets the operation applied by the block
|
|
36
|
+
*/
|
|
37
|
+
this.operation = BooleanGeometryOperations.Intersect;
|
|
38
|
+
this.registerInput("geometry0", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
39
|
+
this.registerInput("geometry1", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
40
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the current class name
|
|
44
|
+
* @returns the class name
|
|
45
|
+
*/
|
|
46
|
+
getClassName() {
|
|
47
|
+
return "BooleanGeometryBlock";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets the geometry0 input component
|
|
51
|
+
*/
|
|
52
|
+
get geometry0() {
|
|
53
|
+
return this._inputs[0];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets the geometry1 input component
|
|
57
|
+
*/
|
|
58
|
+
get geometry1() {
|
|
59
|
+
return this._inputs[1];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets the geometry output component
|
|
63
|
+
*/
|
|
64
|
+
get output() {
|
|
65
|
+
return this._outputs[0];
|
|
66
|
+
}
|
|
67
|
+
_buildBlock(state) {
|
|
68
|
+
const func = (state) => {
|
|
69
|
+
const vertexData0 = this.geometry0.getConnectedValue(state);
|
|
70
|
+
const vertexData1 = this.geometry1.getConnectedValue(state);
|
|
71
|
+
if (!vertexData0 || !vertexData1) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const CSG0 = CSG.FromVertexData(vertexData0);
|
|
75
|
+
const CSG1 = CSG.FromVertexData(vertexData1);
|
|
76
|
+
let boolCSG;
|
|
77
|
+
switch (this.operation) {
|
|
78
|
+
case BooleanGeometryOperations.Intersect:
|
|
79
|
+
boolCSG = CSG0.intersect(CSG1);
|
|
80
|
+
break;
|
|
81
|
+
case BooleanGeometryOperations.Subtract:
|
|
82
|
+
boolCSG = CSG0.subtract(CSG1);
|
|
83
|
+
break;
|
|
84
|
+
case BooleanGeometryOperations.Union:
|
|
85
|
+
boolCSG = CSG0.union(CSG1);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return boolCSG.toVertexData();
|
|
89
|
+
};
|
|
90
|
+
if (this.evaluateContext) {
|
|
91
|
+
this.output._storedFunction = func;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.output._storedFunction = null;
|
|
95
|
+
this.output._storedValue = func(state);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
_dumpPropertiesCode() {
|
|
99
|
+
let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
100
|
+
codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\n`;
|
|
101
|
+
return codeString;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Serializes this block in a JSON representation
|
|
105
|
+
* @returns the serialized block object
|
|
106
|
+
*/
|
|
107
|
+
serialize() {
|
|
108
|
+
const serializationObject = super.serialize();
|
|
109
|
+
serializationObject.evaluateContext = this.evaluateContext;
|
|
110
|
+
serializationObject.operation = this.operation;
|
|
111
|
+
return serializationObject;
|
|
112
|
+
}
|
|
113
|
+
_deserialize(serializationObject) {
|
|
114
|
+
super._deserialize(serializationObject);
|
|
115
|
+
this.evaluateContext = serializationObject.evaluateContext;
|
|
116
|
+
if (serializationObject.operation) {
|
|
117
|
+
this.operation = serializationObject.operation;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
__decorate([
|
|
122
|
+
editableInPropertyPage("Evaluate context", PropertyTypeForEdition.Boolean, "ADVANCED", { notifiers: { rebuild: true } })
|
|
123
|
+
], BooleanGeometryBlock.prototype, "evaluateContext", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
editableInPropertyPage("Operation", PropertyTypeForEdition.List, "ADVANCED", {
|
|
126
|
+
notifiers: { rebuild: true },
|
|
127
|
+
options: [
|
|
128
|
+
{ label: "Intersect", value: BooleanGeometryOperations.Intersect },
|
|
129
|
+
{ label: "Subtract", value: BooleanGeometryOperations.Subtract },
|
|
130
|
+
{ label: "Union", value: BooleanGeometryOperations.Union },
|
|
131
|
+
],
|
|
132
|
+
})
|
|
133
|
+
], BooleanGeometryBlock.prototype, "operation", void 0);
|
|
134
|
+
RegisterClass("BABYLON.BooleanGeometryBlock", BooleanGeometryBlock);
|
|
135
|
+
//# sourceMappingURL=booleanGeometryBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booleanGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/booleanGeometryBlock.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;AAGlG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,GAAG,EAAE,qBAAwB;AAEtC;;GAEG;AACH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACjC,gBAAgB;IAChB,mFAAS,CAAA;IACT,eAAe;IACf,iFAAQ,CAAA;IACR,YAAY;IACZ,2EAAK,CAAA;AACT,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAqBvD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAzBhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAE/B;;WAEG;QASI,cAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC;QASnD,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAEhF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,C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,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE;SAC7D;KACJ,CAAC;uDACqD;AA8G3D,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,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\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { CSG } from \"core/Meshes/csg\";\r\n\r\n/**\r\n * Operations supported by the boolean block\r\n */\r\nexport enum BooleanGeometryOperations {\r\n /** Intersect */\r\n Intersect,\r\n /** Subtract */\r\n Subtract,\r\n /** Union */\r\n Union,\r\n}\r\n\r\n/**\r\n * Block used to apply a boolean operation between 2 geometries\r\n */\r\nexport class BooleanGeometryBlock extends NodeGeometryBlock {\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 = false;\r\n\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: \"Intersect\", value: BooleanGeometryOperations.Intersect },\r\n { label: \"Subtract\", value: BooleanGeometryOperations.Subtract },\r\n { label: \"Union\", value: BooleanGeometryOperations.Union },\r\n ],\r\n })\r\n public operation = BooleanGeometryOperations.Intersect;\r\n\r\n /**\r\n * Create a new BooleanGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this.registerOutput(\"output\", 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 \"BooleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexData0 = this.geometry0.getConnectedValue(state) as VertexData;\r\n const vertexData1 = this.geometry1.getConnectedValue(state) as VertexData;\r\n\r\n if (!vertexData0 || !vertexData1) {\r\n return null;\r\n }\r\n\r\n const CSG0 = CSG.FromVertexData(vertexData0);\r\n const CSG1 = CSG.FromVertexData(vertexData1);\r\n\r\n let boolCSG: CSG;\r\n\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.union(CSG1);\r\n break;\r\n }\r\n\r\n return boolCSG.toVertexData();\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 let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\\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 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.evaluateContext = serializationObject.evaluateContext;\r\n if (serializationObject.operation) {\r\n this.operation = serializationObject.operation;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BooleanGeometryBlock\", BooleanGeometryBlock);\r\n"]}
|
|
@@ -24,8 +24,6 @@ export class MergeGeometryBlock extends NodeGeometryBlock {
|
|
|
24
24
|
this.registerInput("geometry3", NodeGeometryBlockConnectionPointTypes.Geometry, true);
|
|
25
25
|
this.registerInput("geometry4", NodeGeometryBlockConnectionPointTypes.Geometry, true);
|
|
26
26
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
27
|
-
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
28
|
-
this._linkConnectionTypes(0, 1);
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
29
|
* Gets the current class name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/merge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,IAAI,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;IAES,mBAAmB;QACzB,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY,CAAC,mBAAwB;QACxC,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AA1HU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC1F;AA4HnC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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 \"../../../Meshes/mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to merge several geometries\r\n */\r\nexport class MergeGeometryBlock extends NodeGeometryBlock {\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 = false;\r\n\r\n /**\r\n * Create a new MergeGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n\r\n this.registerOutput(\"output\", 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 \"MergeGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry2 input component\r\n */\r\n public get geometry2(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry3 input component\r\n */\r\n public get geometry3(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the geometry4 input component\r\n */\r\n public get geometry4(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n let vertexData = this.geometry0.getConnectedValue(state) as VertexData;\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n if (this.geometry1.isConnected) {\r\n additionalVertexData.push(this.geometry1.getConnectedValue(state));\r\n }\r\n if (this.geometry2.isConnected) {\r\n additionalVertexData.push(this.geometry2.getConnectedValue(state));\r\n }\r\n if (this.geometry3.isConnected) {\r\n additionalVertexData.push(this.geometry3.getConnectedValue(state));\r\n }\r\n if (this.geometry4.isConnected) {\r\n additionalVertexData.push(this.geometry4.getConnectedValue(state));\r\n }\r\n\r\n if (additionalVertexData.length && vertexData) {\r\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\r\n }\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n 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 this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MergeGeometryBlock\", MergeGeometryBlock);\r\n"]}
|
package/Meshes/Node/index.d.ts
CHANGED
package/Meshes/Node/index.js
CHANGED
|
@@ -58,4 +58,5 @@ export * from "./Blocks/Teleport/teleportOutBlock.js";
|
|
|
58
58
|
export * from "./Blocks/Textures/geometryTextureBlock.js";
|
|
59
59
|
export * from "./Blocks/Textures/geometryTextureFetchBlock.js";
|
|
60
60
|
export * from "./Blocks/boundingBlock.js";
|
|
61
|
+
export * from "./Blocks/booleanGeometryBlock.js";
|
|
61
62
|
//# 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,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\n"]}
|
package/Meshes/csg.d.ts
CHANGED
|
@@ -1,8 +1,163 @@
|
|
|
1
1
|
import type { Nullable } from "../types";
|
|
2
2
|
import type { Scene } from "../scene";
|
|
3
|
-
import { Quaternion, Matrix, Vector3 } from "../Maths/math.vector";
|
|
3
|
+
import { Quaternion, Matrix, Vector3, Vector2 } from "../Maths/math.vector";
|
|
4
4
|
import { Mesh } from "../Meshes/mesh";
|
|
5
5
|
import type { Material } from "../Materials/material";
|
|
6
|
+
import { Color4 } from "../Maths/math.color";
|
|
7
|
+
import { VertexData } from "./mesh.vertexData";
|
|
8
|
+
/**
|
|
9
|
+
* Represents a vertex of a polygon. Use your own vertex class instead of this
|
|
10
|
+
* one to provide additional features like texture coordinates and vertex
|
|
11
|
+
* colors. Custom vertex classes need to provide a `pos` property and `clone()`,
|
|
12
|
+
* `flip()`, and `interpolate()` methods that behave analogous to the ones
|
|
13
|
+
* defined by `BABYLON.CSG.Vertex`. This class provides `normal` so convenience
|
|
14
|
+
* functions like `BABYLON.CSG.sphere()` can return a smooth vertex normal, but `normal`
|
|
15
|
+
* is not used anywhere else.
|
|
16
|
+
* Same goes for uv, it allows to keep the original vertex uv coordinates of the 2 meshes
|
|
17
|
+
*/
|
|
18
|
+
declare class Vertex {
|
|
19
|
+
/**
|
|
20
|
+
* The position of the vertex
|
|
21
|
+
*/
|
|
22
|
+
pos: Vector3;
|
|
23
|
+
/**
|
|
24
|
+
* The normal of the vertex
|
|
25
|
+
*/
|
|
26
|
+
normal: Vector3;
|
|
27
|
+
/**
|
|
28
|
+
* The texture coordinate of the vertex
|
|
29
|
+
*/
|
|
30
|
+
uv?: Vector2 | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The texture coordinate of the vertex
|
|
33
|
+
*/
|
|
34
|
+
vertColor?: Color4 | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Initializes the vertex
|
|
37
|
+
* @param pos The position of the vertex
|
|
38
|
+
* @param normal The normal of the vertex
|
|
39
|
+
* @param uv The texture coordinate of the vertex
|
|
40
|
+
* @param vertColor The RGBA color of the vertex
|
|
41
|
+
*/
|
|
42
|
+
constructor(
|
|
43
|
+
/**
|
|
44
|
+
* The position of the vertex
|
|
45
|
+
*/
|
|
46
|
+
pos: Vector3,
|
|
47
|
+
/**
|
|
48
|
+
* The normal of the vertex
|
|
49
|
+
*/
|
|
50
|
+
normal: Vector3,
|
|
51
|
+
/**
|
|
52
|
+
* The texture coordinate of the vertex
|
|
53
|
+
*/
|
|
54
|
+
uv?: Vector2 | undefined,
|
|
55
|
+
/**
|
|
56
|
+
* The texture coordinate of the vertex
|
|
57
|
+
*/
|
|
58
|
+
vertColor?: Color4 | undefined);
|
|
59
|
+
/**
|
|
60
|
+
* Make a clone, or deep copy, of the vertex
|
|
61
|
+
* @returns A new Vertex
|
|
62
|
+
*/
|
|
63
|
+
clone(): Vertex;
|
|
64
|
+
/**
|
|
65
|
+
* Invert all orientation-specific data (e.g. vertex normal). Called when the
|
|
66
|
+
* orientation of a polygon is flipped.
|
|
67
|
+
*/
|
|
68
|
+
flip(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Create a new vertex between this vertex and `other` by linearly
|
|
71
|
+
* interpolating all properties using a parameter of `t`. Subclasses should
|
|
72
|
+
* override this to interpolate additional properties.
|
|
73
|
+
* @param other the vertex to interpolate against
|
|
74
|
+
* @param t The factor used to linearly interpolate between the vertices
|
|
75
|
+
*/
|
|
76
|
+
interpolate(other: Vertex, t: number): Vertex;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Represents a plane in 3D space.
|
|
80
|
+
*/
|
|
81
|
+
declare class Plane {
|
|
82
|
+
normal: Vector3;
|
|
83
|
+
w: number;
|
|
84
|
+
/**
|
|
85
|
+
* Initializes the plane
|
|
86
|
+
* @param normal The normal for the plane
|
|
87
|
+
* @param w
|
|
88
|
+
*/
|
|
89
|
+
constructor(normal: Vector3, w: number);
|
|
90
|
+
/**
|
|
91
|
+
* `CSG.Plane.EPSILON` is the tolerance used by `splitPolygon()` to decide if a
|
|
92
|
+
* point is on the plane
|
|
93
|
+
*/
|
|
94
|
+
static EPSILON: number;
|
|
95
|
+
/**
|
|
96
|
+
* Construct a plane from three points
|
|
97
|
+
* @param a Point a
|
|
98
|
+
* @param b Point b
|
|
99
|
+
* @param c Point c
|
|
100
|
+
*/
|
|
101
|
+
static FromPoints(a: Vector3, b: Vector3, c: Vector3): Nullable<Plane>;
|
|
102
|
+
/**
|
|
103
|
+
* Clone, or make a deep copy of the plane
|
|
104
|
+
* @returns a new Plane
|
|
105
|
+
*/
|
|
106
|
+
clone(): Plane;
|
|
107
|
+
/**
|
|
108
|
+
* Flip the face of the plane
|
|
109
|
+
*/
|
|
110
|
+
flip(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Split `polygon` by this plane if needed, then put the polygon or polygon
|
|
113
|
+
* fragments in the appropriate lists. Coplanar polygons go into either
|
|
114
|
+
`* coplanarFront` or `coplanarBack` depending on their orientation with
|
|
115
|
+
* respect to this plane. Polygons in front or in back of this plane go into
|
|
116
|
+
* either `front` or `back`
|
|
117
|
+
* @param polygon The polygon to be split
|
|
118
|
+
* @param coplanarFront Will contain polygons coplanar with the plane that are oriented to the front of the plane
|
|
119
|
+
* @param coplanarBack Will contain polygons coplanar with the plane that are oriented to the back of the plane
|
|
120
|
+
* @param front Will contain the polygons in front of the plane
|
|
121
|
+
* @param back Will contain the polygons begind the plane
|
|
122
|
+
*/
|
|
123
|
+
splitPolygon(polygon: Polygon, coplanarFront: Polygon[], coplanarBack: Polygon[], front: Polygon[], back: Polygon[]): void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Represents a convex polygon. The vertices used to initialize a polygon must
|
|
127
|
+
* be coplanar and form a convex loop.
|
|
128
|
+
*
|
|
129
|
+
* Each convex polygon has a `shared` property, which is shared between all
|
|
130
|
+
* polygons that are clones of each other or were split from the same polygon.
|
|
131
|
+
* This can be used to define per-polygon properties (such as surface color)
|
|
132
|
+
*/
|
|
133
|
+
declare class Polygon {
|
|
134
|
+
/**
|
|
135
|
+
* Vertices of the polygon
|
|
136
|
+
*/
|
|
137
|
+
vertices: Vertex[];
|
|
138
|
+
/**
|
|
139
|
+
* Properties that are shared across all polygons
|
|
140
|
+
*/
|
|
141
|
+
shared: any;
|
|
142
|
+
/**
|
|
143
|
+
* A plane formed from the vertices of the polygon
|
|
144
|
+
*/
|
|
145
|
+
plane: Plane;
|
|
146
|
+
/**
|
|
147
|
+
* Initializes the polygon
|
|
148
|
+
* @param vertices The vertices of the polygon
|
|
149
|
+
* @param shared The properties shared across all polygons
|
|
150
|
+
*/
|
|
151
|
+
constructor(vertices: Vertex[], shared: any);
|
|
152
|
+
/**
|
|
153
|
+
* Clones, or makes a deep copy, or the polygon
|
|
154
|
+
*/
|
|
155
|
+
clone(): Polygon;
|
|
156
|
+
/**
|
|
157
|
+
* Flips the faces of the polygon
|
|
158
|
+
*/
|
|
159
|
+
flip(): void;
|
|
160
|
+
}
|
|
6
161
|
/**
|
|
7
162
|
* Class for building Constructive Solid Geometry
|
|
8
163
|
*/
|
|
@@ -28,6 +183,12 @@ export declare class CSG {
|
|
|
28
183
|
* Stores the scaling vector
|
|
29
184
|
*/
|
|
30
185
|
scaling: Vector3;
|
|
186
|
+
/**
|
|
187
|
+
* Convert a VertexData to CSG
|
|
188
|
+
* @param mesh defines the VertexData to convert to CSG
|
|
189
|
+
* @returns the new CSG
|
|
190
|
+
*/
|
|
191
|
+
static FromVertexData(data: VertexData): CSG;
|
|
31
192
|
/**
|
|
32
193
|
* Convert the Mesh to CSG
|
|
33
194
|
* @param mesh The Mesh to convert to CSG
|
|
@@ -96,6 +257,12 @@ export declare class CSG {
|
|
|
96
257
|
* @returns This CSG
|
|
97
258
|
*/
|
|
98
259
|
copyTransformAttributes(csg: CSG): CSG;
|
|
260
|
+
/**
|
|
261
|
+
* Build vertex data from CSG
|
|
262
|
+
* Coordinates here are in world space
|
|
263
|
+
* @returns the final vertex data
|
|
264
|
+
*/
|
|
265
|
+
toVertexData(onBeforePolygonProcessing?: Nullable<(polygon: Polygon) => void>, onAfterPolygonProcessing?: Nullable<() => void>): VertexData;
|
|
99
266
|
/**
|
|
100
267
|
* Build Raw mesh from CSG
|
|
101
268
|
* Coordinates here are in world space
|
|
@@ -115,3 +282,4 @@ export declare class CSG {
|
|
|
115
282
|
*/
|
|
116
283
|
toMesh(name: string, material?: Nullable<Material>, scene?: Scene, keepSubMeshes?: boolean): Mesh;
|
|
117
284
|
}
|
|
285
|
+
export {};
|