laymur 0.2.15 → 0.2.17
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.
|
@@ -62,6 +62,11 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
62
62
|
* @returns The foreground texture
|
|
63
63
|
*/
|
|
64
64
|
get foregroundTexture(): Texture;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the color tint.
|
|
67
|
+
* @returns The color as a hex number (e.g., 0xFFFFFF)
|
|
68
|
+
*/
|
|
69
|
+
get color(): number;
|
|
65
70
|
/**
|
|
66
71
|
* Gets the background color tint.
|
|
67
72
|
* @returns The background color as a hex number (e.g., 0xFFFFFF)
|
|
@@ -72,6 +77,11 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
72
77
|
* @returns The foreground color as a hex number (e.g., 0xFFFFFF)
|
|
73
78
|
*/
|
|
74
79
|
get foregroundColor(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the opacity.
|
|
82
|
+
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
83
|
+
*/
|
|
84
|
+
get opacity(): number;
|
|
75
85
|
/**
|
|
76
86
|
* Gets the background opacity.
|
|
77
87
|
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
@@ -117,6 +127,11 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
117
127
|
* @throws Will throw an error if the texture dimensions are not valid positive numbers
|
|
118
128
|
*/
|
|
119
129
|
set foregroundTexture(value: Texture);
|
|
130
|
+
/**
|
|
131
|
+
* Sets the color tint.
|
|
132
|
+
* @param value - The color as a hex number (e.g., 0xFFFFFF)
|
|
133
|
+
*/
|
|
134
|
+
set color(value: number);
|
|
120
135
|
/**
|
|
121
136
|
* Sets the background color tint.
|
|
122
137
|
* @param value - The background color as a hex number (e.g., 0xFFFFFF)
|
|
@@ -127,6 +142,11 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
127
142
|
* @param value - The foreground color as a hex number (e.g., 0xFFFFFF)
|
|
128
143
|
*/
|
|
129
144
|
set foregroundColor(value: number);
|
|
145
|
+
/**
|
|
146
|
+
* Sets the opacity.
|
|
147
|
+
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
148
|
+
*/
|
|
149
|
+
set opacity(value: number);
|
|
130
150
|
/**
|
|
131
151
|
* Sets the background opacity.
|
|
132
152
|
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
package/dist/index.js
CHANGED
|
@@ -4382,7 +4382,7 @@ var fragmentShader$1 = "uniform sampler2D map;\nuniform vec3 color;\nuniform flo
|
|
|
4382
4382
|
|
|
4383
4383
|
var vertexShader$1 = "varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
4384
4384
|
|
|
4385
|
-
const DEFAULT_ALPHA_TEST$1 = 0.
|
|
4385
|
+
const DEFAULT_ALPHA_TEST$1 = 0.25;
|
|
4386
4386
|
class UINineSliceMaterial extends ShaderMaterial {
|
|
4387
4387
|
constructor(texture) {
|
|
4388
4388
|
super({
|
|
@@ -4405,8 +4405,8 @@ class UINineSliceMaterial extends ShaderMaterial {
|
|
|
4405
4405
|
alphaTest: DEFAULT_ALPHA_TEST$1,
|
|
4406
4406
|
lights: false,
|
|
4407
4407
|
fog: false,
|
|
4408
|
-
depthWrite:
|
|
4409
|
-
depthTest:
|
|
4408
|
+
depthWrite: false,
|
|
4409
|
+
depthTest: false,
|
|
4410
4410
|
});
|
|
4411
4411
|
}
|
|
4412
4412
|
getSliceBorderLeft() {
|
|
@@ -4734,11 +4734,11 @@ class UINineSlice extends UIElement {
|
|
|
4734
4734
|
}
|
|
4735
4735
|
}
|
|
4736
4736
|
|
|
4737
|
-
var fragmentShader = "uniform sampler2D background;\nuniform sampler2D foreground;\nuniform float progress;\nuniform vec3 backgroundColor;\nuniform vec3 foregroundColor;\nuniform float backgroundOpacity;\nuniform float foregroundOpacity;\nuniform float alphaTest;\nuniform float angle;\nuniform float direction;\nvarying vec2 vUv;\n\nvoid main() {\n vec4 backgroundTexture = texture2D(background, vUv);\n vec4 foregroundTexture = texture2D(foreground, vUv);\n\n // Apply common color and opacity\n vec3 finalBackgroundColor = backgroundTexture.rgb * backgroundColor;\n vec3 finalForegroundColor = foregroundTexture.rgb * foregroundColor;\n float finalBackgroundOpacity = backgroundTexture.a * backgroundOpacity;\n float finalForegroundOpacity = foregroundTexture.a * foregroundOpacity;\n\n vec4 backgroundColor = vec4(finalBackgroundColor, finalBackgroundOpacity);\n vec4 foregroundColor = vec4(finalForegroundColor, finalForegroundOpacity);\n\n // Calculate progress threshold with angle and direction\n float adjustedX = mix(vUv.x, 1.0 - vUv.x, step(0.0, -direction));\n float tanAngle = tan(angle);\n float threshold = adjustedX - (vUv.y - 0.5) * tanAngle * sign(direction);\n float progressMask = step(threshold, progress);\n\n vec4 mixedColor =
|
|
4737
|
+
var fragmentShader = "uniform sampler2D background;\nuniform sampler2D foreground;\nuniform float progress;\nuniform vec3 color;\nuniform vec3 backgroundColor;\nuniform vec3 foregroundColor;\nuniform float opacity;\nuniform float backgroundOpacity;\nuniform float foregroundOpacity;\nuniform float alphaTest;\nuniform float angle;\nuniform float direction;\nvarying vec2 vUv;\n\nvoid main() {\n vec4 backgroundTexture = texture2D(background, vUv);\n vec4 foregroundTexture = texture2D(foreground, vUv);\n\n // Apply common color and opacity\n vec3 finalBackgroundColor = backgroundTexture.rgb * backgroundColor * color;\n vec3 finalForegroundColor = foregroundTexture.rgb * foregroundColor * color;\n float finalBackgroundOpacity = backgroundTexture.a * backgroundOpacity * opacity;\n float finalForegroundOpacity = foregroundTexture.a * foregroundOpacity * opacity;\n\n vec4 backgroundColor = vec4(finalBackgroundColor, finalBackgroundOpacity);\n vec4 foregroundColor = vec4(finalForegroundColor, finalForegroundOpacity);\n\n // Calculate progress threshold with angle and direction\n float adjustedX = mix(vUv.x, 1.0 - vUv.x, step(0.0, -direction));\n float tanAngle = tan(angle);\n float threshold = adjustedX - (vUv.y - 0.5) * tanAngle * sign(direction);\n float progressMask = step(threshold, progress);\n\n vec4 mixedColor = foregroundColor * progressMask\n + backgroundColor * (1.0 - foregroundColor.a * progressMask);\n\n if (mixedColor.a < alphaTest) {\n discard;\n }\n\n gl_FragColor = mixedColor;\n #include <colorspace_fragment>\n}\n";
|
|
4738
4738
|
|
|
4739
4739
|
var vertexShader = "varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
4740
4740
|
|
|
4741
|
-
const DEFAULT_ALPHA_TEST = 0.
|
|
4741
|
+
const DEFAULT_ALPHA_TEST = 0.25;
|
|
4742
4742
|
class UIProgressMaterial extends ShaderMaterial {
|
|
4743
4743
|
constructor(foregroundTexture, backgroundTexture) {
|
|
4744
4744
|
super({
|
|
@@ -4747,8 +4747,10 @@ class UIProgressMaterial extends ShaderMaterial {
|
|
|
4747
4747
|
background: { value: backgroundTexture },
|
|
4748
4748
|
foreground: { value: foregroundTexture },
|
|
4749
4749
|
progress: { value: 1 },
|
|
4750
|
+
color: { value: new Color(1, 1, 1) },
|
|
4750
4751
|
backgroundColor: { value: new Color(1, 1, 1) },
|
|
4751
4752
|
foregroundColor: { value: new Color(1, 1, 1) },
|
|
4753
|
+
opacity: { value: 1 },
|
|
4752
4754
|
backgroundOpacity: { value: 1 },
|
|
4753
4755
|
foregroundOpacity: { value: 1 },
|
|
4754
4756
|
alphaTest: { value: DEFAULT_ALPHA_TEST },
|
|
@@ -4758,7 +4760,8 @@ class UIProgressMaterial extends ShaderMaterial {
|
|
|
4758
4760
|
]),
|
|
4759
4761
|
vertexShader,
|
|
4760
4762
|
fragmentShader,
|
|
4761
|
-
transparent:
|
|
4763
|
+
transparent: false,
|
|
4764
|
+
alphaTest: DEFAULT_ALPHA_TEST,
|
|
4762
4765
|
lights: false,
|
|
4763
4766
|
fog: false,
|
|
4764
4767
|
depthWrite: false,
|
|
@@ -4774,12 +4777,18 @@ class UIProgressMaterial extends ShaderMaterial {
|
|
|
4774
4777
|
getForegroundTexture() {
|
|
4775
4778
|
return this.uniforms.foreground.value;
|
|
4776
4779
|
}
|
|
4780
|
+
getColor() {
|
|
4781
|
+
return this.uniforms.color.value.getHex();
|
|
4782
|
+
}
|
|
4777
4783
|
getBackgroundColor() {
|
|
4778
4784
|
return this.uniforms.backgroundColor.value.getHex();
|
|
4779
4785
|
}
|
|
4780
4786
|
getForegroundColor() {
|
|
4781
4787
|
return this.uniforms.foregroundColor.value.getHex();
|
|
4782
4788
|
}
|
|
4789
|
+
getOpacity() {
|
|
4790
|
+
return this.uniforms.opacity.value;
|
|
4791
|
+
}
|
|
4783
4792
|
getBackgroundOpacity() {
|
|
4784
4793
|
return this.uniforms.backgroundOpacity.value;
|
|
4785
4794
|
}
|
|
@@ -4807,6 +4816,10 @@ class UIProgressMaterial extends ShaderMaterial {
|
|
|
4807
4816
|
this.uniforms.foreground.value = value;
|
|
4808
4817
|
this.uniformsNeedUpdate = true;
|
|
4809
4818
|
}
|
|
4819
|
+
setColor(value) {
|
|
4820
|
+
this.uniforms.color.value.setHex(value);
|
|
4821
|
+
this.uniformsNeedUpdate = true;
|
|
4822
|
+
}
|
|
4810
4823
|
setBackgroundColor(value) {
|
|
4811
4824
|
this.uniforms.backgroundColor.value.setHex(value);
|
|
4812
4825
|
this.uniformsNeedUpdate = true;
|
|
@@ -4815,6 +4828,10 @@ class UIProgressMaterial extends ShaderMaterial {
|
|
|
4815
4828
|
this.uniforms.foregroundColor.value.setHex(value);
|
|
4816
4829
|
this.uniformsNeedUpdate = true;
|
|
4817
4830
|
}
|
|
4831
|
+
setOpacity(value) {
|
|
4832
|
+
this.uniforms.opacity.value = value;
|
|
4833
|
+
this.uniformsNeedUpdate = true;
|
|
4834
|
+
}
|
|
4818
4835
|
setBackgroundOpacity(value) {
|
|
4819
4836
|
this.uniforms.backgroundOpacity.value = value;
|
|
4820
4837
|
this.uniformsNeedUpdate = true;
|
|
@@ -4920,6 +4937,13 @@ class UIProgress extends UIElement {
|
|
|
4920
4937
|
get foregroundTexture() {
|
|
4921
4938
|
return this._private_material.getForegroundTexture();
|
|
4922
4939
|
}
|
|
4940
|
+
/**
|
|
4941
|
+
* Gets the color tint.
|
|
4942
|
+
* @returns The color as a hex number (e.g., 0xFFFFFF)
|
|
4943
|
+
*/
|
|
4944
|
+
get color() {
|
|
4945
|
+
return this._private_material.getColor();
|
|
4946
|
+
}
|
|
4923
4947
|
/**
|
|
4924
4948
|
* Gets the background color tint.
|
|
4925
4949
|
* @returns The background color as a hex number (e.g., 0xFFFFFF)
|
|
@@ -4934,6 +4958,13 @@ class UIProgress extends UIElement {
|
|
|
4934
4958
|
get foregroundColor() {
|
|
4935
4959
|
return this._private_material.getForegroundColor();
|
|
4936
4960
|
}
|
|
4961
|
+
/**
|
|
4962
|
+
* Gets the opacity.
|
|
4963
|
+
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
4964
|
+
*/
|
|
4965
|
+
get opacity() {
|
|
4966
|
+
return this._private_material.getOpacity();
|
|
4967
|
+
}
|
|
4937
4968
|
/**
|
|
4938
4969
|
* Gets the background opacity.
|
|
4939
4970
|
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
@@ -5007,6 +5038,13 @@ class UIProgress extends UIElement {
|
|
|
5007
5038
|
this.solverWrapper.suggestVariableValue(this.wVariable, width);
|
|
5008
5039
|
this.solverWrapper.suggestVariableValue(this.hVariable, height);
|
|
5009
5040
|
}
|
|
5041
|
+
/**
|
|
5042
|
+
* Sets the color tint.
|
|
5043
|
+
* @param value - The color as a hex number (e.g., 0xFFFFFF)
|
|
5044
|
+
*/
|
|
5045
|
+
set color(value) {
|
|
5046
|
+
this._private_material.setColor(value);
|
|
5047
|
+
}
|
|
5010
5048
|
/**
|
|
5011
5049
|
* Sets the background color tint.
|
|
5012
5050
|
* @param value - The background color as a hex number (e.g., 0xFFFFFF)
|
|
@@ -5021,6 +5059,13 @@ class UIProgress extends UIElement {
|
|
|
5021
5059
|
set foregroundColor(value) {
|
|
5022
5060
|
this._private_material.setForegroundColor(value);
|
|
5023
5061
|
}
|
|
5062
|
+
/**
|
|
5063
|
+
* Sets the opacity.
|
|
5064
|
+
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
5065
|
+
*/
|
|
5066
|
+
set opacity(value) {
|
|
5067
|
+
this._private_material.setOpacity(value);
|
|
5068
|
+
}
|
|
5024
5069
|
/**
|
|
5025
5070
|
* Sets the background opacity.
|
|
5026
5071
|
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|