@babylonjs/gui 9.12.1 → 9.14.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/FrameGraph/pure.d.ts +2 -0
- package/2D/FrameGraph/pure.js +3 -0
- package/2D/FrameGraph/pure.js.map +1 -0
- package/2D/FrameGraph/renderGraphGUIBlock.d.ts +3 -41
- package/2D/FrameGraph/renderGraphGUIBlock.js +5 -64
- package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
- package/2D/FrameGraph/renderGraphGUIBlock.pure.d.ts +48 -0
- package/2D/FrameGraph/renderGraphGUIBlock.pure.js +78 -0
- package/2D/FrameGraph/renderGraphGUIBlock.pure.js.map +1 -0
- package/2D/controls/button.d.ts +3 -107
- package/2D/controls/button.js +5 -243
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/button.pure.d.ts +114 -0
- package/2D/controls/button.pure.js +257 -0
- package/2D/controls/button.pure.js.map +1 -0
- package/2D/controls/checkbox.d.ts +3 -51
- package/2D/controls/checkbox.js +5 -161
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/checkbox.pure.d.ts +58 -0
- package/2D/controls/checkbox.pure.js +175 -0
- package/2D/controls/checkbox.pure.js.map +1 -0
- package/2D/controls/colorpicker.d.ts +5 -101
- package/2D/controls/colorpicker.js +7 -1394
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/colorpicker.pure.d.ts +106 -0
- package/2D/controls/colorpicker.pure.js +1406 -0
- package/2D/controls/colorpicker.pure.js.map +1 -0
- package/2D/controls/container.d.ts +3 -177
- package/2D/controls/container.js +5 -615
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/container.pure.d.ts +184 -0
- package/2D/controls/container.pure.js +629 -0
- package/2D/controls/container.pure.js.map +1 -0
- package/2D/controls/control.d.ts +3 -944
- package/2D/controls/control.js +5 -2457
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/control.pure.d.ts +951 -0
- package/2D/controls/control.pure.js +2471 -0
- package/2D/controls/control.pure.js.map +1 -0
- package/2D/controls/displayGrid.d.ts +5 -53
- package/2D/controls/displayGrid.js +7 -201
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/displayGrid.pure.d.ts +58 -0
- package/2D/controls/displayGrid.pure.js +213 -0
- package/2D/controls/displayGrid.pure.js.map +1 -0
- package/2D/controls/ellipse.d.ts +5 -25
- package/2D/controls/ellipse.js +7 -92
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/ellipse.pure.d.ts +30 -0
- package/2D/controls/ellipse.pure.js +104 -0
- package/2D/controls/ellipse.pure.js.map +1 -0
- package/2D/controls/focusableButton.d.ts +3 -15
- package/2D/controls/focusableButton.js +5 -22
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/focusableButton.pure.d.ts +22 -0
- package/2D/controls/focusableButton.pure.js +36 -0
- package/2D/controls/focusableButton.pure.js.map +1 -0
- package/2D/controls/gradient/LinearGradient.d.ts +3 -43
- package/2D/controls/gradient/LinearGradient.js +5 -70
- package/2D/controls/gradient/LinearGradient.js.map +1 -1
- package/2D/controls/gradient/LinearGradient.pure.d.ts +50 -0
- package/2D/controls/gradient/LinearGradient.pure.js +84 -0
- package/2D/controls/gradient/LinearGradient.pure.js.map +1 -0
- package/2D/controls/gradient/RadialGradient.d.ts +3 -51
- package/2D/controls/gradient/RadialGradient.js +5 -86
- package/2D/controls/gradient/RadialGradient.js.map +1 -1
- package/2D/controls/gradient/RadialGradient.pure.d.ts +58 -0
- package/2D/controls/gradient/RadialGradient.pure.js +100 -0
- package/2D/controls/gradient/RadialGradient.pure.js.map +1 -0
- package/2D/controls/gradient/pure.d.ts +3 -0
- package/2D/controls/gradient/pure.js +4 -0
- package/2D/controls/gradient/pure.js.map +1 -0
- package/2D/controls/grid.d.ts +3 -149
- package/2D/controls/grid.js +5 -525
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/grid.pure.d.ts +156 -0
- package/2D/controls/grid.pure.js +539 -0
- package/2D/controls/grid.pure.js.map +1 -0
- package/2D/controls/image.d.ts +3 -226
- package/2D/controls/image.js +5 -913
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/image.pure.d.ts +233 -0
- package/2D/controls/image.pure.js +927 -0
- package/2D/controls/image.pure.js.map +1 -0
- package/2D/controls/inputPassword.d.ts +3 -7
- package/2D/controls/inputPassword.js +5 -19
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputPassword.pure.d.ts +14 -0
- package/2D/controls/inputPassword.pure.js +33 -0
- package/2D/controls/inputPassword.pure.js.map +1 -0
- package/2D/controls/inputText.d.ts +3 -202
- package/2D/controls/inputText.js +5 -1050
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputText.pure.d.ts +209 -0
- package/2D/controls/inputText.pure.js +1064 -0
- package/2D/controls/inputText.pure.js.map +1 -0
- package/2D/controls/inputTextArea.d.ts +3 -140
- package/2D/controls/inputTextArea.js +5 -1023
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/inputTextArea.pure.d.ts +147 -0
- package/2D/controls/inputTextArea.pure.js +1037 -0
- package/2D/controls/inputTextArea.pure.js.map +1 -0
- package/2D/controls/line.d.ts +5 -74
- package/2D/controls/line.js +7 -234
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/line.pure.d.ts +79 -0
- package/2D/controls/line.pure.js +246 -0
- package/2D/controls/line.pure.js.map +1 -0
- package/2D/controls/multiLine.d.ts +3 -73
- package/2D/controls/multiLine.js +5 -234
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/multiLine.pure.d.ts +80 -0
- package/2D/controls/multiLine.pure.js +248 -0
- package/2D/controls/multiLine.pure.js.map +1 -0
- package/2D/controls/pure.d.ts +38 -0
- package/2D/controls/pure.js +39 -0
- package/2D/controls/pure.js.map +1 -0
- package/2D/controls/radioButton.d.ts +3 -47
- package/2D/controls/radioButton.js +5 -182
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/radioButton.pure.d.ts +54 -0
- package/2D/controls/radioButton.pure.js +196 -0
- package/2D/controls/radioButton.pure.js.map +1 -0
- package/2D/controls/rectangle.d.ts +5 -43
- package/2D/controls/rectangle.js +7 -205
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/rectangle.pure.d.ts +48 -0
- package/2D/controls/rectangle.pure.js +217 -0
- package/2D/controls/rectangle.pure.js.map +1 -0
- package/2D/controls/scrollViewers/pure.d.ts +2 -0
- package/2D/controls/scrollViewers/pure.js +3 -0
- package/2D/controls/scrollViewers/pure.js.map +1 -0
- package/2D/controls/scrollViewers/scrollViewer.d.ts +3 -176
- package/2D/controls/scrollViewers/scrollViewer.js +5 -584
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.pure.d.ts +183 -0
- package/2D/controls/scrollViewers/scrollViewer.pure.js +598 -0
- package/2D/controls/scrollViewers/scrollViewer.pure.js.map +1 -0
- package/2D/controls/sliders/imageBasedSlider.d.ts +3 -45
- package/2D/controls/sliders/imageBasedSlider.js +5 -165
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.pure.d.ts +52 -0
- package/2D/controls/sliders/imageBasedSlider.pure.js +179 -0
- package/2D/controls/sliders/imageBasedSlider.pure.js.map +1 -0
- package/2D/controls/sliders/pure.d.ts +4 -0
- package/2D/controls/sliders/pure.js +5 -0
- package/2D/controls/sliders/pure.js.map +1 -0
- package/2D/controls/sliders/scrollBar.d.ts +3 -48
- package/2D/controls/sliders/scrollBar.js +5 -170
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.pure.d.ts +55 -0
- package/2D/controls/sliders/scrollBar.pure.js +184 -0
- package/2D/controls/sliders/scrollBar.pure.js.map +1 -0
- package/2D/controls/sliders/slider.d.ts +3 -44
- package/2D/controls/sliders/slider.js +5 -278
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/sliders/slider.pure.d.ts +51 -0
- package/2D/controls/sliders/slider.pure.js +292 -0
- package/2D/controls/sliders/slider.pure.js.map +1 -0
- package/2D/controls/stackPanel.d.ts +3 -62
- package/2D/controls/stackPanel.js +5 -243
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/stackPanel.pure.d.ts +69 -0
- package/2D/controls/stackPanel.pure.js +257 -0
- package/2D/controls/stackPanel.pure.js.map +1 -0
- package/2D/controls/statics.d.ts +3 -4
- package/2D/controls/statics.js +5 -47
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/statics.pure.d.ts +11 -0
- package/2D/controls/statics.pure.js +61 -0
- package/2D/controls/statics.pure.js.map +1 -0
- package/2D/controls/textBlock.d.ts +3 -217
- package/2D/controls/textBlock.js +5 -676
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textBlock.pure.d.ts +224 -0
- package/2D/controls/textBlock.pure.js +690 -0
- package/2D/controls/textBlock.pure.js.map +1 -0
- package/2D/controls/toggleButton.d.ts +3 -91
- package/2D/controls/toggleButton.js +5 -226
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/toggleButton.pure.d.ts +98 -0
- package/2D/controls/toggleButton.pure.js +240 -0
- package/2D/controls/toggleButton.pure.js.map +1 -0
- package/2D/controls/virtualKeyboard.d.ts +3 -100
- package/2D/controls/virtualKeyboard.js +5 -272
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/controls/virtualKeyboard.pure.d.ts +107 -0
- package/2D/controls/virtualKeyboard.pure.js +286 -0
- package/2D/controls/virtualKeyboard.pure.js.map +1 -0
- package/2D/pure.d.ts +13 -0
- package/2D/pure.js +15 -0
- package/2D/pure.js.map +1 -0
- package/3D/controls/pure.d.ts +23 -0
- package/3D/controls/pure.js +24 -0
- package/3D/controls/pure.js.map +1 -0
- package/3D/gizmos/pure.d.ts +3 -0
- package/3D/gizmos/pure.js +4 -0
- package/3D/gizmos/pure.js.map +1 -0
- package/3D/materials/fluent/fluentMaterial.d.ts +5 -100
- package/3D/materials/fluent/fluentMaterial.js +7 -305
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.pure.d.ts +105 -0
- package/3D/materials/fluent/fluentMaterial.pure.js +317 -0
- package/3D/materials/fluent/fluentMaterial.pure.js.map +1 -0
- package/3D/materials/fluent/pure.d.ts +2 -0
- package/3D/materials/fluent/pure.js +3 -0
- package/3D/materials/fluent/pure.js.map +1 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +5 -164
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +7 -488
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.d.ts +169 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js +500 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js.map +1 -0
- package/3D/materials/fluentBackplate/pure.d.ts +2 -0
- package/3D/materials/fluentBackplate/pure.js +3 -0
- package/3D/materials/fluentBackplate/pure.js.map +1 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +5 -200
- package/3D/materials/fluentButton/fluentButtonMaterial.js +7 -563
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.pure.d.ts +205 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.pure.js +575 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.pure.js.map +1 -0
- package/3D/materials/fluentButton/pure.d.ts +2 -0
- package/3D/materials/fluentButton/pure.js +3 -0
- package/3D/materials/fluentButton/pure.js.map +1 -0
- package/3D/materials/handle/handleMaterial.d.ts +5 -66
- package/3D/materials/handle/handleMaterial.js +5 -118
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.pure.d.ts +66 -0
- package/3D/materials/handle/handleMaterial.pure.js +119 -0
- package/3D/materials/handle/handleMaterial.pure.js.map +1 -0
- package/3D/materials/handle/pure.d.ts +2 -0
- package/3D/materials/handle/pure.js +3 -0
- package/3D/materials/handle/pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlBackglowMaterial.d.ts +5 -85
- package/3D/materials/mrdl/mrdlBackglowMaterial.js +7 -299
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.pure.d.ts +90 -0
- package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js +311 -0
- package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +5 -145
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +7 -433
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.pure.d.ts +157 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js +452 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.d.ts +5 -183
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js +7 -532
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.d.ts +188 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js +544 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.d.ts +5 -54
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js +7 -227
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.d.ts +59 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js +239 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +5 -334
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +7 -855
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.d.ts +346 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js +874 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +5 -334
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +7 -855
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.d.ts +346 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js +874 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js.map +1 -0
- package/3D/materials/mrdl/pure.d.ts +7 -0
- package/3D/materials/mrdl/pure.js +8 -0
- package/3D/materials/mrdl/pure.js.map +1 -0
- package/3D/materials/pure.d.ts +6 -0
- package/3D/materials/pure.js +8 -0
- package/3D/materials/pure.js.map +1 -0
- package/3D/pure.d.ts +6 -0
- package/3D/pure.js +8 -0
- package/3D/pure.js.map +1 -0
- package/package.json +50 -3
- package/pure.d.ts +3 -0
- package/pure.js +5 -0
- package/pure.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentButton/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,6BAA6B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./fluentButtonMaterial.pure\";\n"]}
|
|
@@ -1,68 +1,7 @@
|
|
|
1
|
-
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.js";
|
|
2
|
-
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
5
|
-
import "./shaders/handle.vertex.js";
|
|
6
|
-
import "./shaders/handle.fragment.js";
|
|
7
1
|
/**
|
|
8
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./handleMaterial.pure" for tree-shakeable, side-effect-free usage.
|
|
9
4
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private _onBeforeRender;
|
|
14
|
-
private _color;
|
|
15
|
-
private _scale;
|
|
16
|
-
private _targetColor;
|
|
17
|
-
private _targetScale;
|
|
18
|
-
private _lastTick;
|
|
19
|
-
/**
|
|
20
|
-
* Is the material indicating hovering state
|
|
21
|
-
*/
|
|
22
|
-
get hover(): boolean;
|
|
23
|
-
set hover(b: boolean);
|
|
24
|
-
/**
|
|
25
|
-
* Is the material indicating drag state
|
|
26
|
-
*/
|
|
27
|
-
get drag(): boolean;
|
|
28
|
-
set drag(b: boolean);
|
|
29
|
-
/**
|
|
30
|
-
* Length of animation
|
|
31
|
-
*/
|
|
32
|
-
animationLength: number;
|
|
33
|
-
/**
|
|
34
|
-
* Color of the handle when hovered
|
|
35
|
-
*/
|
|
36
|
-
hoverColor: Color3;
|
|
37
|
-
/**
|
|
38
|
-
* Color of the handle when idle
|
|
39
|
-
*/
|
|
40
|
-
baseColor: Color3;
|
|
41
|
-
/**
|
|
42
|
-
* Scale of the handle when hovered
|
|
43
|
-
*/
|
|
44
|
-
hoverScale: number;
|
|
45
|
-
/**
|
|
46
|
-
* Scale of the handle when idle
|
|
47
|
-
*/
|
|
48
|
-
baseScale: number;
|
|
49
|
-
/**
|
|
50
|
-
* Scale of the handle when dragged
|
|
51
|
-
*/
|
|
52
|
-
dragScale: number;
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
_positionOffset: Vector3;
|
|
57
|
-
/**
|
|
58
|
-
* Creates a handle material
|
|
59
|
-
* @param name Name of the material
|
|
60
|
-
* @param scene Scene
|
|
61
|
-
*/
|
|
62
|
-
constructor(name: string, scene: Scene);
|
|
63
|
-
private _updateInterpolationTarget;
|
|
64
|
-
/**
|
|
65
|
-
* Disposes the handle material
|
|
66
|
-
*/
|
|
67
|
-
dispose(): void;
|
|
68
|
-
}
|
|
5
|
+
export * from "./handleMaterial.pure.js";
|
|
6
|
+
import "./shaders/handle.vertex.js";
|
|
7
|
+
import "./shaders/handle.fragment.js";
|
|
@@ -1,121 +1,8 @@
|
|
|
1
|
-
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.js";
|
|
2
|
-
import { Color3, TmpColors } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import "./shaders/handle.vertex.js";
|
|
5
|
-
import "./shaders/handle.fragment.js";
|
|
6
1
|
/**
|
|
7
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./handleMaterial.pure" for tree-shakeable, side-effect-free usage.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
get hover() {
|
|
14
|
-
return this._hover;
|
|
15
|
-
}
|
|
16
|
-
set hover(b) {
|
|
17
|
-
this._hover = b;
|
|
18
|
-
this._updateInterpolationTarget();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Is the material indicating drag state
|
|
22
|
-
*/
|
|
23
|
-
get drag() {
|
|
24
|
-
return this._drag;
|
|
25
|
-
}
|
|
26
|
-
set drag(b) {
|
|
27
|
-
this._drag = b;
|
|
28
|
-
this._updateInterpolationTarget();
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Creates a handle material
|
|
32
|
-
* @param name Name of the material
|
|
33
|
-
* @param scene Scene
|
|
34
|
-
*/
|
|
35
|
-
constructor(name, scene) {
|
|
36
|
-
const shaderLanguage = scene.getEngine().isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */;
|
|
37
|
-
super(name, scene, "handle", {
|
|
38
|
-
attributes: ["position"],
|
|
39
|
-
uniforms: ["worldViewProjection", "color", "scale", "positionOffset"],
|
|
40
|
-
needAlphaBlending: false,
|
|
41
|
-
needAlphaTesting: false,
|
|
42
|
-
shaderLanguage,
|
|
43
|
-
extraInitializationsAsync: shaderLanguage === 1 /* ShaderLanguage.WGSL */
|
|
44
|
-
? async () => {
|
|
45
|
-
await Promise.all([import("./wgsl/handle.vertex.js"), import("./wgsl/handle.fragment.js")]);
|
|
46
|
-
}
|
|
47
|
-
: undefined,
|
|
48
|
-
});
|
|
49
|
-
this._hover = false;
|
|
50
|
-
this._drag = false;
|
|
51
|
-
this._color = new Color3();
|
|
52
|
-
this._scale = 1;
|
|
53
|
-
this._lastTick = -1;
|
|
54
|
-
/**
|
|
55
|
-
* Length of animation
|
|
56
|
-
*/
|
|
57
|
-
this.animationLength = 100;
|
|
58
|
-
/**
|
|
59
|
-
* Color of the handle when hovered
|
|
60
|
-
*/
|
|
61
|
-
this.hoverColor = new Color3(0, 0.467, 0.84);
|
|
62
|
-
/**
|
|
63
|
-
* Color of the handle when idle
|
|
64
|
-
*/
|
|
65
|
-
this.baseColor = new Color3(1, 1, 1);
|
|
66
|
-
/**
|
|
67
|
-
* Scale of the handle when hovered
|
|
68
|
-
*/
|
|
69
|
-
this.hoverScale = 0.75;
|
|
70
|
-
/**
|
|
71
|
-
* Scale of the handle when idle
|
|
72
|
-
*/
|
|
73
|
-
this.baseScale = 0.35;
|
|
74
|
-
/**
|
|
75
|
-
* Scale of the handle when dragged
|
|
76
|
-
*/
|
|
77
|
-
this.dragScale = 0.55;
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
this._positionOffset = Vector3.Zero();
|
|
82
|
-
this._updateInterpolationTarget();
|
|
83
|
-
// Register callback for scene after render
|
|
84
|
-
this._lastTick = Date.now();
|
|
85
|
-
this._onBeforeRender = this.getScene().onBeforeRenderObservable.add(() => {
|
|
86
|
-
const tick = Date.now();
|
|
87
|
-
const delta = tick - this._lastTick;
|
|
88
|
-
const scaleDiff = this._targetScale - this._scale;
|
|
89
|
-
const colorDiff = TmpColors.Color3[0].copyFrom(this._targetColor).subtractToRef(this._color, TmpColors.Color3[0]);
|
|
90
|
-
this._scale = this._scale + (scaleDiff * delta) / this.animationLength;
|
|
91
|
-
colorDiff.scaleToRef(delta / this.animationLength, colorDiff);
|
|
92
|
-
this._color.addToRef(colorDiff, this._color);
|
|
93
|
-
this.setColor3("color", this._color);
|
|
94
|
-
this.setFloat("scale", this._scale);
|
|
95
|
-
this.setVector3("positionOffset", this._positionOffset);
|
|
96
|
-
this._lastTick = tick;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
_updateInterpolationTarget() {
|
|
100
|
-
if (this.drag) {
|
|
101
|
-
this._targetColor = this.hoverColor;
|
|
102
|
-
this._targetScale = this.dragScale;
|
|
103
|
-
}
|
|
104
|
-
else if (this.hover) {
|
|
105
|
-
this._targetColor = this.hoverColor;
|
|
106
|
-
this._targetScale = this.hoverScale;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
this._targetColor = this.baseColor;
|
|
110
|
-
this._targetScale = this.baseScale;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Disposes the handle material
|
|
115
|
-
*/
|
|
116
|
-
dispose() {
|
|
117
|
-
super.dispose();
|
|
118
|
-
this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
5
|
+
export * from "./handleMaterial.pure.js";
|
|
6
|
+
import "./shaders/handle.vertex.js";
|
|
7
|
+
import "./shaders/handle.fragment.js";
|
|
121
8
|
//# sourceMappingURL=handleMaterial.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/handle/handleMaterial.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"handleMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/handle/handleMaterial.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,uBAAuB,CAAC;AAEtC,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC","sourcesContent":["/**\r\n * Re-exports the pure implementation and applies the runtime registration side effect.\r\n * Import \"./handleMaterial.pure\" for tree-shakeable, side-effect-free usage.\r\n */\r\nexport * from \"./handleMaterial.pure\";\r\n\r\nimport \"./shaders/handle.vertex\";\r\nimport \"./shaders/handle.fragment\";\r\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.pure.js";
|
|
2
|
+
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.pure.js";
|
|
4
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
5
|
+
/**
|
|
6
|
+
* Class used to render gizmo handles with fluent design
|
|
7
|
+
*/
|
|
8
|
+
export declare class HandleMaterial extends ShaderMaterial {
|
|
9
|
+
private _hover;
|
|
10
|
+
private _drag;
|
|
11
|
+
private _onBeforeRender;
|
|
12
|
+
private _color;
|
|
13
|
+
private _scale;
|
|
14
|
+
private _targetColor;
|
|
15
|
+
private _targetScale;
|
|
16
|
+
private _lastTick;
|
|
17
|
+
/**
|
|
18
|
+
* Is the material indicating hovering state
|
|
19
|
+
*/
|
|
20
|
+
get hover(): boolean;
|
|
21
|
+
set hover(b: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Is the material indicating drag state
|
|
24
|
+
*/
|
|
25
|
+
get drag(): boolean;
|
|
26
|
+
set drag(b: boolean);
|
|
27
|
+
/**
|
|
28
|
+
* Length of animation
|
|
29
|
+
*/
|
|
30
|
+
animationLength: number;
|
|
31
|
+
/**
|
|
32
|
+
* Color of the handle when hovered
|
|
33
|
+
*/
|
|
34
|
+
hoverColor: Color3;
|
|
35
|
+
/**
|
|
36
|
+
* Color of the handle when idle
|
|
37
|
+
*/
|
|
38
|
+
baseColor: Color3;
|
|
39
|
+
/**
|
|
40
|
+
* Scale of the handle when hovered
|
|
41
|
+
*/
|
|
42
|
+
hoverScale: number;
|
|
43
|
+
/**
|
|
44
|
+
* Scale of the handle when idle
|
|
45
|
+
*/
|
|
46
|
+
baseScale: number;
|
|
47
|
+
/**
|
|
48
|
+
* Scale of the handle when dragged
|
|
49
|
+
*/
|
|
50
|
+
dragScale: number;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
_positionOffset: Vector3;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a handle material
|
|
57
|
+
* @param name Name of the material
|
|
58
|
+
* @param scene Scene
|
|
59
|
+
*/
|
|
60
|
+
constructor(name: string, scene: Scene);
|
|
61
|
+
private _updateInterpolationTarget;
|
|
62
|
+
/**
|
|
63
|
+
* Disposes the handle material
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.pure.js";
|
|
2
|
+
import { Color3, TmpColors } from "@babylonjs/core/Maths/math.color.pure.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Class used to render gizmo handles with fluent design
|
|
6
|
+
*/
|
|
7
|
+
export class HandleMaterial extends ShaderMaterial {
|
|
8
|
+
/**
|
|
9
|
+
* Is the material indicating hovering state
|
|
10
|
+
*/
|
|
11
|
+
get hover() {
|
|
12
|
+
return this._hover;
|
|
13
|
+
}
|
|
14
|
+
set hover(b) {
|
|
15
|
+
this._hover = b;
|
|
16
|
+
this._updateInterpolationTarget();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Is the material indicating drag state
|
|
20
|
+
*/
|
|
21
|
+
get drag() {
|
|
22
|
+
return this._drag;
|
|
23
|
+
}
|
|
24
|
+
set drag(b) {
|
|
25
|
+
this._drag = b;
|
|
26
|
+
this._updateInterpolationTarget();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a handle material
|
|
30
|
+
* @param name Name of the material
|
|
31
|
+
* @param scene Scene
|
|
32
|
+
*/
|
|
33
|
+
constructor(name, scene) {
|
|
34
|
+
const shaderLanguage = scene.getEngine().isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */;
|
|
35
|
+
super(name, scene, "handle", {
|
|
36
|
+
attributes: ["position"],
|
|
37
|
+
uniforms: ["worldViewProjection", "color", "scale", "positionOffset"],
|
|
38
|
+
needAlphaBlending: false,
|
|
39
|
+
needAlphaTesting: false,
|
|
40
|
+
shaderLanguage,
|
|
41
|
+
extraInitializationsAsync: shaderLanguage === 1 /* ShaderLanguage.WGSL */
|
|
42
|
+
? async () => {
|
|
43
|
+
await Promise.all([import("./wgsl/handle.vertex.js"), import("./wgsl/handle.fragment.js")]);
|
|
44
|
+
}
|
|
45
|
+
: undefined,
|
|
46
|
+
});
|
|
47
|
+
this._hover = false;
|
|
48
|
+
this._drag = false;
|
|
49
|
+
this._color = new Color3();
|
|
50
|
+
this._scale = 1;
|
|
51
|
+
this._lastTick = -1;
|
|
52
|
+
/**
|
|
53
|
+
* Length of animation
|
|
54
|
+
*/
|
|
55
|
+
this.animationLength = 100;
|
|
56
|
+
/**
|
|
57
|
+
* Color of the handle when hovered
|
|
58
|
+
*/
|
|
59
|
+
this.hoverColor = new Color3(0, 0.467, 0.84);
|
|
60
|
+
/**
|
|
61
|
+
* Color of the handle when idle
|
|
62
|
+
*/
|
|
63
|
+
this.baseColor = new Color3(1, 1, 1);
|
|
64
|
+
/**
|
|
65
|
+
* Scale of the handle when hovered
|
|
66
|
+
*/
|
|
67
|
+
this.hoverScale = 0.75;
|
|
68
|
+
/**
|
|
69
|
+
* Scale of the handle when idle
|
|
70
|
+
*/
|
|
71
|
+
this.baseScale = 0.35;
|
|
72
|
+
/**
|
|
73
|
+
* Scale of the handle when dragged
|
|
74
|
+
*/
|
|
75
|
+
this.dragScale = 0.55;
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
this._positionOffset = Vector3.Zero();
|
|
80
|
+
this._updateInterpolationTarget();
|
|
81
|
+
// Register callback for scene after render
|
|
82
|
+
this._lastTick = Date.now();
|
|
83
|
+
this._onBeforeRender = this.getScene().onBeforeRenderObservable.add(() => {
|
|
84
|
+
const tick = Date.now();
|
|
85
|
+
const delta = tick - this._lastTick;
|
|
86
|
+
const scaleDiff = this._targetScale - this._scale;
|
|
87
|
+
const colorDiff = TmpColors.Color3[0].copyFrom(this._targetColor).subtractToRef(this._color, TmpColors.Color3[0]);
|
|
88
|
+
this._scale = this._scale + (scaleDiff * delta) / this.animationLength;
|
|
89
|
+
colorDiff.scaleToRef(delta / this.animationLength, colorDiff);
|
|
90
|
+
this._color.addToRef(colorDiff, this._color);
|
|
91
|
+
this.setColor3("color", this._color);
|
|
92
|
+
this.setFloat("scale", this._scale);
|
|
93
|
+
this.setVector3("positionOffset", this._positionOffset);
|
|
94
|
+
this._lastTick = tick;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
_updateInterpolationTarget() {
|
|
98
|
+
if (this.drag) {
|
|
99
|
+
this._targetColor = this.hoverColor;
|
|
100
|
+
this._targetScale = this.dragScale;
|
|
101
|
+
}
|
|
102
|
+
else if (this.hover) {
|
|
103
|
+
this._targetColor = this.hoverColor;
|
|
104
|
+
this._targetScale = this.hoverScale;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this._targetColor = this.baseColor;
|
|
108
|
+
this._targetScale = this.baseScale;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Disposes the handle material
|
|
113
|
+
*/
|
|
114
|
+
dispose() {
|
|
115
|
+
super.dispose();
|
|
116
|
+
this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=handleMaterial.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleMaterial.pure.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/handle/handleMaterial.pure.ts"],"names":[],"mappings":"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","sourcesContent":["import { ShaderMaterial } from \"core/Materials/shaderMaterial.pure\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Observer } from \"core/Misc/observable\";\r\nimport { Color3, TmpColors } from \"core/Maths/math.color.pure\";\r\nimport { Vector3 } from \"core/Maths/math.vector.pure\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Class used to render gizmo handles with fluent design\r\n */\r\nexport class HandleMaterial extends ShaderMaterial {\r\n private _hover: boolean = false;\r\n private _drag: boolean = false;\r\n private _onBeforeRender: Nullable<Observer<Scene>>;\r\n private _color: Color3 = new Color3();\r\n private _scale: number = 1;\r\n private _targetColor: Color3;\r\n private _targetScale: number;\r\n private _lastTick = -1;\r\n\r\n /**\r\n * Is the material indicating hovering state\r\n */\r\n public get hover(): boolean {\r\n return this._hover;\r\n }\r\n\r\n public set hover(b: boolean) {\r\n this._hover = b;\r\n\r\n this._updateInterpolationTarget();\r\n }\r\n\r\n /**\r\n * Is the material indicating drag state\r\n */\r\n public get drag(): boolean {\r\n return this._drag;\r\n }\r\n\r\n public set drag(b: boolean) {\r\n this._drag = b;\r\n\r\n this._updateInterpolationTarget();\r\n }\r\n\r\n /**\r\n * Length of animation\r\n */\r\n public animationLength: number = 100;\r\n\r\n /**\r\n * Color of the handle when hovered\r\n */\r\n public hoverColor: Color3 = new Color3(0, 0.467, 0.84);\r\n\r\n /**\r\n * Color of the handle when idle\r\n */\r\n public baseColor: Color3 = new Color3(1, 1, 1);\r\n\r\n /**\r\n * Scale of the handle when hovered\r\n */\r\n public hoverScale: number = 0.75;\r\n\r\n /**\r\n * Scale of the handle when idle\r\n */\r\n public baseScale: number = 0.35;\r\n\r\n /**\r\n * Scale of the handle when dragged\r\n */\r\n public dragScale: number = 0.55;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionOffset: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Creates a handle material\r\n * @param name Name of the material\r\n * @param scene Scene\r\n */\r\n constructor(name: string, scene: Scene) {\r\n const shaderLanguage = scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL;\r\n\r\n super(name, scene, \"handle\", {\r\n attributes: [\"position\"],\r\n uniforms: [\"worldViewProjection\", \"color\", \"scale\", \"positionOffset\"],\r\n needAlphaBlending: false,\r\n needAlphaTesting: false,\r\n shaderLanguage,\r\n extraInitializationsAsync:\r\n shaderLanguage === ShaderLanguage.WGSL\r\n ? async () => {\r\n await Promise.all([import(\"./wgsl/handle.vertex\"), import(\"./wgsl/handle.fragment\")]);\r\n }\r\n : undefined,\r\n });\r\n\r\n this._updateInterpolationTarget();\r\n\r\n // Register callback for scene after render\r\n this._lastTick = Date.now();\r\n this._onBeforeRender = this.getScene().onBeforeRenderObservable.add(() => {\r\n const tick = Date.now();\r\n const delta = tick - this._lastTick;\r\n\r\n const scaleDiff = this._targetScale - this._scale;\r\n const colorDiff = TmpColors.Color3[0].copyFrom(this._targetColor).subtractToRef(this._color, TmpColors.Color3[0]);\r\n\r\n this._scale = this._scale + (scaleDiff * delta) / this.animationLength;\r\n colorDiff.scaleToRef(delta / this.animationLength, colorDiff);\r\n this._color.addToRef(colorDiff, this._color);\r\n\r\n this.setColor3(\"color\", this._color);\r\n this.setFloat(\"scale\", this._scale);\r\n this.setVector3(\"positionOffset\", this._positionOffset);\r\n\r\n this._lastTick = tick;\r\n });\r\n }\r\n\r\n private _updateInterpolationTarget() {\r\n if (this.drag) {\r\n this._targetColor = this.hoverColor;\r\n this._targetScale = this.dragScale;\r\n } else if (this.hover) {\r\n this._targetColor = this.hoverColor;\r\n this._targetScale = this.hoverScale;\r\n } else {\r\n this._targetColor = this.baseColor;\r\n this._targetScale = this.baseScale;\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the handle material\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/handle/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,uBAAuB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./handleMaterial.pure\";\n"]}
|
|
@@ -1,87 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { type Nullable } from "@babylonjs/core/types.js";
|
|
7
|
-
import { type Scene } from "@babylonjs/core/scene.js";
|
|
8
|
-
import { type SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
|
9
|
-
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
|
10
|
-
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./mrdlBackglowMaterial.pure" for tree-shakeable, side-effect-free usage.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./mrdlBackglowMaterial.pure.js";
|
|
11
6
|
import "./shaders/mrdlBackglow.fragment.js";
|
|
12
7
|
import "./shaders/mrdlBackglow.vertex.js";
|
|
13
|
-
export declare class MRDLBackglowMaterial extends PushMaterial {
|
|
14
|
-
/**
|
|
15
|
-
* Gets or sets the bevel radius on the backglow. If this value is changed, update the lineWidth to match.
|
|
16
|
-
*/
|
|
17
|
-
bevelRadius: number;
|
|
18
|
-
/**
|
|
19
|
-
* Gets or sets the line width of the backglow.
|
|
20
|
-
*/
|
|
21
|
-
lineWidth: number;
|
|
22
|
-
/**
|
|
23
|
-
* Gets or sets whether to use absolute sizes when calculating effects on the backglow.
|
|
24
|
-
* Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.
|
|
25
|
-
*/
|
|
26
|
-
absoluteSizes: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Gets or sets the tuning motion of the backglow.
|
|
29
|
-
*/
|
|
30
|
-
tuningMotion: number;
|
|
31
|
-
/**
|
|
32
|
-
* Gets or sets the motion of the backglow.
|
|
33
|
-
*/
|
|
34
|
-
motion: number;
|
|
35
|
-
/**
|
|
36
|
-
* Gets or sets the maximum intensity of the backglow.
|
|
37
|
-
*/
|
|
38
|
-
maxIntensity: number;
|
|
39
|
-
/**
|
|
40
|
-
* Gets or sets the fade-in exponent of the intensity of the backglow.
|
|
41
|
-
*/
|
|
42
|
-
intensityFadeInExponent: number;
|
|
43
|
-
/**
|
|
44
|
-
* Gets or sets the start of the outer fuzz effect on the backglow.
|
|
45
|
-
*/
|
|
46
|
-
outerFuzzStart: number;
|
|
47
|
-
/**
|
|
48
|
-
* Gets or sets the end of the outer fuzz effect on the backglow.
|
|
49
|
-
*/
|
|
50
|
-
outerFuzzEnd: number;
|
|
51
|
-
/**
|
|
52
|
-
* Gets or sets the color of the backglow.
|
|
53
|
-
*/
|
|
54
|
-
color: Color4;
|
|
55
|
-
/**
|
|
56
|
-
* Gets or sets the inner color of the backglow.
|
|
57
|
-
*/
|
|
58
|
-
innerColor: Color4;
|
|
59
|
-
/**
|
|
60
|
-
* Gets or sets the blend exponent of the backglow.
|
|
61
|
-
*/
|
|
62
|
-
blendExponent: number;
|
|
63
|
-
/**
|
|
64
|
-
* Gets or sets the falloff of the backglow.
|
|
65
|
-
*/
|
|
66
|
-
falloff: number;
|
|
67
|
-
/**
|
|
68
|
-
* Gets or sets the bias of the backglow.
|
|
69
|
-
*/
|
|
70
|
-
bias: number;
|
|
71
|
-
constructor(name: string, scene: Scene);
|
|
72
|
-
needAlphaBlending(): boolean;
|
|
73
|
-
needAlphaTesting(): boolean;
|
|
74
|
-
getAlphaTestTexture(): Nullable<BaseTexture>;
|
|
75
|
-
isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean;
|
|
76
|
-
bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
|
|
77
|
-
/**
|
|
78
|
-
* Get the list of animatables in the material.
|
|
79
|
-
* @returns the list of animatables object used in the material
|
|
80
|
-
*/
|
|
81
|
-
getAnimatables(): IAnimatable[];
|
|
82
|
-
dispose(forceDisposeEffect?: boolean): void;
|
|
83
|
-
clone(name: string): MRDLBackglowMaterial;
|
|
84
|
-
serialize(): unknown;
|
|
85
|
-
getClassName(): string;
|
|
86
|
-
static Parse(source: any, scene: Scene, rootUrl: string): MRDLBackglowMaterial;
|
|
87
|
-
}
|