laymur 0.2.17 → 0.3.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/README.md +31 -24
- package/dist/builders/UIConstraint2DBuilder.d.ts +1 -1
- package/dist/builders/UICoverConstraintBuilder.d.ts +3 -1
- package/dist/builders/UIFitConstraintBuilder.d.ts +3 -1
- package/dist/constraints/UIAspectConstraint.d.ts +0 -1
- package/dist/constraints/UIConstraint.d.ts +3 -0
- package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +0 -1
- package/dist/constraints/UIHorizontalProportionConstraint.d.ts +2 -3
- package/dist/constraints/UISingleParameterConstraint.d.ts +0 -2
- package/dist/constraints/UIVerticalDistanceConstraint.d.ts +0 -1
- package/dist/constraints/UIVerticalProportionConstraint.d.ts +2 -3
- package/dist/elements/UIDummy.d.ts +7 -1
- package/dist/elements/UIElement.d.ts +52 -38
- package/dist/elements/UIImage.d.ts +30 -42
- package/dist/elements/UINineSline.d.ts +61 -68
- package/dist/elements/UIProgress.d.ts +86 -110
- package/dist/elements/UIScene.d.ts +21 -30
- package/dist/elements/UIText.d.ts +27 -41
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1237 -942
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layers/UIFullscreenLayer.d.ts +0 -4
- package/dist/layers/UILayer.d.ts +50 -3
- package/dist/miscellaneous/UIColor.d.ts +171 -0
- package/dist/miscellaneous/UIInputEvent.d.ts +7 -0
- package/dist/miscellaneous/UIMicro.d.ts +3 -3
- package/dist/miscellaneous/{UIAnchorMode.d.ts → UIMicroAnchorMode.d.ts} +1 -1
- package/dist/miscellaneous/UINineSliceBorder.d.ts +6 -6
- package/dist/miscellaneous/UISceneWrapperClientAPI.d.ts +10 -0
- package/dist/miscellaneous/UITextPadding.d.ts +1 -1
- package/dist/miscellaneous/UITransparencyMode.d.ts +26 -0
- package/dist/miscellaneous/textTools.d.ts +4 -4
- package/dist/scalable/UIScalableMesh.d.ts +0 -16
- package/dist/scalable/UIScalablePlaneMesh.d.ts +0 -14
- package/dist/wrappers/UISceneWrapper.d.ts +17 -15
- package/dist/wrappers/UISolverWrapper.d.ts +185 -0
- package/package.json +1 -1
- package/dist/materials/UIMaterial.d.ts +0 -13
- package/dist/materials/UINineSliceMaterial.d.ts +0 -27
- package/dist/materials/UIProgressMaterial.d.ts +0 -29
- package/dist/miscellaneous/threeInstances.d.ts +0 -2
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import type { Texture } from "three";
|
|
2
|
-
import { Mesh } from "three";
|
|
1
|
+
import type { Texture, WebGLRenderer } from "three";
|
|
3
2
|
import { type UILayer } from "../layers/UILayer";
|
|
4
|
-
import {
|
|
3
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
|
+
import { type UINineSliceBorders } from "../miscellaneous/UINineSliceBorder";
|
|
5
5
|
import { UIElement } from "./UIElement";
|
|
6
6
|
/**
|
|
7
7
|
* Configuration options for creating a UINineSlice element.
|
|
8
8
|
*/
|
|
9
9
|
export interface UINineSliceOptions {
|
|
10
|
-
/** Nine-slice border configuration (can be number, object with horizontal/vertical, or full border object) */
|
|
11
|
-
sliceBorder: UINineSliceBorder;
|
|
12
10
|
/** X position of the element */
|
|
13
11
|
x: number;
|
|
14
12
|
/** Y position of the element */
|
|
15
13
|
y: number;
|
|
14
|
+
/** Color tint applied to the nine-slice element */
|
|
15
|
+
color: UIColor;
|
|
16
|
+
/** Nine-slice border configuration (can be number, object with horizontal/vertical, or full border object) */
|
|
17
|
+
sliceBorders: UINineSliceBorders;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Nine-slice UI element for scalable images with preserved border regions.
|
|
@@ -22,122 +24,113 @@ export interface UINineSliceOptions {
|
|
|
22
24
|
* scales in both dimensions. This technique is commonly used for creating scalable UI
|
|
23
25
|
* panels, buttons, and borders that maintain visual quality at any size.
|
|
24
26
|
*/
|
|
25
|
-
export declare class UINineSlice extends UIElement
|
|
26
|
-
|
|
27
|
+
export declare class UINineSlice extends UIElement {
|
|
28
|
+
/** Internal storage for the current texture */
|
|
27
29
|
private readonly textureInternal;
|
|
30
|
+
/** Internal storage for the color tint */
|
|
31
|
+
private readonly colorInternal;
|
|
32
|
+
/** Internal storage for the nine-slice border values (left, right, top, bottom) */
|
|
33
|
+
private readonly sliceBordersInternal;
|
|
34
|
+
/** Internal storage for texture and world dimensions (texture width, texture height, world width, world height) */
|
|
35
|
+
private readonly dimensions;
|
|
28
36
|
/**
|
|
29
37
|
* Creates a new nine-slice UI element.
|
|
30
38
|
*
|
|
39
|
+
* The element initially sizes itself to match the texture's dimensions.
|
|
40
|
+
* Border regions are defined by the slice borders configuration.
|
|
41
|
+
*
|
|
31
42
|
* @param layer - The UI layer to add this element to
|
|
32
43
|
* @param texture - The texture to use for nine-slice rendering
|
|
33
44
|
* @param options - Configuration options for the nine-slice element
|
|
45
|
+
* @throws Will throw an error if the texture dimensions are not valid positive numbers
|
|
34
46
|
*/
|
|
35
47
|
constructor(layer: UILayer, texture: Texture, options?: Partial<UINineSliceOptions>);
|
|
48
|
+
/**
|
|
49
|
+
* Gets the current texture being displayed.
|
|
50
|
+
* @returns The current Three.js texture
|
|
51
|
+
*/
|
|
52
|
+
get texture(): Texture;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the current color tint applied to the nine-slice element.
|
|
55
|
+
* @returns The UIColor instance
|
|
56
|
+
*/
|
|
57
|
+
get color(): UIColor;
|
|
36
58
|
/**
|
|
37
59
|
* Gets the left border size for nine-slice scaling.
|
|
38
|
-
* @returns The left border size
|
|
60
|
+
* @returns The left border size as a percentage (0-1) of texture width
|
|
39
61
|
*/
|
|
40
62
|
get sliceBorderLeft(): number;
|
|
41
63
|
/**
|
|
42
64
|
* Gets the right border size for nine-slice scaling.
|
|
43
|
-
* @returns The right border size
|
|
65
|
+
* @returns The right border size as a percentage (0-1) of texture width
|
|
44
66
|
*/
|
|
45
67
|
get sliceBorderRight(): number;
|
|
46
68
|
/**
|
|
47
69
|
* Gets the top border size for nine-slice scaling.
|
|
48
|
-
* @returns The top border size
|
|
70
|
+
* @returns The top border size as a percentage (0-1) of texture height
|
|
49
71
|
*/
|
|
50
72
|
get sliceBorderTop(): number;
|
|
51
73
|
/**
|
|
52
74
|
* Gets the bottom border size for nine-slice scaling.
|
|
53
|
-
* @returns The bottom border size
|
|
75
|
+
* @returns The bottom border size as a percentage (0-1) of texture height
|
|
54
76
|
*/
|
|
55
77
|
get sliceBorderBottom(): number;
|
|
56
78
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
* @
|
|
64
|
-
|
|
65
|
-
get color(): number;
|
|
66
|
-
/**
|
|
67
|
-
* Gets the current opacity level of the image.
|
|
68
|
-
* @returns The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
79
|
+
* Sets a new texture for the nine-slice element.
|
|
80
|
+
*
|
|
81
|
+
* When setting a new texture, the element will update its internal dimensions
|
|
82
|
+
* but maintain the current world size. The nine-slice borders remain unchanged.
|
|
83
|
+
*
|
|
84
|
+
* @param value - The new Three.js texture to display
|
|
85
|
+
* @throws Will throw an error if the texture dimensions are not valid positive numbers
|
|
86
|
+
* @see {@link assertValidPositiveNumber}
|
|
69
87
|
*/
|
|
70
|
-
|
|
88
|
+
set texture(value: Texture);
|
|
71
89
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
90
|
+
* Sets the color tint applied to the nine-slice element.
|
|
91
|
+
* @param value - The UIColor instance
|
|
74
92
|
*/
|
|
75
|
-
|
|
93
|
+
set color(value: UIColor);
|
|
76
94
|
/**
|
|
77
95
|
* Sets the left border size for nine-slice scaling.
|
|
78
|
-
* @param value - The left border size
|
|
96
|
+
* @param value - The left border size as a percentage (0-1) of texture width
|
|
79
97
|
*/
|
|
80
98
|
set sliceBorderLeft(value: number);
|
|
81
99
|
/**
|
|
82
100
|
* Sets the right border size for nine-slice scaling.
|
|
83
|
-
* @param value - The right border size
|
|
101
|
+
* @param value - The right border size as a percentage (0-1) of texture width
|
|
84
102
|
*/
|
|
85
103
|
set sliceBorderRight(value: number);
|
|
86
104
|
/**
|
|
87
105
|
* Sets the top border size for nine-slice scaling.
|
|
88
|
-
* @param value - The top border size
|
|
106
|
+
* @param value - The top border size as a percentage (0-1) of texture height
|
|
89
107
|
*/
|
|
90
108
|
set sliceBorderTop(value: number);
|
|
91
109
|
/**
|
|
92
110
|
* Sets the bottom border size for nine-slice scaling.
|
|
93
|
-
* @param value - The bottom border size
|
|
111
|
+
* @param value - The bottom border size as a percentage (0-1) of texture height
|
|
94
112
|
*/
|
|
95
113
|
set sliceBorderBottom(value: number);
|
|
96
|
-
/**
|
|
97
|
-
* Sets a new texture for the image.
|
|
98
|
-
*
|
|
99
|
-
* When setting a new texture, the image will automatically resize to match
|
|
100
|
-
* the new texture's dimensions.
|
|
101
|
-
*
|
|
102
|
-
* @param value - The new Three.js texture to display
|
|
103
|
-
* @throws Will throw an error if the texture dimensions are not valid positive numbers
|
|
104
|
-
* @see {@link assertValidPositiveNumber}
|
|
105
|
-
*/
|
|
106
|
-
set texture(value: Texture);
|
|
107
|
-
/**
|
|
108
|
-
* Sets the color tint applied to the image.
|
|
109
|
-
* @param value - The color value as a number (e.g., 0xFFFFFF for white)
|
|
110
|
-
*/
|
|
111
|
-
set color(value: number);
|
|
112
|
-
/**
|
|
113
|
-
* Sets the opacity level of the image.
|
|
114
|
-
* @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
115
|
-
*/
|
|
116
|
-
set opacity(value: number);
|
|
117
|
-
/**
|
|
118
|
-
* Sets whether transparency is enabled for the image.
|
|
119
|
-
* @param value - True to enable transparency, false to disable
|
|
120
|
-
*/
|
|
121
|
-
set transparency(value: boolean);
|
|
122
114
|
/**
|
|
123
115
|
* Sets all four border sizes for nine-slice scaling at once.
|
|
124
116
|
*
|
|
125
|
-
* @param left - The left border size
|
|
126
|
-
* @param right - The right border size
|
|
127
|
-
* @param top - The top border size
|
|
128
|
-
* @param bottom - The bottom border size
|
|
117
|
+
* @param left - The left border size as a percentage (0-1) of texture width
|
|
118
|
+
* @param right - The right border size as a percentage (0-1) of texture width
|
|
119
|
+
* @param top - The top border size as a percentage (0-1) of texture height
|
|
120
|
+
* @param bottom - The bottom border size as a percentage (0-1) of texture height
|
|
129
121
|
*/
|
|
130
122
|
setSliceBorders(left: number, right: number, top: number, bottom: number): void;
|
|
131
123
|
/**
|
|
132
|
-
* Destroys the nine-slice element
|
|
133
|
-
*
|
|
134
|
-
* This method removes event listeners, disposes of the material,
|
|
135
|
-
* and calls the parent destroy method.
|
|
124
|
+
* Destroys the nine-slice UI element by cleaning up color event listeners and all associated resources.
|
|
136
125
|
*/
|
|
137
126
|
destroy(): void;
|
|
138
127
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
128
|
+
* Called before each render frame to update the element's dimensions for nine-slice scaling.
|
|
129
|
+
* Updates the world dimensions (z, w components) based on current width, height, and micro scaling.
|
|
130
|
+
* @param renderer - The WebGL renderer
|
|
131
|
+
* @param deltaTime - Time since last frame in seconds
|
|
141
132
|
*/
|
|
142
|
-
|
|
133
|
+
protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
|
|
134
|
+
/** Event handler for when the color changes */
|
|
135
|
+
private readonly onColorChange;
|
|
143
136
|
}
|
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Mesh } from "three";
|
|
1
|
+
import { Texture } from "three";
|
|
3
2
|
import type { UILayer } from "../layers/UILayer";
|
|
3
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
4
|
import { UIElement } from "./UIElement";
|
|
5
|
+
/**
|
|
6
|
+
* Predefined mask functions that control how the progress bar fills.
|
|
7
|
+
* Each function defines a different fill pattern using GLSL shader code.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum UIProgressMaskFunction {
|
|
10
|
+
/** Fill horizontally from left to right (or right to left if inverse) */
|
|
11
|
+
HORIZONTAL = "float calculateMask() {\n return step((direction * io_UV.x + (1.0 - direction) * 0.5), progress);\n }",
|
|
12
|
+
/** Fill vertically from bottom to top (or top to bottom if inverse) */
|
|
13
|
+
VERTICAL = "float calculateMask() {\n return step((direction * io_UV.y + (1.0 - direction) * 0.5), progress);\n }",
|
|
14
|
+
/** Fill diagonally from bottom-left to top-right */
|
|
15
|
+
DIAGONAL = "float calculateMask() {\n float d = (io_UV.x + io_UV.y) * (0.1);\n return step((direction * d + (1.0 - direction) * 0.5), progress);\n }",
|
|
16
|
+
/** Fill in a circular pattern around the center */
|
|
17
|
+
CIRCLE = "float calculateMask() {\n vec2 p = io_UV - 0.5;\n float angle = atan(p.y, p.x);\n angle = (angle + 3.14159265) / 3.14159265;\n angle *= 0.5;\n return step((direction * angle + (1.0 - direction) * 0.5), progress);\n }"
|
|
18
|
+
}
|
|
5
19
|
/**
|
|
6
20
|
* Configuration options for creating a UIProgress element.
|
|
7
21
|
*/
|
|
8
22
|
export interface UIProgressOptions {
|
|
9
23
|
/** X position of the element */
|
|
10
|
-
x
|
|
24
|
+
x?: number;
|
|
11
25
|
/** Y position of the element */
|
|
12
|
-
y
|
|
13
|
-
/** Optional background texture (if not provided,
|
|
14
|
-
|
|
26
|
+
y?: number;
|
|
27
|
+
/** Optional background texture (if not provided, default texture is used) */
|
|
28
|
+
backgroundTexture?: Texture;
|
|
29
|
+
/** Overall color tint applied to the entire progress bar */
|
|
30
|
+
color?: UIColor;
|
|
31
|
+
/** Foreground color tint applied to the filled portion */
|
|
32
|
+
foregroundColor?: UIColor;
|
|
33
|
+
/** Background color tint applied to the unfilled portion */
|
|
34
|
+
backgroundColor?: UIColor;
|
|
35
|
+
/** Mask function that defines how the progress bar fills (predefined enum or custom GLSL code) */
|
|
36
|
+
maskFunction?: UIProgressMaskFunction | string;
|
|
15
37
|
/** Progress value between 0.0 (empty) and 1.0 (full) */
|
|
16
|
-
progress
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/** Angle of progress fill in degrees (0 = horizontal, 90 = vertical) */
|
|
20
|
-
angle: number;
|
|
21
|
-
/** Background color tint as hex number (e.g., 0xFFFFFF) */
|
|
22
|
-
backgroundColor: number;
|
|
23
|
-
/** Foreground color tint as hex number (e.g., 0xFFFFFF) */
|
|
24
|
-
foregroundColor: number;
|
|
25
|
-
/** Background opacity between 0.0 (transparent) and 1.0 (opaque) */
|
|
26
|
-
backgroundOpacity: number;
|
|
27
|
-
/** Foreground opacity between 0.0 (transparent) and 1.0 (opaque) */
|
|
28
|
-
foregroundOpacity: number;
|
|
38
|
+
progress?: number;
|
|
39
|
+
/** Whether to fill in reverse direction (true for reverse, false for normal) */
|
|
40
|
+
inverseDirection?: boolean;
|
|
29
41
|
}
|
|
30
42
|
/**
|
|
31
43
|
* Progress bar UI element with customizable fill direction and appearance.
|
|
@@ -37,86 +49,64 @@ export interface UIProgressOptions {
|
|
|
37
49
|
* The progress value ranges from 0.0 (empty) to 1.0 (completely filled).
|
|
38
50
|
* The fill direction can be controlled both by angle and forward/reverse direction.
|
|
39
51
|
*/
|
|
40
|
-
export declare class UIProgress extends UIElement
|
|
41
|
-
|
|
52
|
+
export declare class UIProgress extends UIElement {
|
|
53
|
+
/** Internal storage for the foreground texture */
|
|
54
|
+
private foregroundTextureInternal;
|
|
55
|
+
/** Internal storage for the optional background texture */
|
|
56
|
+
private backgroundTextureInternal?;
|
|
57
|
+
/** Internal storage for the overall color tint */
|
|
58
|
+
private readonly colorInternal;
|
|
59
|
+
/** Internal storage for the foreground color tint */
|
|
60
|
+
private readonly foregroundColorInternal;
|
|
61
|
+
/** Internal storage for the background color tint */
|
|
62
|
+
private readonly backgroundColorInternal;
|
|
63
|
+
/** Internal storage for the current progress value */
|
|
64
|
+
private progressInternal;
|
|
65
|
+
/** Internal storage for the fill direction flag */
|
|
66
|
+
private inverseDirectionInternal;
|
|
42
67
|
/**
|
|
43
68
|
* Creates a new progress bar UI element.
|
|
44
69
|
*
|
|
45
70
|
* @param layer - The UI layer to add this element to
|
|
46
|
-
* @param
|
|
71
|
+
* @param foregroundTexture - The texture used for the progress fill
|
|
47
72
|
* @param options - Configuration options for the progress bar
|
|
48
73
|
*/
|
|
49
|
-
constructor(layer: UILayer,
|
|
74
|
+
constructor(layer: UILayer, foregroundTexture: Texture, options?: Partial<UIProgressOptions>);
|
|
50
75
|
/**
|
|
51
|
-
* Gets the
|
|
52
|
-
* @returns
|
|
76
|
+
* Gets the foreground (fill) texture.
|
|
77
|
+
* @returns The foreground texture
|
|
53
78
|
*/
|
|
54
|
-
get
|
|
79
|
+
get foregroundTexture(): Texture;
|
|
55
80
|
/**
|
|
56
81
|
* Gets the background texture.
|
|
57
82
|
* @returns The background texture, or undefined if none is set
|
|
58
83
|
*/
|
|
59
84
|
get backgroundTexture(): Texture | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Gets the foreground (fill) texture.
|
|
62
|
-
* @returns The foreground texture
|
|
63
|
-
*/
|
|
64
|
-
get foregroundTexture(): Texture;
|
|
65
85
|
/**
|
|
66
86
|
* Gets the color tint.
|
|
67
|
-
* @returns The
|
|
87
|
+
* @returns The UIColor instance
|
|
68
88
|
*/
|
|
69
|
-
get color():
|
|
70
|
-
/**
|
|
71
|
-
* Gets the background color tint.
|
|
72
|
-
* @returns The background color as a hex number (e.g., 0xFFFFFF)
|
|
73
|
-
*/
|
|
74
|
-
get backgroundColor(): number;
|
|
89
|
+
get color(): UIColor;
|
|
75
90
|
/**
|
|
76
91
|
* Gets the foreground color tint.
|
|
77
|
-
* @returns The foreground color
|
|
78
|
-
*/
|
|
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;
|
|
85
|
-
/**
|
|
86
|
-
* Gets the background opacity.
|
|
87
|
-
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
92
|
+
* @returns The foreground color UIColor instance
|
|
88
93
|
*/
|
|
89
|
-
get
|
|
94
|
+
get foregroundColor(): UIColor;
|
|
90
95
|
/**
|
|
91
|
-
* Gets the
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
get foregroundOpacity(): number;
|
|
95
|
-
/**
|
|
96
|
-
* Gets whether transparency is enabled for the image.
|
|
97
|
-
* @returns True if transparency is enabled, false otherwise
|
|
98
|
-
*/
|
|
99
|
-
get transparency(): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Gets the progress fill angle in degrees.
|
|
102
|
-
* @returns Angle in degrees (0 = horizontal, 90 = vertical)
|
|
103
|
-
*/
|
|
104
|
-
get angle(): number;
|
|
105
|
-
/**
|
|
106
|
-
* Gets whether the progress fills in forward direction.
|
|
107
|
-
* @returns True if filling forward, false if filling in reverse
|
|
96
|
+
* Gets the background color tint.
|
|
97
|
+
* @returns The background color UIColor instance
|
|
108
98
|
*/
|
|
109
|
-
get
|
|
99
|
+
get backgroundColor(): UIColor;
|
|
110
100
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @
|
|
101
|
+
* Gets the current progress value.
|
|
102
|
+
* @returns Progress value between 0.0 (empty) and 1.0 (full)
|
|
113
103
|
*/
|
|
114
|
-
|
|
104
|
+
get progress(): number;
|
|
115
105
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
106
|
+
* Gets whether the progress fills in reverse direction.
|
|
107
|
+
* @returns True if filling in reverse, false if filling forward
|
|
118
108
|
*/
|
|
119
|
-
|
|
109
|
+
get inverseDirection(): boolean;
|
|
120
110
|
/**
|
|
121
111
|
* Sets the foreground (fill) texture.
|
|
122
112
|
*
|
|
@@ -128,54 +118,40 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
128
118
|
*/
|
|
129
119
|
set foregroundTexture(value: Texture);
|
|
130
120
|
/**
|
|
131
|
-
* Sets the
|
|
132
|
-
* @param value - The
|
|
121
|
+
* Sets the background texture.
|
|
122
|
+
* @param value - The background texture, or undefined to remove background
|
|
133
123
|
*/
|
|
134
|
-
set
|
|
124
|
+
set backgroundTexture(value: Texture | undefined);
|
|
135
125
|
/**
|
|
136
|
-
* Sets the
|
|
137
|
-
* @param value - The
|
|
126
|
+
* Sets the color tint.
|
|
127
|
+
* @param value - The UIColor instance
|
|
138
128
|
*/
|
|
139
|
-
set
|
|
129
|
+
set color(value: UIColor);
|
|
140
130
|
/**
|
|
141
131
|
* Sets the foreground color tint.
|
|
142
|
-
* @param value - The foreground color
|
|
143
|
-
*/
|
|
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);
|
|
150
|
-
/**
|
|
151
|
-
* Sets the background opacity.
|
|
152
|
-
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
153
|
-
*/
|
|
154
|
-
set backgroundOpacity(value: number);
|
|
155
|
-
/**
|
|
156
|
-
* Sets the foreground opacity.
|
|
157
|
-
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
132
|
+
* @param value - The foreground color UIColor instance
|
|
158
133
|
*/
|
|
159
|
-
set
|
|
134
|
+
set foregroundColor(value: UIColor);
|
|
160
135
|
/**
|
|
161
|
-
* Sets
|
|
162
|
-
* @param value -
|
|
163
|
-
*/
|
|
164
|
-
set transparency(value: boolean);
|
|
165
|
-
/**
|
|
166
|
-
* Sets the progress fill angle.
|
|
167
|
-
* @param value - Angle in degrees (0 = horizontal, 90 = vertical)
|
|
136
|
+
* Sets the background color tint.
|
|
137
|
+
* @param value - The background color UIColor instance
|
|
168
138
|
*/
|
|
169
|
-
set
|
|
139
|
+
set backgroundColor(value: UIColor);
|
|
170
140
|
/**
|
|
171
141
|
* Sets the progress fill direction.
|
|
172
|
-
* @param value - True for
|
|
142
|
+
* @param value - True for reverse direction, false for forward
|
|
173
143
|
*/
|
|
174
|
-
set
|
|
144
|
+
set inverseDirection(value: boolean);
|
|
175
145
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* This method disposes of the material and calls the parent destroy method.
|
|
146
|
+
* Sets the progress value.
|
|
147
|
+
* @param value - Progress value between 0.0 (empty) and 1.0 (full)
|
|
179
148
|
*/
|
|
149
|
+
set progress(value: number);
|
|
180
150
|
destroy(): void;
|
|
151
|
+
/** Event handler for when the overall color changes */
|
|
152
|
+
private readonly onColorChange;
|
|
153
|
+
/** Event handler for when the foreground color changes */
|
|
154
|
+
private readonly onForegroundColorChange;
|
|
155
|
+
/** Event handler for when the background color changes */
|
|
156
|
+
private readonly onBackgroundColorChange;
|
|
181
157
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Camera } from "three";
|
|
2
|
-
import {
|
|
1
|
+
import type { Camera, WebGLRenderer } from "three";
|
|
2
|
+
import { Scene } from "three";
|
|
3
3
|
import { type UILayer } from "../layers/UILayer";
|
|
4
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
5
|
import { UIElement } from "./UIElement";
|
|
5
6
|
/**
|
|
6
7
|
* Update modes for controlling when the 3D scene should be re-rendered.
|
|
@@ -27,6 +28,8 @@ export interface UISceneOptions {
|
|
|
27
28
|
width: number;
|
|
28
29
|
/** Height of the scene render target in pixels. */
|
|
29
30
|
height: number;
|
|
31
|
+
/** Color tint applied to the scene texture. */
|
|
32
|
+
color: UIColor;
|
|
30
33
|
/** Three.js scene to render. */
|
|
31
34
|
scene: Scene;
|
|
32
35
|
/** Camera to use for rendering the scene. */
|
|
@@ -56,11 +59,11 @@ export interface UISceneOptions {
|
|
|
56
59
|
* @see {@link Scene} - Three.js scene for 3D content
|
|
57
60
|
* @see {@link Camera} - Three.js camera for scene rendering
|
|
58
61
|
*/
|
|
59
|
-
export declare class UIScene extends UIElement
|
|
60
|
-
/** The material used for rendering the scene texture. */
|
|
61
|
-
private readonly material;
|
|
62
|
+
export declare class UIScene extends UIElement {
|
|
62
63
|
/** The WebGL render target for off-screen scene rendering. */
|
|
63
64
|
private readonly renderTarget;
|
|
65
|
+
/** Internal storage for the color tint. */
|
|
66
|
+
private readonly colorInternal;
|
|
64
67
|
/** Internal storage for the current Three.js scene. */
|
|
65
68
|
private sceneInternal;
|
|
66
69
|
/** Internal storage for the current camera. */
|
|
@@ -93,19 +96,9 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
93
96
|
constructor(layer: UILayer, options?: Partial<UISceneOptions>);
|
|
94
97
|
/**
|
|
95
98
|
* Gets the current color tint applied to the scene texture.
|
|
96
|
-
* @returns The
|
|
99
|
+
* @returns The UIColor instance
|
|
97
100
|
*/
|
|
98
|
-
get color():
|
|
99
|
-
/**
|
|
100
|
-
* Gets the current opacity level of the scene texture.
|
|
101
|
-
* @returns The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
102
|
-
*/
|
|
103
|
-
get opacity(): number;
|
|
104
|
-
/**
|
|
105
|
-
* Gets whether transparency is enabled for the scene texture.
|
|
106
|
-
* @returns True if transparency is enabled, false otherwise
|
|
107
|
-
*/
|
|
108
|
-
get transparency(): boolean;
|
|
101
|
+
get color(): UIColor;
|
|
109
102
|
/**
|
|
110
103
|
* Gets the Three.js scene being rendered.
|
|
111
104
|
* @returns The current Three.js scene
|
|
@@ -138,19 +131,9 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
138
131
|
get clearAlpha(): number;
|
|
139
132
|
/**
|
|
140
133
|
* Sets the color tint applied to the scene texture.
|
|
141
|
-
* @param value - The
|
|
142
|
-
*/
|
|
143
|
-
set color(value: number);
|
|
144
|
-
/**
|
|
145
|
-
* Sets the opacity level of the scene texture.
|
|
146
|
-
* @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
147
|
-
*/
|
|
148
|
-
set opacity(value: number);
|
|
149
|
-
/**
|
|
150
|
-
* Sets whether transparency is enabled for the scene texture.
|
|
151
|
-
* @param value - True to enable transparency, false to disable
|
|
134
|
+
* @param value - The UIColor instance
|
|
152
135
|
*/
|
|
153
|
-
set
|
|
136
|
+
set color(value: UIColor);
|
|
154
137
|
/**
|
|
155
138
|
* Sets a new Three.js scene to render and marks for re-render.
|
|
156
139
|
* @param value - The new Three.js scene
|
|
@@ -196,5 +179,13 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
196
179
|
* want to trigger a scene re-render without changing any properties.
|
|
197
180
|
*/
|
|
198
181
|
requestRender(): void;
|
|
199
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Called before each render frame to update the 3D scene rendering.
|
|
184
|
+
* Handles different update modes and renders the 3D scene to the render target
|
|
185
|
+
* based on the current update mode and property change state.
|
|
186
|
+
* @param renderer - The WebGL renderer used for scene rendering
|
|
187
|
+
*/
|
|
188
|
+
protected onWillRender(renderer: WebGLRenderer): void;
|
|
189
|
+
/** Event handler for when the color changes */
|
|
190
|
+
private readonly onColorChange;
|
|
200
191
|
}
|