@babylonjs/gui 9.15.0 → 9.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2D/controls/checkbox.pure.js +164 -153
- package/2D/controls/checkbox.pure.js.map +1 -1
- package/2D/controls/colorpicker.pure.js +1300 -1289
- package/2D/controls/colorpicker.pure.js.map +1 -1
- package/2D/controls/container.pure.js +597 -582
- package/2D/controls/container.pure.js.map +1 -1
- package/2D/controls/control.pure.js +2474 -2434
- package/2D/controls/control.pure.js.map +1 -1
- package/2D/controls/displayGrid.pure.js +201 -190
- package/2D/controls/displayGrid.pure.js.map +1 -1
- package/2D/controls/ellipse.pure.js +96 -85
- package/2D/controls/ellipse.pure.js.map +1 -1
- package/2D/controls/grid.pure.js +511 -500
- package/2D/controls/grid.pure.js.map +1 -1
- package/2D/controls/image.pure.js +888 -877
- package/2D/controls/image.pure.js.map +1 -1
- package/2D/controls/inputText.pure.js +988 -973
- package/2D/controls/inputText.pure.js.map +1 -1
- package/2D/controls/inputTextArea.pure.js +955 -944
- package/2D/controls/inputTextArea.pure.js.map +1 -1
- package/2D/controls/line.pure.js +237 -226
- package/2D/controls/line.pure.js.map +1 -1
- package/2D/controls/multiLine.pure.js +233 -222
- package/2D/controls/multiLine.pure.js.map +1 -1
- package/2D/controls/radioButton.pure.js +182 -169
- package/2D/controls/radioButton.pure.js.map +1 -1
- package/2D/controls/rectangle.pure.js +211 -200
- package/2D/controls/rectangle.pure.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.pure.js +579 -567
- package/2D/controls/scrollViewers/scrollViewer.pure.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js +291 -280
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.pure.js +158 -147
- package/2D/controls/sliders/imageBasedSlider.pure.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js +237 -223
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.pure.js +169 -158
- package/2D/controls/sliders/scrollBar.pure.js.map +1 -1
- package/2D/controls/sliders/slider.pure.js +251 -240
- package/2D/controls/sliders/slider.pure.js.map +1 -1
- package/2D/controls/stackPanel.pure.js +236 -221
- package/2D/controls/stackPanel.pure.js.map +1 -1
- package/2D/controls/textBlock.pure.js +637 -626
- package/2D/controls/textBlock.pure.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.pure.d.ts +4 -4
- package/3D/materials/fluent/fluentMaterial.pure.js +322 -273
- package/3D/materials/fluent/fluentMaterial.pure.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js +510 -454
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.pure.js +612 -529
- package/3D/materials/fluentButton/fluentButtonMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js +313 -274
- package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js +462 -405
- package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js +583 -501
- package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js +226 -203
- package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js +961 -825
- package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js +961 -825
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet, __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
4
4
|
import { Vector3, TmpVectors } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
@@ -22,289 +22,338 @@ export class FluentMaterialDefines extends MaterialDefines {
|
|
|
22
22
|
/**
|
|
23
23
|
* Class used to render controls with fluent design
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
25
|
+
let FluentMaterial = (() => {
|
|
26
|
+
var _a, _FluentMaterial_innerGlowColorIntensity_accessor_storage, _FluentMaterial_renderBorders_accessor_storage, _FluentMaterial_renderHoverLight_accessor_storage, _FluentMaterial_albedoTexture_accessor_storage;
|
|
27
|
+
let _classSuper = PushMaterial;
|
|
28
|
+
let _innerGlowColorIntensity_decorators;
|
|
29
|
+
let _innerGlowColorIntensity_initializers = [];
|
|
30
|
+
let _innerGlowColorIntensity_extraInitializers = [];
|
|
31
|
+
let _innerGlowColor_decorators;
|
|
32
|
+
let _innerGlowColor_initializers = [];
|
|
33
|
+
let _innerGlowColor_extraInitializers = [];
|
|
34
|
+
let _albedoColor_decorators;
|
|
35
|
+
let _albedoColor_initializers = [];
|
|
36
|
+
let _albedoColor_extraInitializers = [];
|
|
37
|
+
let _renderBorders_decorators;
|
|
38
|
+
let _renderBorders_initializers = [];
|
|
39
|
+
let _renderBorders_extraInitializers = [];
|
|
40
|
+
let _borderWidth_decorators;
|
|
41
|
+
let _borderWidth_initializers = [];
|
|
42
|
+
let _borderWidth_extraInitializers = [];
|
|
43
|
+
let _edgeSmoothingValue_decorators;
|
|
44
|
+
let _edgeSmoothingValue_initializers = [];
|
|
45
|
+
let _edgeSmoothingValue_extraInitializers = [];
|
|
46
|
+
let _borderMinValue_decorators;
|
|
47
|
+
let _borderMinValue_initializers = [];
|
|
48
|
+
let _borderMinValue_extraInitializers = [];
|
|
49
|
+
let _renderHoverLight_decorators;
|
|
50
|
+
let _renderHoverLight_initializers = [];
|
|
51
|
+
let _renderHoverLight_extraInitializers = [];
|
|
52
|
+
let _hoverRadius_decorators;
|
|
53
|
+
let _hoverRadius_initializers = [];
|
|
54
|
+
let _hoverRadius_extraInitializers = [];
|
|
55
|
+
let _hoverColor_decorators;
|
|
56
|
+
let _hoverColor_initializers = [];
|
|
57
|
+
let _hoverColor_extraInitializers = [];
|
|
58
|
+
let _hoverPosition_decorators;
|
|
59
|
+
let _hoverPosition_initializers = [];
|
|
60
|
+
let _hoverPosition_extraInitializers = [];
|
|
61
|
+
let __albedoTexture_decorators;
|
|
62
|
+
let __albedoTexture_initializers = [];
|
|
63
|
+
let __albedoTexture_extraInitializers = [];
|
|
64
|
+
let _albedoTexture_decorators;
|
|
65
|
+
let _albedoTexture_initializers = [];
|
|
66
|
+
let _albedoTexture_extraInitializers = [];
|
|
67
|
+
return _a = class FluentMaterial extends _classSuper {
|
|
68
|
+
/**
|
|
69
|
+
* Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
|
|
70
|
+
*/
|
|
71
|
+
get innerGlowColorIntensity() { return __classPrivateFieldGet(this, _FluentMaterial_innerGlowColorIntensity_accessor_storage, "f"); }
|
|
72
|
+
set innerGlowColorIntensity(value) { __classPrivateFieldSet(this, _FluentMaterial_innerGlowColorIntensity_accessor_storage, value, "f"); }
|
|
73
|
+
/**
|
|
74
|
+
* Gets or sets a boolean indicating if borders must be rendered (default is false)
|
|
75
|
+
*/
|
|
76
|
+
get renderBorders() { return __classPrivateFieldGet(this, _FluentMaterial_renderBorders_accessor_storage, "f"); }
|
|
77
|
+
set renderBorders(value) { __classPrivateFieldSet(this, _FluentMaterial_renderBorders_accessor_storage, value, "f"); }
|
|
78
|
+
/**
|
|
79
|
+
* Gets or sets a boolean indicating if hover light must be rendered (default is false)
|
|
80
|
+
*/
|
|
81
|
+
get renderHoverLight() { return __classPrivateFieldGet(this, _FluentMaterial_renderHoverLight_accessor_storage, "f"); }
|
|
82
|
+
set renderHoverLight(value) { __classPrivateFieldSet(this, _FluentMaterial_renderHoverLight_accessor_storage, value, "f"); }
|
|
83
|
+
/** Gets or sets the texture to use for albedo color */
|
|
84
|
+
get albedoTexture() { return __classPrivateFieldGet(this, _FluentMaterial_albedoTexture_accessor_storage, "f"); }
|
|
85
|
+
set albedoTexture(value) { __classPrivateFieldSet(this, _FluentMaterial_albedoTexture_accessor_storage, value, "f"); }
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new Fluent material
|
|
88
|
+
* @param name defines the name of the material
|
|
89
|
+
* @param scene defines the hosting scene
|
|
90
|
+
*/
|
|
91
|
+
constructor(name, scene) {
|
|
92
|
+
super(name, scene);
|
|
93
|
+
this._shadersLoaded = false;
|
|
94
|
+
_FluentMaterial_innerGlowColorIntensity_accessor_storage.set(this, __runInitializers(this, _innerGlowColorIntensity_initializers, 0.5));
|
|
95
|
+
/**
|
|
96
|
+
* Gets or sets the inner glow color (white by default)
|
|
97
|
+
*/
|
|
98
|
+
this.innerGlowColor = (__runInitializers(this, _innerGlowColorIntensity_extraInitializers), __runInitializers(this, _innerGlowColor_initializers, new Color3(1.0, 1.0, 1.0)));
|
|
99
|
+
/**
|
|
100
|
+
* Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
|
|
101
|
+
*/
|
|
102
|
+
this.albedoColor = (__runInitializers(this, _innerGlowColor_extraInitializers), __runInitializers(this, _albedoColor_initializers, new Color3(0.3, 0.35, 0.4)));
|
|
103
|
+
_FluentMaterial_renderBorders_accessor_storage.set(this, (__runInitializers(this, _albedoColor_extraInitializers), __runInitializers(this, _renderBorders_initializers, false)));
|
|
104
|
+
/**
|
|
105
|
+
* Gets or sets border width (default is 0.5)
|
|
106
|
+
*/
|
|
107
|
+
this.borderWidth = (__runInitializers(this, _renderBorders_extraInitializers), __runInitializers(this, _borderWidth_initializers, 0.5));
|
|
108
|
+
/**
|
|
109
|
+
* Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
|
|
110
|
+
*/
|
|
111
|
+
this.edgeSmoothingValue = (__runInitializers(this, _borderWidth_extraInitializers), __runInitializers(this, _edgeSmoothingValue_initializers, 0.02));
|
|
112
|
+
/**
|
|
113
|
+
* Gets or sets the minimum value that can be applied to border width (default is 0.1)
|
|
114
|
+
*/
|
|
115
|
+
this.borderMinValue = (__runInitializers(this, _edgeSmoothingValue_extraInitializers), __runInitializers(this, _borderMinValue_initializers, 0.1));
|
|
116
|
+
_FluentMaterial_renderHoverLight_accessor_storage.set(this, (__runInitializers(this, _borderMinValue_extraInitializers), __runInitializers(this, _renderHoverLight_initializers, false)));
|
|
117
|
+
/**
|
|
118
|
+
* Gets or sets the radius used to render the hover light (default is 0.01)
|
|
119
|
+
*/
|
|
120
|
+
this.hoverRadius = (__runInitializers(this, _renderHoverLight_extraInitializers), __runInitializers(this, _hoverRadius_initializers, 0.01));
|
|
121
|
+
/**
|
|
122
|
+
* Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
|
|
123
|
+
*/
|
|
124
|
+
this.hoverColor = (__runInitializers(this, _hoverRadius_extraInitializers), __runInitializers(this, _hoverColor_initializers, new Color4(0.3, 0.3, 0.3, 1.0)));
|
|
125
|
+
/**
|
|
126
|
+
* Gets or sets the hover light position in world space (default is Vector3.Zero())
|
|
127
|
+
*/
|
|
128
|
+
this.hoverPosition = (__runInitializers(this, _hoverColor_extraInitializers), __runInitializers(this, _hoverPosition_initializers, Vector3.Zero()));
|
|
129
|
+
this._albedoTexture = (__runInitializers(this, _hoverPosition_extraInitializers), __runInitializers(this, __albedoTexture_initializers, void 0));
|
|
130
|
+
_FluentMaterial_albedoTexture_accessor_storage.set(this, (__runInitializers(this, __albedoTexture_extraInitializers), __runInitializers(this, _albedoTexture_initializers, void 0)));
|
|
131
|
+
__runInitializers(this, _albedoTexture_extraInitializers);
|
|
93
132
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
subMesh.materialDefines = new FluentMaterialDefines();
|
|
97
|
-
}
|
|
98
|
-
const scene = this.getScene();
|
|
99
|
-
const defines = subMesh.materialDefines;
|
|
100
|
-
if (!this.checkReadyOnEveryCall && subMesh.effect) {
|
|
101
|
-
if (defines._renderId === scene.getRenderId()) {
|
|
102
|
-
return true;
|
|
133
|
+
needAlphaBlending() {
|
|
134
|
+
return this.alpha !== 1.0;
|
|
103
135
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
defines.INNERGLOW = this.innerGlowColorIntensity > 0;
|
|
107
|
-
defines.BORDER = this.renderBorders;
|
|
108
|
-
defines.HOVERLIGHT = this.renderHoverLight;
|
|
109
|
-
if (this._albedoTexture) {
|
|
110
|
-
if (!this._albedoTexture.isReadyOrNotBlocking()) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
defines.TEXTURE = true;
|
|
115
|
-
}
|
|
136
|
+
needAlphaTesting() {
|
|
137
|
+
return false;
|
|
116
138
|
}
|
|
117
|
-
|
|
118
|
-
|
|
139
|
+
getAlphaTestTexture() {
|
|
140
|
+
return null;
|
|
119
141
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
];
|
|
145
|
-
const samplers = ["albedoSampler"];
|
|
146
|
-
const uniformBuffers = [];
|
|
147
|
-
PrepareUniformsAndSamplersList({
|
|
148
|
-
uniformsNames: uniforms,
|
|
149
|
-
uniformBuffersNames: uniformBuffers,
|
|
150
|
-
samplers: samplers,
|
|
151
|
-
defines: defines,
|
|
152
|
-
maxSimultaneousLights: 4,
|
|
153
|
-
shaderLanguage: this._shaderLanguage,
|
|
154
|
-
});
|
|
155
|
-
const join = defines.toString();
|
|
156
|
-
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
|
|
157
|
-
attributes: attribs,
|
|
158
|
-
uniformsNames: uniforms,
|
|
159
|
-
uniformBuffersNames: uniformBuffers,
|
|
160
|
-
samplers: samplers,
|
|
161
|
-
defines: join,
|
|
162
|
-
fallbacks: null,
|
|
163
|
-
onCompiled: this.onCompiled,
|
|
164
|
-
onError: this.onError,
|
|
165
|
-
indexParameters: { maxSimultaneousLights: 4 },
|
|
166
|
-
shaderLanguage: this._shaderLanguage,
|
|
167
|
-
extraInitializationsAsync: this._shadersLoaded
|
|
168
|
-
? undefined
|
|
169
|
-
: async () => {
|
|
170
|
-
if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
171
|
-
await Promise.all([import("./wgsl/fluent.vertex.js"), import("./wgsl/fluent.fragment.js")]);
|
|
142
|
+
isReadyForSubMesh(mesh, subMesh) {
|
|
143
|
+
const drawWrapper = subMesh._drawWrapper;
|
|
144
|
+
if (this.isFrozen) {
|
|
145
|
+
if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!subMesh.materialDefines) {
|
|
150
|
+
subMesh.materialDefines = new FluentMaterialDefines();
|
|
151
|
+
}
|
|
152
|
+
const scene = this.getScene();
|
|
153
|
+
const defines = subMesh.materialDefines;
|
|
154
|
+
if (!this.checkReadyOnEveryCall && subMesh.effect) {
|
|
155
|
+
if (defines._renderId === scene.getRenderId()) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (defines._areTexturesDirty) {
|
|
160
|
+
defines.INNERGLOW = this.innerGlowColorIntensity > 0;
|
|
161
|
+
defines.BORDER = this.renderBorders;
|
|
162
|
+
defines.HOVERLIGHT = this.renderHoverLight;
|
|
163
|
+
if (this._albedoTexture) {
|
|
164
|
+
if (!this._albedoTexture.isReadyOrNotBlocking()) {
|
|
165
|
+
return false;
|
|
172
166
|
}
|
|
173
167
|
else {
|
|
174
|
-
|
|
168
|
+
defines.TEXTURE = true;
|
|
175
169
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
defines.TEXTURE = false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const engine = scene.getEngine();
|
|
176
|
+
// Get correct effect
|
|
177
|
+
if (defines.isDirty) {
|
|
178
|
+
defines.markAsProcessed();
|
|
179
|
+
scene.resetCachedMaterial();
|
|
180
|
+
//Attributes
|
|
181
|
+
const attribs = [VertexBuffer.PositionKind];
|
|
182
|
+
attribs.push(VertexBuffer.NormalKind);
|
|
183
|
+
attribs.push(VertexBuffer.UVKind);
|
|
184
|
+
const shaderName = "fluent";
|
|
185
|
+
const uniforms = [
|
|
186
|
+
"world",
|
|
187
|
+
"viewProjection",
|
|
188
|
+
"innerGlowColor",
|
|
189
|
+
"albedoColor",
|
|
190
|
+
"borderWidth",
|
|
191
|
+
"edgeSmoothingValue",
|
|
192
|
+
"scaleFactor",
|
|
193
|
+
"borderMinValue",
|
|
194
|
+
"hoverColor",
|
|
195
|
+
"hoverPosition",
|
|
196
|
+
"hoverRadius",
|
|
197
|
+
"textureMatrix",
|
|
198
|
+
];
|
|
199
|
+
const samplers = ["albedoSampler"];
|
|
200
|
+
const uniformBuffers = [];
|
|
201
|
+
PrepareUniformsAndSamplersList({
|
|
202
|
+
uniformsNames: uniforms,
|
|
203
|
+
uniformBuffersNames: uniformBuffers,
|
|
204
|
+
samplers: samplers,
|
|
205
|
+
defines: defines,
|
|
206
|
+
maxSimultaneousLights: 4,
|
|
207
|
+
shaderLanguage: this._shaderLanguage,
|
|
208
|
+
});
|
|
209
|
+
const join = defines.toString();
|
|
210
|
+
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
|
|
211
|
+
attributes: attribs,
|
|
212
|
+
uniformsNames: uniforms,
|
|
213
|
+
uniformBuffersNames: uniformBuffers,
|
|
214
|
+
samplers: samplers,
|
|
215
|
+
defines: join,
|
|
216
|
+
fallbacks: null,
|
|
217
|
+
onCompiled: this.onCompiled,
|
|
218
|
+
onError: this.onError,
|
|
219
|
+
indexParameters: { maxSimultaneousLights: 4 },
|
|
220
|
+
shaderLanguage: this._shaderLanguage,
|
|
221
|
+
extraInitializationsAsync: this._shadersLoaded
|
|
222
|
+
? undefined
|
|
223
|
+
: async () => {
|
|
224
|
+
if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
225
|
+
await Promise.all([import("./wgsl/fluent.vertex.js"), import("./wgsl/fluent.fragment.js")]);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
await Promise.all([import("./shaders/fluent.vertex.js"), import("./shaders/fluent.fragment.js")]);
|
|
229
|
+
}
|
|
230
|
+
this._shadersLoaded = true;
|
|
231
|
+
},
|
|
232
|
+
}, engine), defines, this._materialContext);
|
|
233
|
+
}
|
|
234
|
+
if (!subMesh.effect || !subMesh.effect.isReady()) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
defines._renderId = scene.getRenderId();
|
|
238
|
+
drawWrapper._wasPreviouslyReady = true;
|
|
239
|
+
return true;
|
|
205
240
|
}
|
|
206
|
-
|
|
207
|
-
this.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
241
|
+
bindForSubMesh(world, mesh, subMesh) {
|
|
242
|
+
const scene = this.getScene();
|
|
243
|
+
const defines = subMesh.materialDefines;
|
|
244
|
+
if (!defines) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const effect = subMesh.effect;
|
|
248
|
+
if (!effect) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
this._activeEffect = effect;
|
|
252
|
+
// Matrices
|
|
253
|
+
this.bindOnlyWorldMatrix(world);
|
|
254
|
+
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
|
255
|
+
if (this._mustRebind(scene, effect, subMesh)) {
|
|
256
|
+
this._activeEffect.setColor4("albedoColor", this.albedoColor, this.alpha);
|
|
257
|
+
if (defines.INNERGLOW) {
|
|
258
|
+
this._activeEffect.setColor4("innerGlowColor", this.innerGlowColor, this.innerGlowColorIntensity);
|
|
259
|
+
}
|
|
260
|
+
if (defines.BORDER) {
|
|
261
|
+
this._activeEffect.setFloat("borderWidth", this.borderWidth);
|
|
262
|
+
this._activeEffect.setFloat("edgeSmoothingValue", this.edgeSmoothingValue);
|
|
263
|
+
this._activeEffect.setFloat("borderMinValue", this.borderMinValue);
|
|
264
|
+
mesh.getBoundingInfo().boundingBox.extendSize.multiplyToRef(mesh.scaling, TmpVectors.Vector3[0]);
|
|
265
|
+
this._activeEffect.setVector3("scaleFactor", TmpVectors.Vector3[0]);
|
|
266
|
+
}
|
|
267
|
+
if (defines.HOVERLIGHT) {
|
|
268
|
+
this._activeEffect.setDirectColor4("hoverColor", this.hoverColor);
|
|
269
|
+
this._activeEffect.setFloat("hoverRadius", this.hoverRadius);
|
|
270
|
+
this._activeEffect.setVector3("hoverPosition", this.hoverPosition);
|
|
271
|
+
}
|
|
272
|
+
if (defines.TEXTURE && this._albedoTexture) {
|
|
273
|
+
this._activeEffect.setTexture("albedoSampler", this._albedoTexture);
|
|
274
|
+
const matrix = this._albedoTexture.getTextureMatrix();
|
|
275
|
+
this._activeEffect.setMatrix("textureMatrix", matrix);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
this._afterBind(mesh, this._activeEffect, subMesh);
|
|
212
279
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this._activeEffect.setVector3("hoverPosition", this.hoverPosition);
|
|
280
|
+
getActiveTextures() {
|
|
281
|
+
const activeTextures = super.getActiveTextures();
|
|
282
|
+
return activeTextures;
|
|
217
283
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
284
|
+
hasTexture(texture) {
|
|
285
|
+
if (super.hasTexture(texture)) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
return false;
|
|
222
289
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
serialize(),
|
|
291
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
292
|
-
], FluentMaterial.prototype, "renderHoverLight", void 0);
|
|
293
|
-
__decorate([
|
|
294
|
-
serialize()
|
|
295
|
-
], FluentMaterial.prototype, "hoverRadius", void 0);
|
|
296
|
-
__decorate([
|
|
297
|
-
serializeAsColor4()
|
|
298
|
-
], FluentMaterial.prototype, "hoverColor", void 0);
|
|
299
|
-
__decorate([
|
|
300
|
-
serializeAsVector3()
|
|
301
|
-
], FluentMaterial.prototype, "hoverPosition", void 0);
|
|
302
|
-
__decorate([
|
|
303
|
-
serializeAsTexture("albedoTexture")
|
|
304
|
-
], FluentMaterial.prototype, "_albedoTexture", void 0);
|
|
305
|
-
__decorate([
|
|
306
|
-
expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
307
|
-
], FluentMaterial.prototype, "albedoTexture", void 0);
|
|
290
|
+
/**
|
|
291
|
+
* Disposes the material.
|
|
292
|
+
* @param forceDisposeEffect specifies if effects should be forcefully disposed
|
|
293
|
+
*/
|
|
294
|
+
dispose(forceDisposeEffect) {
|
|
295
|
+
super.dispose(forceDisposeEffect);
|
|
296
|
+
}
|
|
297
|
+
clone(name) {
|
|
298
|
+
return SerializationHelper.Clone(() => new _a(name, this.getScene()), this);
|
|
299
|
+
}
|
|
300
|
+
serialize() {
|
|
301
|
+
const serializationObject = super.serialize();
|
|
302
|
+
serializationObject.customType = "BABYLON.GUI.FluentMaterial";
|
|
303
|
+
return serializationObject;
|
|
304
|
+
}
|
|
305
|
+
getClassName() {
|
|
306
|
+
return "FluentMaterial";
|
|
307
|
+
}
|
|
308
|
+
// Statics
|
|
309
|
+
/**
|
|
310
|
+
* Creates a fluent material from parsed material data.
|
|
311
|
+
* @param source defines the JSON representation of the material
|
|
312
|
+
* @param scene defines the hosting scene
|
|
313
|
+
* @param rootUrl defines the root URL to use to load textures and relative dependencies
|
|
314
|
+
* @returns a new fluent material
|
|
315
|
+
*/
|
|
316
|
+
static Parse(source, scene, rootUrl) {
|
|
317
|
+
return SerializationHelper.Parse(() => new _a(source.name, scene), source, scene, rootUrl);
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
_FluentMaterial_innerGlowColorIntensity_accessor_storage = new WeakMap(),
|
|
321
|
+
_FluentMaterial_renderBorders_accessor_storage = new WeakMap(),
|
|
322
|
+
_FluentMaterial_renderHoverLight_accessor_storage = new WeakMap(),
|
|
323
|
+
_FluentMaterial_albedoTexture_accessor_storage = new WeakMap(),
|
|
324
|
+
(() => {
|
|
325
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
326
|
+
_innerGlowColorIntensity_decorators = [serialize(), expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
327
|
+
_innerGlowColor_decorators = [serializeAsColor3()];
|
|
328
|
+
_albedoColor_decorators = [serializeAsColor3()];
|
|
329
|
+
_renderBorders_decorators = [serialize(), expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
330
|
+
_borderWidth_decorators = [serialize()];
|
|
331
|
+
_edgeSmoothingValue_decorators = [serialize()];
|
|
332
|
+
_borderMinValue_decorators = [serialize()];
|
|
333
|
+
_renderHoverLight_decorators = [serialize(), expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
334
|
+
_hoverRadius_decorators = [serialize()];
|
|
335
|
+
_hoverColor_decorators = [serializeAsColor4()];
|
|
336
|
+
_hoverPosition_decorators = [serializeAsVector3()];
|
|
337
|
+
__albedoTexture_decorators = [serializeAsTexture("albedoTexture")];
|
|
338
|
+
_albedoTexture_decorators = [expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")];
|
|
339
|
+
__esDecorate(_a, null, _innerGlowColorIntensity_decorators, { kind: "accessor", name: "innerGlowColorIntensity", static: false, private: false, access: { has: obj => "innerGlowColorIntensity" in obj, get: obj => obj.innerGlowColorIntensity, set: (obj, value) => { obj.innerGlowColorIntensity = value; } }, metadata: _metadata }, _innerGlowColorIntensity_initializers, _innerGlowColorIntensity_extraInitializers);
|
|
340
|
+
__esDecorate(_a, null, _renderBorders_decorators, { kind: "accessor", name: "renderBorders", static: false, private: false, access: { has: obj => "renderBorders" in obj, get: obj => obj.renderBorders, set: (obj, value) => { obj.renderBorders = value; } }, metadata: _metadata }, _renderBorders_initializers, _renderBorders_extraInitializers);
|
|
341
|
+
__esDecorate(_a, null, _renderHoverLight_decorators, { kind: "accessor", name: "renderHoverLight", static: false, private: false, access: { has: obj => "renderHoverLight" in obj, get: obj => obj.renderHoverLight, set: (obj, value) => { obj.renderHoverLight = value; } }, metadata: _metadata }, _renderHoverLight_initializers, _renderHoverLight_extraInitializers);
|
|
342
|
+
__esDecorate(_a, null, _albedoTexture_decorators, { kind: "accessor", name: "albedoTexture", static: false, private: false, access: { has: obj => "albedoTexture" in obj, get: obj => obj.albedoTexture, set: (obj, value) => { obj.albedoTexture = value; } }, metadata: _metadata }, _albedoTexture_initializers, _albedoTexture_extraInitializers);
|
|
343
|
+
__esDecorate(null, null, _innerGlowColor_decorators, { kind: "field", name: "innerGlowColor", static: false, private: false, access: { has: obj => "innerGlowColor" in obj, get: obj => obj.innerGlowColor, set: (obj, value) => { obj.innerGlowColor = value; } }, metadata: _metadata }, _innerGlowColor_initializers, _innerGlowColor_extraInitializers);
|
|
344
|
+
__esDecorate(null, null, _albedoColor_decorators, { kind: "field", name: "albedoColor", static: false, private: false, access: { has: obj => "albedoColor" in obj, get: obj => obj.albedoColor, set: (obj, value) => { obj.albedoColor = value; } }, metadata: _metadata }, _albedoColor_initializers, _albedoColor_extraInitializers);
|
|
345
|
+
__esDecorate(null, null, _borderWidth_decorators, { kind: "field", name: "borderWidth", static: false, private: false, access: { has: obj => "borderWidth" in obj, get: obj => obj.borderWidth, set: (obj, value) => { obj.borderWidth = value; } }, metadata: _metadata }, _borderWidth_initializers, _borderWidth_extraInitializers);
|
|
346
|
+
__esDecorate(null, null, _edgeSmoothingValue_decorators, { kind: "field", name: "edgeSmoothingValue", static: false, private: false, access: { has: obj => "edgeSmoothingValue" in obj, get: obj => obj.edgeSmoothingValue, set: (obj, value) => { obj.edgeSmoothingValue = value; } }, metadata: _metadata }, _edgeSmoothingValue_initializers, _edgeSmoothingValue_extraInitializers);
|
|
347
|
+
__esDecorate(null, null, _borderMinValue_decorators, { kind: "field", name: "borderMinValue", static: false, private: false, access: { has: obj => "borderMinValue" in obj, get: obj => obj.borderMinValue, set: (obj, value) => { obj.borderMinValue = value; } }, metadata: _metadata }, _borderMinValue_initializers, _borderMinValue_extraInitializers);
|
|
348
|
+
__esDecorate(null, null, _hoverRadius_decorators, { kind: "field", name: "hoverRadius", static: false, private: false, access: { has: obj => "hoverRadius" in obj, get: obj => obj.hoverRadius, set: (obj, value) => { obj.hoverRadius = value; } }, metadata: _metadata }, _hoverRadius_initializers, _hoverRadius_extraInitializers);
|
|
349
|
+
__esDecorate(null, null, _hoverColor_decorators, { kind: "field", name: "hoverColor", static: false, private: false, access: { has: obj => "hoverColor" in obj, get: obj => obj.hoverColor, set: (obj, value) => { obj.hoverColor = value; } }, metadata: _metadata }, _hoverColor_initializers, _hoverColor_extraInitializers);
|
|
350
|
+
__esDecorate(null, null, _hoverPosition_decorators, { kind: "field", name: "hoverPosition", static: false, private: false, access: { has: obj => "hoverPosition" in obj, get: obj => obj.hoverPosition, set: (obj, value) => { obj.hoverPosition = value; } }, metadata: _metadata }, _hoverPosition_initializers, _hoverPosition_extraInitializers);
|
|
351
|
+
__esDecorate(null, null, __albedoTexture_decorators, { kind: "field", name: "_albedoTexture", static: false, private: false, access: { has: obj => "_albedoTexture" in obj, get: obj => obj._albedoTexture, set: (obj, value) => { obj._albedoTexture = value; } }, metadata: _metadata }, __albedoTexture_initializers, __albedoTexture_extraInitializers);
|
|
352
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
353
|
+
})(),
|
|
354
|
+
_a;
|
|
355
|
+
})();
|
|
356
|
+
export { FluentMaterial };
|
|
308
357
|
let _Registered = false;
|
|
309
358
|
/**
|
|
310
359
|
* Registers the FluentMaterial class with the type store for serialization support.
|