@babylonjs/core 6.16.0 → 6.16.2
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/Bones/boneIKController.js +1 -0
- package/Bones/boneIKController.js.map +1 -1
- package/Debug/axesViewer.js +3 -3
- package/Debug/axesViewer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +2 -1
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +13 -5
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -3
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +6 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/greasedLinePluginMaterial.d.ts +96 -4
- package/Materials/greasedLinePluginMaterial.js +15 -6
- package/Materials/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/greasedLineSimpleMaterial.d.ts +228 -0
- package/Materials/greasedLineSimpleMaterial.js +435 -0
- package/Materials/greasedLineSimpleMaterial.js.map +1 -0
- package/Materials/material.decalMapConfiguration.js +2 -0
- package/Materials/material.decalMapConfiguration.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.d.ts +66 -17
- package/Materials/meshDebugPluginMaterial.js +65 -75
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +3 -2
- package/Meshes/Builders/greasedLineBuilder.js +26 -15
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Builders/textBuilder.d.ts +6 -0
- package/Meshes/Builders/textBuilder.js +5 -0
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +9 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +3 -3
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +4 -4
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +22 -0
- package/Meshes/Node/Blocks/Sources/nullBlock.js +34 -0
- package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +9 -6
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/debugBlock.js +1 -1
- package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +33 -1
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +43 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +118 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryOutputBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryOutputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +8 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +20 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +4 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/{IntFloatConverterBlock.js → intFloatConverterBlock.js} +1 -1
- package/Meshes/Node/Blocks/{IntFloatConverterBlock.js.map → intFloatConverterBlock.js.map} +1 -1
- package/Meshes/Node/Blocks/mathBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +6 -2
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/noiseBlock.js +2 -2
- package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/normalizeVectorBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/normalizeVectorBlock.js +1 -1
- package/Meshes/Node/Blocks/normalizeVectorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.d.ts +2 -2
- package/Meshes/Node/Blocks/randomBlock.js +7 -2
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/Blocks/vectorConverterBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/vectorConverterBlock.js +35 -7
- package/Meshes/Node/Blocks/vectorConverterBlock.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.d.ts +5 -5
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js +5 -5
- package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +1 -3
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js +0 -2
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.d.ts +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.js.map +1 -1
- package/Meshes/Node/index.d.ts +3 -1
- package/Meshes/Node/index.js +3 -1
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +3 -2
- package/Meshes/Node/nodeGeometry.js +10 -9
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +7 -1
- package/Meshes/Node/nodeGeometryBlock.js +26 -6
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.d.ts +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +3 -3
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/greasedLineMesh.d.ts +4 -2
- package/Meshes/greasedLineMesh.js +26 -2
- package/Meshes/greasedLineMesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +1 -1
- package/Misc/greasedLineTools.js +1 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Shaders/greasedLine.fragment.d.ts +5 -0
- package/Shaders/greasedLine.fragment.js +16 -0
- package/Shaders/greasedLine.fragment.js.map +1 -0
- package/Shaders/greasedLine.vertex.d.ts +5 -0
- package/Shaders/greasedLine.vertex.js +19 -0
- package/Shaders/greasedLine.vertex.js.map +1 -0
- package/package.json +1 -1
- /package/Meshes/Node/Blocks/{IntFloatConverterBlock.d.ts → intFloatConverterBlock.d.ts} +0 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { Engine } from "../Engines/engine.js";
|
|
2
|
+
import { RawTexture } from "./Textures/rawTexture.js";
|
|
3
|
+
import { GreasedLineMeshColorMode, GreasedLineMeshColorDistributionType } from "./greasedLinePluginMaterial.js";
|
|
4
|
+
import { ShaderMaterial } from "./shaderMaterial.js";
|
|
5
|
+
import { Color3 } from "../Maths/math.color.js";
|
|
6
|
+
import { Vector2 } from "../Maths/math.vector.js";
|
|
7
|
+
import "../Shaders/greasedLine.fragment.js";
|
|
8
|
+
import "../Shaders/greasedLine.vertex.js";
|
|
9
|
+
/**
|
|
10
|
+
* GreasedLineSimpleMaterial
|
|
11
|
+
*/
|
|
12
|
+
export class GreasedLineSimpleMaterial extends ShaderMaterial {
|
|
13
|
+
/**
|
|
14
|
+
* GreasedLineSimple material constructor
|
|
15
|
+
* @param name material name
|
|
16
|
+
* @param scene the scene
|
|
17
|
+
* @param options material options
|
|
18
|
+
*/
|
|
19
|
+
constructor(name, scene, options) {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
21
|
+
super(name, scene, {
|
|
22
|
+
vertex: "greasedLine",
|
|
23
|
+
fragment: "greasedLine",
|
|
24
|
+
}, {
|
|
25
|
+
attributes: ["position", "normal", "grl_previousAndSide", "grl_nextAndCounters", "grl_widths", "grl_offsets", "grl_colorPointers"],
|
|
26
|
+
uniforms: [
|
|
27
|
+
"worldViewProjection",
|
|
28
|
+
"projection",
|
|
29
|
+
"grlColorsWidth",
|
|
30
|
+
"grlUseColors",
|
|
31
|
+
"grlWidth",
|
|
32
|
+
"grlColor",
|
|
33
|
+
"grl_colorModeAndColorDistributionType",
|
|
34
|
+
"grlResolution",
|
|
35
|
+
"grlAspect",
|
|
36
|
+
"grlAizeAttenuation",
|
|
37
|
+
"grlDashArray",
|
|
38
|
+
"grlDashOffset",
|
|
39
|
+
"grlDashRatio",
|
|
40
|
+
"grlUseDash",
|
|
41
|
+
"grlVisibility",
|
|
42
|
+
],
|
|
43
|
+
samplers: ["grlColors"],
|
|
44
|
+
defines: scene.useRightHandedSystem ? ["GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM"] : [],
|
|
45
|
+
});
|
|
46
|
+
this._color = Color3.White();
|
|
47
|
+
this._colorsDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;
|
|
48
|
+
options = options || {
|
|
49
|
+
color: GreasedLineSimpleMaterial.DEFAULT_COLOR,
|
|
50
|
+
};
|
|
51
|
+
this._engine = scene.getEngine();
|
|
52
|
+
this.visibility = (_a = options.visibility) !== null && _a !== void 0 ? _a : 1;
|
|
53
|
+
this.useDash = (_b = options.useDash) !== null && _b !== void 0 ? _b : false;
|
|
54
|
+
this.dashRatio = (_c = options.dashRatio) !== null && _c !== void 0 ? _c : 0.5;
|
|
55
|
+
this.dashOffset = (_d = options.dashOffset) !== null && _d !== void 0 ? _d : 0;
|
|
56
|
+
this.dashCount = (_e = options.dashCount) !== null && _e !== void 0 ? _e : 1; // calculate the _dashArray value, call the setter
|
|
57
|
+
this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineSimpleMaterial.DEFAULT_WIDTH_ATTENUATED : GreasedLineSimpleMaterial.DEFAULT_WIDTH;
|
|
58
|
+
this.sizeAttenuation = (_f = options.sizeAttenuation) !== null && _f !== void 0 ? _f : false;
|
|
59
|
+
this.color = (_g = options.color) !== null && _g !== void 0 ? _g : Color3.White();
|
|
60
|
+
this.useColors = (_h = options.useColors) !== null && _h !== void 0 ? _h : false;
|
|
61
|
+
this.colorsDistributionType = (_j = options.colorDistributionType) !== null && _j !== void 0 ? _j : GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;
|
|
62
|
+
this.colorsSampling = (_k = options.colorsSampling) !== null && _k !== void 0 ? _k : RawTexture.NEAREST_NEAREST;
|
|
63
|
+
this.colorMode = (_l = options.colorMode) !== null && _l !== void 0 ? _l : GreasedLineMeshColorMode.COLOR_MODE_SET;
|
|
64
|
+
this._colors = (_m = options.colors) !== null && _m !== void 0 ? _m : null;
|
|
65
|
+
this.resolution = (_o = options.resolution) !== null && _o !== void 0 ? _o : new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter
|
|
66
|
+
if (this._colors) {
|
|
67
|
+
this.setColors(this._colors);
|
|
68
|
+
}
|
|
69
|
+
this._engine.onDisposeObservable.add(() => {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = GreasedLineSimpleMaterial._EmptyColorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Converts boolean to number.
|
|
76
|
+
* @param bool
|
|
77
|
+
* @returns 1 if true, 0 if false.
|
|
78
|
+
*/
|
|
79
|
+
static _BooleanToNumber(bool) {
|
|
80
|
+
return bool ? 1 : 0;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Converts an array of Color3 to Uint8Array
|
|
84
|
+
* @param colors Arrray of Color3
|
|
85
|
+
* @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]
|
|
86
|
+
*/
|
|
87
|
+
static _Color3toRGBAUint8(colors) {
|
|
88
|
+
const colorTable = new Uint8Array(colors.length * 4);
|
|
89
|
+
for (let i = 0, j = 0; i < colors.length; i++) {
|
|
90
|
+
colorTable[j++] = colors[i].r * 255;
|
|
91
|
+
colorTable[j++] = colors[i].g * 255;
|
|
92
|
+
colorTable[j++] = colors[i].b * 255;
|
|
93
|
+
colorTable[j++] = 255;
|
|
94
|
+
}
|
|
95
|
+
return colorTable;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.
|
|
99
|
+
* @param name name of the texture
|
|
100
|
+
* @param colors Uint8Array of colors
|
|
101
|
+
*/
|
|
102
|
+
_createColorsTexture(name, colors) {
|
|
103
|
+
const colorsArray = GreasedLineSimpleMaterial._Color3toRGBAUint8(colors);
|
|
104
|
+
this._colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, this.getScene(), false, true, this._colorsSampling);
|
|
105
|
+
this._colorsTexture.name = name;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Disposes the plugin material.
|
|
109
|
+
*/
|
|
110
|
+
dispose() {
|
|
111
|
+
var _a;
|
|
112
|
+
(_a = this._colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
113
|
+
super.dispose();
|
|
114
|
+
}
|
|
115
|
+
_setColorModeAndColorDistributionType() {
|
|
116
|
+
this.setVector2("grl_colorModeAndColorDistributionType", new Vector2(this._colorMode, this._colorsDistributionType));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Updates the material. Use when material created in lazy mode.
|
|
120
|
+
*/
|
|
121
|
+
updateLazy() {
|
|
122
|
+
if (this._colors) {
|
|
123
|
+
this.setColors(this._colors, false, true);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns the colors used to colorize the line
|
|
128
|
+
*/
|
|
129
|
+
get colors() {
|
|
130
|
+
return this._colors;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Sets the colors used to colorize the line
|
|
134
|
+
*/
|
|
135
|
+
set colors(value) {
|
|
136
|
+
this.setColors(value);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Creates or updates the colors texture
|
|
140
|
+
* @param colors color table RGBA
|
|
141
|
+
* @param lazy if lazy, the colors are not updated
|
|
142
|
+
* @param forceNewTexture force creation of a new texture
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
setColors(colors, lazy = false, forceNewTexture = false) {
|
|
146
|
+
var _a, _b, _c, _d;
|
|
147
|
+
const origColorsCount = (_b = (_a = this._colors) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
148
|
+
this._colors = colors;
|
|
149
|
+
if (colors === null || colors.length === 0) {
|
|
150
|
+
(_c = this._colorsTexture) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (lazy && !forceNewTexture) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {
|
|
157
|
+
const colorArray = GreasedLineSimpleMaterial._Color3toRGBAUint8(colors);
|
|
158
|
+
this._colorsTexture.update(colorArray);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
(_d = this._colorsTexture) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
162
|
+
this._createColorsTexture(`${this.name}-colors-texture`, colors);
|
|
163
|
+
}
|
|
164
|
+
if (this._colorsTexture) {
|
|
165
|
+
this.setFloat("grlColorsWidth", this._colorsTexture.getSize().width);
|
|
166
|
+
this.setTexture("grlColors", this._colorsTexture);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Line base width. At each point the line width is calculated by widths[pointIndex] * width
|
|
171
|
+
*/
|
|
172
|
+
get width() {
|
|
173
|
+
return this._width;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Line base width. At each point the line width is calculated by widths[pointIndex] * width
|
|
177
|
+
*/
|
|
178
|
+
set width(value) {
|
|
179
|
+
this._width = value;
|
|
180
|
+
this.setFloat("grlWidth", value);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Whether to use the colors option to colorize the line
|
|
184
|
+
*/
|
|
185
|
+
get useColors() {
|
|
186
|
+
return this._useColors;
|
|
187
|
+
}
|
|
188
|
+
set useColors(value) {
|
|
189
|
+
this._useColors = value;
|
|
190
|
+
this.setFloat("grlUseColors", GreasedLineSimpleMaterial._BooleanToNumber(value));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The type of sampling of the colors texture. The values are the same when using with textures.
|
|
194
|
+
*/
|
|
195
|
+
get colorsSampling() {
|
|
196
|
+
return this._colorsSampling;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The type of sampling of the colors texture. The values are the same when using with textures.
|
|
200
|
+
*/
|
|
201
|
+
set colorsSampling(value) {
|
|
202
|
+
this._colorsSampling = value;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Normalized value of how much of the line will be visible
|
|
206
|
+
* 0 - 0% of the line will be visible
|
|
207
|
+
* 1 - 100% of the line will be visible
|
|
208
|
+
*/
|
|
209
|
+
get visibility() {
|
|
210
|
+
return this._visibility;
|
|
211
|
+
}
|
|
212
|
+
set visibility(value) {
|
|
213
|
+
this._visibility = value;
|
|
214
|
+
this.setFloat("grlVisibility", value);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Turns on/off dash mode
|
|
218
|
+
*/
|
|
219
|
+
get useDash() {
|
|
220
|
+
return this._useDash;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Turns on/off dash mode
|
|
224
|
+
*/
|
|
225
|
+
set useDash(value) {
|
|
226
|
+
this._useDash = value;
|
|
227
|
+
this.setFloat("grlUseDash", GreasedLineSimpleMaterial._BooleanToNumber(value));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Gets the dash offset
|
|
231
|
+
*/
|
|
232
|
+
get dashOffset() {
|
|
233
|
+
return this._dashOffset;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Sets the dash offset
|
|
237
|
+
*/
|
|
238
|
+
set dashOffset(value) {
|
|
239
|
+
this._dashOffset = value;
|
|
240
|
+
this.setFloat("grlDashOffset", value);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
|
|
244
|
+
*/
|
|
245
|
+
get dashRatio() {
|
|
246
|
+
return this._dashRatio;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
|
|
250
|
+
*/
|
|
251
|
+
set dashRatio(value) {
|
|
252
|
+
this._dashRatio = value;
|
|
253
|
+
this.setFloat("grlDashRatio", value);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Gets the number of dashes in the line
|
|
257
|
+
*/
|
|
258
|
+
get dashCount() {
|
|
259
|
+
return this._dashCount;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Sets the number of dashes in the line
|
|
263
|
+
* @param value dash
|
|
264
|
+
*/
|
|
265
|
+
set dashCount(value) {
|
|
266
|
+
this._dashCount = value;
|
|
267
|
+
this._dashArray = 1 / value;
|
|
268
|
+
this.setFloat("grlDashArray", this._dashArray);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines
|
|
272
|
+
*/
|
|
273
|
+
get sizeAttenuation() {
|
|
274
|
+
return this._sizeAttenuation;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Turn on/off attenuation of the width option and widths array.
|
|
278
|
+
* @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines
|
|
279
|
+
*/
|
|
280
|
+
set sizeAttenuation(value) {
|
|
281
|
+
this._sizeAttenuation = value;
|
|
282
|
+
this.setFloat("grlSizeAttenuation", GreasedLineSimpleMaterial._BooleanToNumber(value));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Gets the color of the line
|
|
286
|
+
*/
|
|
287
|
+
get color() {
|
|
288
|
+
return this.color;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Sets the color of the line
|
|
292
|
+
* @param value Color3
|
|
293
|
+
*/
|
|
294
|
+
set color(value) {
|
|
295
|
+
this.setColor(value);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.
|
|
299
|
+
* The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).
|
|
300
|
+
* @param value color
|
|
301
|
+
*/
|
|
302
|
+
setColor(value) {
|
|
303
|
+
value = value !== null && value !== void 0 ? value : GreasedLineSimpleMaterial.DEFAULT_COLOR;
|
|
304
|
+
this._color = value;
|
|
305
|
+
this.setColor3("grlColor", value);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Gets the color distributiopn type
|
|
309
|
+
*/
|
|
310
|
+
get colorsDistributionType() {
|
|
311
|
+
return this._colorsDistributionType;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Sets the color distribution type
|
|
315
|
+
* @see GreasedLineMeshColorDistributionType
|
|
316
|
+
* @param value color distribution type
|
|
317
|
+
*/
|
|
318
|
+
set colorsDistributionType(value) {
|
|
319
|
+
this._colorsDistributionType = value;
|
|
320
|
+
this._setColorModeAndColorDistributionType();
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.
|
|
324
|
+
* MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.
|
|
325
|
+
* @see GreasedLineMeshColorMode
|
|
326
|
+
*/
|
|
327
|
+
get colorMode() {
|
|
328
|
+
return this._colorMode;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.
|
|
332
|
+
* MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.
|
|
333
|
+
* @see GreasedLineMeshColorMode
|
|
334
|
+
*/
|
|
335
|
+
set colorMode(value) {
|
|
336
|
+
this._colorMode = value;
|
|
337
|
+
this._setColorModeAndColorDistributionType();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Gets the resolution
|
|
341
|
+
*/
|
|
342
|
+
get resolution() {
|
|
343
|
+
return this._resolution;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Sets the resolution
|
|
347
|
+
* @param value resolution of the screen for GreasedLine
|
|
348
|
+
*/
|
|
349
|
+
set resolution(value) {
|
|
350
|
+
this._resolution = value;
|
|
351
|
+
this.setVector2("grlResolution", value);
|
|
352
|
+
this.setFloat("grlAspect", value.x / value.y);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Serializes this plugin material
|
|
356
|
+
* @returns serializationObjec
|
|
357
|
+
*/
|
|
358
|
+
serialize() {
|
|
359
|
+
const serializationObject = super.serialize();
|
|
360
|
+
const greasedLineMaterialOptions = {
|
|
361
|
+
colorDistributionType: this._colorsDistributionType,
|
|
362
|
+
colorsSampling: this._colorsSampling,
|
|
363
|
+
colorMode: this._colorMode,
|
|
364
|
+
color: this._color,
|
|
365
|
+
dashCount: this._dashCount,
|
|
366
|
+
dashOffset: this._dashOffset,
|
|
367
|
+
dashRatio: this._dashRatio,
|
|
368
|
+
resolution: this._resolution,
|
|
369
|
+
sizeAttenuation: this._sizeAttenuation,
|
|
370
|
+
useColors: this._useColors,
|
|
371
|
+
useDash: this._useDash,
|
|
372
|
+
visibility: this._visibility,
|
|
373
|
+
width: this._width,
|
|
374
|
+
};
|
|
375
|
+
this._colors && (greasedLineMaterialOptions.colors = this._colors);
|
|
376
|
+
serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;
|
|
377
|
+
return serializationObject;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Parses a serialized objects
|
|
381
|
+
* @param source serialized object
|
|
382
|
+
* @param scene scene
|
|
383
|
+
* @param _rootUrl root url for textures
|
|
384
|
+
*/
|
|
385
|
+
parse(source, scene, _rootUrl) {
|
|
386
|
+
var _a;
|
|
387
|
+
// TODO: super.parse?
|
|
388
|
+
const greasedLineMaterialOptions = source.greasedLineMaterialOptions;
|
|
389
|
+
(_a = this._colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
390
|
+
if (greasedLineMaterialOptions.colors) {
|
|
391
|
+
this._createColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
GreasedLineSimpleMaterial._PrepareEmptyColorsTexture(scene);
|
|
395
|
+
}
|
|
396
|
+
greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);
|
|
397
|
+
greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);
|
|
398
|
+
greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);
|
|
399
|
+
greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);
|
|
400
|
+
greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);
|
|
401
|
+
greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);
|
|
402
|
+
greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);
|
|
403
|
+
greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);
|
|
404
|
+
greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);
|
|
405
|
+
greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);
|
|
406
|
+
greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);
|
|
407
|
+
greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);
|
|
408
|
+
greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
|
|
412
|
+
* For fast switching using the useColors property without the need to use defines.
|
|
413
|
+
* @param scene Scene
|
|
414
|
+
*/
|
|
415
|
+
static _PrepareEmptyColorsTexture(scene) {
|
|
416
|
+
if (!this._EmptyColorsTexture) {
|
|
417
|
+
const colorsArray = new Uint8Array(4);
|
|
418
|
+
GreasedLineSimpleMaterial._EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);
|
|
419
|
+
GreasedLineSimpleMaterial._EmptyColorsTexture.name = "grlEmptyColorsTexture";
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Default line color for newly created lines
|
|
425
|
+
*/
|
|
426
|
+
GreasedLineSimpleMaterial.DEFAULT_COLOR = Color3.White();
|
|
427
|
+
/**
|
|
428
|
+
* Default line width when sizeAttenuation is true
|
|
429
|
+
*/
|
|
430
|
+
GreasedLineSimpleMaterial.DEFAULT_WIDTH_ATTENUATED = 1;
|
|
431
|
+
/**
|
|
432
|
+
* Defaule line width
|
|
433
|
+
*/
|
|
434
|
+
GreasedLineSimpleMaterial.DEFAULT_WIDTH = 0.1;
|
|
435
|
+
//# sourceMappingURL=greasedLineSimpleMaterial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,wBAAwB,EAAE,oCAAoC,EAAE,MAAM,6BAA6B,CAAC;AAE7G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,iCAAiC,CAAC;AACzC,OAAO,+BAA+B,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAkCzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;;QACvE,KAAK,CACD,IAAI,EACJ,KAAK,EACL;YACI,MAAM,EAAE,aAAa;YACrB,QAAQ,EAAE,aAAa;SAC1B,EACD;YACI,UAAU,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,CAAC;YAClI,QAAQ,EAAE;gBACN,qBAAqB;gBACrB,YAAY;gBACZ,gBAAgB;gBAChB,cAAc;gBACd,UAAU;gBACV,UAAU;gBACV,uCAAuC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,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;YAC9J,yBAAyB,CAAC,mBAAmB,CAAC,IAAI,GAAG,uBAAuB,CAAC;SAChF;IACL,CAAC;;AA5eD;;GAEG;AACW,uCAAa,GAAG,MAAM,CAAC,KAAK,EAAE,AAAjB,CAAkB;AAC7C;;GAEG;AACW,kDAAwB,GAAG,CAAC,AAAJ,CAAK;AAC3C;;GAEG;AACW,uCAAa,GAAG,GAAG,AAAN,CAAO","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { RawTexture } from \"./Textures/rawTexture\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLinePluginMaterial\";\r\nimport { GreasedLineMeshColorMode, GreasedLineMeshColorDistributionType } from \"./greasedLinePluginMaterial\";\r\n\r\nimport { ShaderMaterial } from \"./shaderMaterial\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport type { BaseTexture } from \"./Textures/baseTexture\";\r\n\r\nimport \"../Shaders/greasedLine.fragment\";\r\nimport \"../Shaders/greasedLine.vertex\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n /**\r\n * Default line color for newly created lines\r\n */\r\n public static DEFAULT_COLOR = Color3.White();\r\n /**\r\n * Default line width when sizeAttenuation is true\r\n */\r\n public static DEFAULT_WIDTH_ATTENUATED = 1;\r\n /**\r\n * Defaule line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _EmptyColorsTexture: BaseTexture;\r\n\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture?: RawTexture;\r\n private _engine: Engine;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n attributes: [\"position\", \"normal\", \"grl_previousAndSide\", \"grl_nextAndCounters\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"],\r\n uniforms: [\r\n \"worldViewProjection\",\r\n \"projection\",\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n ],\r\n samplers: [\"grlColors\"],\r\n defines: scene.useRightHandedSystem ? [\"GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM\"] : [],\r\n }\r\n );\r\n options = options || {\r\n color: GreasedLineSimpleMaterial.DEFAULT_COLOR,\r\n };\r\n\r\n this._engine = scene.getEngine();\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineSimpleMaterial.DEFAULT_WIDTH_ATTENUATED : GreasedLineSimpleMaterial.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n\r\n this.resolution = options.resolution ?? new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (this._colors) {\r\n this.setColors(this._colors);\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLineSimpleMaterial._EmptyColorsTexture?.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Converts boolean to number.\r\n * @param bool\r\n * @returns 1 if true, 0 if false.\r\n */\r\n private static _BooleanToNumber(bool?: boolean) {\r\n return bool ? 1 : 0;\r\n }\r\n\r\n /**\r\n * Converts an array of Color3 to Uint8Array\r\n * @param colors Arrray of Color3\r\n * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]\r\n */\r\n private static _Color3toRGBAUint8(colors: Color3[]) {\r\n const colorTable: Uint8Array = new Uint8Array(colors.length * 4);\r\n for (let i = 0, j = 0; i < colors.length; i++) {\r\n colorTable[j++] = colors[i].r * 255;\r\n colorTable[j++] = colors[i].g * 255;\r\n colorTable[j++] = colors[i].b * 255;\r\n colorTable[j++] = 255;\r\n }\r\n\r\n return colorTable;\r\n }\r\n\r\n /**\r\n * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.\r\n * @param name name of the texture\r\n * @param colors Uint8Array of colors\r\n */\r\n private _createColorsTexture(name: string, colors: Color3[]) {\r\n const colorsArray = GreasedLineSimpleMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, this.getScene(), false, true, this._colorsSampling);\r\n this._colorsTexture.name = name;\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n * @returns\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineSimpleMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this._createColorsTexture(`${this.name}-colors-texture`, colors);\r\n }\r\n\r\n if (this._colorsTexture) {\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineSimpleMaterial._BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineSimpleMaterial._BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineSimpleMaterial._BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this.color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineSimpleMaterial.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n // TODO: super.parse?\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n if (greasedLineMaterialOptions.colors) {\r\n this._createColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors);\r\n } else {\r\n GreasedLineSimpleMaterial._PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n }\r\n\r\n /**\r\n * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.\r\n * For fast switching using the useColors property without the need to use defines.\r\n * @param scene Scene\r\n */\r\n private static _PrepareEmptyColorsTexture(scene: Scene) {\r\n if (!this._EmptyColorsTexture) {\r\n const colorsArray = new Uint8Array(4);\r\n GreasedLineSimpleMaterial._EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);\r\n GreasedLineSimpleMaterial._EmptyColorsTexture.name = \"grlEmptyColorsTexture\";\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -5,6 +5,7 @@ import { MaterialPluginBase } from "./materialPluginBase.js";
|
|
|
5
5
|
|
|
6
6
|
import { MaterialFlags } from "./materialFlags.js";
|
|
7
7
|
import { MaterialHelper } from "./materialHelper.js";
|
|
8
|
+
import { RegisterClass } from "../Misc/typeStore.js";
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
@@ -116,4 +117,5 @@ __decorate([
|
|
|
116
117
|
serialize(),
|
|
117
118
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
118
119
|
], DecalMapConfiguration.prototype, "smoothAlpha", void 0);
|
|
120
|
+
RegisterClass("BABYLON.DecalMapConfiguration", DecalMapConfiguration);
|
|
119
121
|
//# sourceMappingURL=material.decalMapConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material.decalMapConfiguration.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/material.decalMapConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"material.decalMapConfi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a,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;aAClD;SACJ,CAAC;IACN,CAAC;CACJ;AAtGU;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDAC5B;AAUlB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;0DAC1B;AA8F/B,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, expandToProperty } from \"../Misc/decorators\";\r\nimport { MaterialDefines } from \"./materialDefines\";\r\nimport { MaterialPluginBase } from \"./materialPluginBase\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { MaterialFlags } from \"./materialFlags\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Engine } from \"core/Engines/engine\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { MaterialHelper } from \"./materialHelper\";\r\nimport type { UniformBuffer } from \"./uniformBuffer\";\r\nimport type { PBRBaseMaterial } from \"./PBR/pbrBaseMaterial\";\r\nimport type { StandardMaterial } from \"./standardMaterial\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class DecalMapDefines extends MaterialDefines {\r\n DECAL = false;\r\n DECALDIRECTUV = 0;\r\n DECAL_SMOOTHALPHA = false;\r\n GAMMADECAL = false;\r\n}\r\n\r\n/**\r\n * Plugin that implements the decal map component of a material\r\n * @since 5.49.1\r\n */\r\nexport class DecalMapConfiguration extends MaterialPluginBase {\r\n private _isEnabled = false;\r\n /**\r\n * Enables or disables the decal map on this material\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n private _smoothAlpha = false;\r\n\r\n /**\r\n * Enables or disables the smooth alpha mode on this material. Default: false.\r\n * When enabled, the alpha value used to blend the decal map will be the squared value and will produce a smoother result.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public smoothAlpha = false;\r\n\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /** @internal */\r\n public _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Creates a new DecalMapConfiguration\r\n * @param material The material to attach the decal map plugin to\r\n * @param addToPluginList If the plugin should be added to the material plugin list\r\n */\r\n constructor(material: PBRBaseMaterial | StandardMaterial, addToPluginList = true) {\r\n super(material, \"DecalMap\", 150, new DecalMapDefines(), addToPluginList);\r\n\r\n this.registerForExtraEvents = true; // because we override the hardBindForSubMesh method\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public isReadyForSubMesh(defines: DecalMapDefines, scene: Scene, engine: Engine, subMesh: SubMesh): boolean {\r\n const decalMap = subMesh.getMesh().decalMap;\r\n\r\n if (!this._isEnabled || !decalMap?.texture || !MaterialFlags.DecalMapEnabled || !scene.texturesEnabled) {\r\n return true;\r\n }\r\n\r\n return decalMap.isReady();\r\n }\r\n\r\n public prepareDefines(defines: DecalMapDefines, scene: Scene, mesh: AbstractMesh): void {\r\n const decalMap = mesh.decalMap;\r\n\r\n if (!this._isEnabled || !decalMap?.texture || !MaterialFlags.DecalMapEnabled || !scene.texturesEnabled) {\r\n const isDirty = defines.DECAL;\r\n if (isDirty) {\r\n defines.markAsTexturesDirty();\r\n }\r\n defines.DECAL = false;\r\n } else {\r\n const isDirty = !defines.DECAL || defines.GAMMADECAL !== decalMap.texture.gammaSpace;\r\n if (isDirty) {\r\n defines.markAsTexturesDirty();\r\n }\r\n defines.DECAL = true;\r\n defines.GAMMADECAL = decalMap.texture.gammaSpace;\r\n defines.DECAL_SMOOTHALPHA = this._smoothAlpha;\r\n MaterialHelper.PrepareDefinesForMergedUV(decalMap.texture, defines, \"DECAL\");\r\n }\r\n }\r\n\r\n /**\r\n * Note that we override hardBindForSubMesh and not bindForSubMesh because the material can be shared by multiple meshes,\r\n * in which case mustRebind could return false even though the decal map is different for each mesh: that's because the decal map\r\n * is not part of the material but hosted by the decalMap of the mesh instead.\r\n */\r\n public hardBindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, _engine: Engine, subMesh: SubMesh): void {\r\n const decalMap = subMesh.getMesh().decalMap;\r\n\r\n if (!this._isEnabled || !decalMap?.texture || !MaterialFlags.DecalMapEnabled || !scene.texturesEnabled) {\r\n return;\r\n }\r\n\r\n const isFrozen = this._material.isFrozen;\r\n const texture = decalMap.texture;\r\n\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n uniformBuffer.updateFloat4(\"vDecalInfos\", texture.coordinatesIndex, 0, 0, 0);\r\n MaterialHelper.BindTextureMatrix(texture, uniformBuffer, \"decal\");\r\n }\r\n\r\n uniformBuffer.setTexture(\"decalSampler\", texture);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"DecalMapConfiguration\";\r\n }\r\n\r\n public getSamplers(samplers: string[]): void {\r\n samplers.push(\"decalSampler\");\r\n }\r\n\r\n public getUniforms(): { ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string; fragment?: string } {\r\n return {\r\n ubo: [\r\n { name: \"vDecalInfos\", size: 4, type: \"vec4\" },\r\n { name: \"decalMatrix\", size: 16, type: \"mat4\" },\r\n ],\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DecalMapConfiguration\", DecalMapConfiguration);\r\n"]}
|
|
@@ -49,7 +49,7 @@ export declare enum MeshDebugMode {
|
|
|
49
49
|
MATERIALIDS = 7
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Options for MeshDebugPluginMaterial
|
|
52
|
+
* Options for MeshDebugPluginMaterial visualizations
|
|
53
53
|
*/
|
|
54
54
|
export interface MeshDebugOptions {
|
|
55
55
|
/**
|
|
@@ -161,12 +161,73 @@ export declare class MeshDebugPluginMaterial extends MaterialPluginBase {
|
|
|
161
161
|
* Defaults to true in constructor.
|
|
162
162
|
*/
|
|
163
163
|
private _isEnabled;
|
|
164
|
-
private
|
|
164
|
+
private _mode;
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
166
|
+
* The mesh debug visualization.
|
|
167
|
+
* Defaults to NONE.
|
|
168
|
+
*/
|
|
169
|
+
mode: MeshDebugMode;
|
|
170
|
+
private _multiply;
|
|
171
|
+
/**
|
|
172
|
+
* Whether the mesh debug visualization should multiply with color underneath.
|
|
173
|
+
* Defaults to true.
|
|
174
|
+
*/
|
|
175
|
+
multiply: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Diffuse color used to shade the mesh.
|
|
178
|
+
* Defaults to (1.0, 1.0, 1.0).
|
|
179
|
+
*/
|
|
180
|
+
shadedDiffuseColor: Color3;
|
|
181
|
+
/**
|
|
182
|
+
* Specular color used to shade the mesh.
|
|
183
|
+
* Defaults to (0.8, 0.8, 0.8).
|
|
184
|
+
*/
|
|
185
|
+
shadedSpecularColor: Color3;
|
|
186
|
+
/**
|
|
187
|
+
* Specular power used to shade the mesh.
|
|
188
|
+
* Defaults to 10.
|
|
189
|
+
*/
|
|
190
|
+
shadedSpecularPower: number;
|
|
191
|
+
/**
|
|
192
|
+
* Width of edge lines in TRIANGLES and TRIANGLE_VERTICES modes.
|
|
193
|
+
* Defaults to 0.7.
|
|
194
|
+
*/
|
|
195
|
+
wireframeThickness: number;
|
|
196
|
+
/**
|
|
197
|
+
* Color of edge lines in TRIANGLES mode.
|
|
198
|
+
* Defaults to (0.0, 0.0, 0.0).
|
|
199
|
+
*/
|
|
200
|
+
wireframeTrianglesColor: Color3;
|
|
201
|
+
/**
|
|
202
|
+
* Color of edge lines in TRIANGLES_VERTICES modes.
|
|
203
|
+
* Defaults to (0.8, 0.8, 0.8).
|
|
204
|
+
*/
|
|
205
|
+
wireframeVerticesColor: Color3;
|
|
206
|
+
/**
|
|
207
|
+
* Color of vertices in TRIANGLES_VERTICES and VERTICES mode.
|
|
208
|
+
* Defaults to (0.0, 0.0, 0.0).
|
|
168
209
|
*/
|
|
169
|
-
|
|
210
|
+
vertexColor: Color3;
|
|
211
|
+
/**
|
|
212
|
+
* Radius of dots drawn over vertices in TRIANGLE_VERTICES and VERTICES mode.
|
|
213
|
+
* Defaults to 1.2.
|
|
214
|
+
*/
|
|
215
|
+
vertexRadius: number;
|
|
216
|
+
/**
|
|
217
|
+
* Size of tiles in UV1 or UV2 modes.
|
|
218
|
+
* Defaults to 20.
|
|
219
|
+
*/
|
|
220
|
+
uvScale: number;
|
|
221
|
+
/**
|
|
222
|
+
* 1st color of checkerboard grid in UV1 or UV2 modes.
|
|
223
|
+
* Defaults to (1.0, 1.0, 1.0).
|
|
224
|
+
*/
|
|
225
|
+
uvPrimaryColor: Color3;
|
|
226
|
+
/**
|
|
227
|
+
* 2nd color of checkerboard grid in UV1 or UV2 modes.
|
|
228
|
+
* Defaults to (0.5, 0.5, 0.5).
|
|
229
|
+
*/
|
|
230
|
+
uvSecondaryColor: Color3;
|
|
170
231
|
/** @internal */
|
|
171
232
|
protected _markAllDefinesAsDirty(): void;
|
|
172
233
|
/**
|
|
@@ -226,18 +287,6 @@ export declare class MeshDebugPluginMaterial extends MaterialPluginBase {
|
|
|
226
287
|
getCustomCode(shaderType: string): Nullable<{
|
|
227
288
|
[pointName: string]: string;
|
|
228
289
|
}>;
|
|
229
|
-
/**
|
|
230
|
-
* Serializes this plugin material
|
|
231
|
-
* @returns serialized object
|
|
232
|
-
*/
|
|
233
|
-
serialize(): any;
|
|
234
|
-
/**
|
|
235
|
-
* Parses a serialized object
|
|
236
|
-
* @param serializationObject serialized object
|
|
237
|
-
* @param scene scene
|
|
238
|
-
* @param rootUrl root url for textures
|
|
239
|
-
*/
|
|
240
|
-
parse(serializationObject: any, scene: Scene, rootUrl: string): void;
|
|
241
290
|
/**
|
|
242
291
|
* Resets static variables of the plugin to their original state
|
|
243
292
|
*/
|