vgpu-render 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +605 -2
- package/dist/assets/fira-mono-medium-subset.d.ts +4 -0
- package/dist/assets/fira-mono-medium-subset.js +889 -0
- package/dist/assets/fira-mono-msdf-atlas.d.ts +13 -0
- package/dist/assets/fira-mono-msdf-atlas.js +6222 -0
- package/dist/camera-2d.d.ts +43 -0
- package/dist/camera-2d.js +75 -0
- package/dist/color-space.d.ts +32 -0
- package/dist/color-space.js +45 -0
- package/dist/curve.d.ts +16 -0
- package/dist/curve.js +46 -0
- package/dist/debug-draw-3d.d.ts +14 -0
- package/dist/debug-draw-3d.js +36 -0
- package/dist/frame-draw-list-2d.d.ts +177 -0
- package/dist/frame-draw-list-2d.js +378 -0
- package/dist/frame-draw-list.d.ts +413 -0
- package/dist/frame-draw-list.js +556 -0
- package/dist/geometry-generators.d.ts +101 -0
- package/dist/geometry-generators.js +481 -0
- package/dist/gpu-debug-draw-2d.d.ts +48 -0
- package/dist/gpu-debug-draw-2d.js +450 -0
- package/dist/gpu-debug-draw-3d.d.ts +52 -0
- package/dist/gpu-debug-draw-3d.js +892 -0
- package/dist/gpu-instancing.d.ts +34 -0
- package/dist/gpu-instancing.js +93 -0
- package/dist/gpu-text-3d.d.ts +98 -0
- package/dist/gpu-text-3d.js +514 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +20 -0
- package/dist/infinite-grid-2d.d.ts +73 -0
- package/dist/infinite-grid-2d.js +253 -0
- package/dist/infinite-grid-3d.d.ts +134 -0
- package/dist/infinite-grid-3d.js +407 -0
- package/dist/mesh-batch-3d.d.ts +10 -0
- package/dist/mesh-batch-3d.js +67 -0
- package/dist/shape2d-shader.d.ts +14 -0
- package/dist/shape2d-shader.js +288 -0
- package/dist/text-atlas.d.ts +176 -0
- package/dist/text-atlas.js +498 -0
- package/dist/text-font.d.ts +190 -0
- package/dist/text-font.js +261 -0
- package/dist/text-layout.d.ts +175 -0
- package/dist/text-layout.js +390 -0
- package/dist/text-msdf-baked.d.ts +41 -0
- package/dist/text-msdf-baked.js +117 -0
- package/dist/text-msdf-font.d.ts +85 -0
- package/dist/text-msdf-font.js +159 -0
- package/dist/text-msdf.d.ts +70 -0
- package/dist/text-msdf.js +242 -0
- package/dist/text-raster.d.ts +40 -0
- package/dist/text-raster.js +60 -0
- package/dist/text-sdf.d.ts +28 -0
- package/dist/text-sdf.js +119 -0
- package/dist/vector-math.d.ts +19 -0
- package/dist/vector-math.js +37 -0
- package/package.json +80 -4
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { type Curve3D, type CurveTransform } from "./curve.js";
|
|
2
|
+
import { FrameDrawList2D, type FrameCommand2D } from "./frame-draw-list-2d.js";
|
|
3
|
+
import { type TextAnchor, type TextFontStyle, type TextFontWidth, type TextJustify, type TextLineBreak } from "./text-layout.js";
|
|
4
|
+
export type Vec3 = readonly [number, number, number];
|
|
5
|
+
export type Color = readonly [number, number, number, number];
|
|
6
|
+
export type LayerMask = number;
|
|
7
|
+
export type PointOptions = {
|
|
8
|
+
color?: Color;
|
|
9
|
+
size?: number;
|
|
10
|
+
sizeMode?: "screen" | "world";
|
|
11
|
+
round?: boolean;
|
|
12
|
+
layer?: LayerMask;
|
|
13
|
+
};
|
|
14
|
+
export type LineJoint = "none" | "round" | "bevel" | "miter";
|
|
15
|
+
/** Joint kinds the reference renders as geometry (`_is_rendered_line_joint`). */
|
|
16
|
+
export type RenderedJoint = Exclude<LineJoint, "none">;
|
|
17
|
+
export type LineOptions = {
|
|
18
|
+
color?: Color;
|
|
19
|
+
colorEnd?: Color;
|
|
20
|
+
width?: number;
|
|
21
|
+
widthMode?: "screen" | "world";
|
|
22
|
+
dash?: readonly [number, number, number];
|
|
23
|
+
normal?: Vec3;
|
|
24
|
+
/**
|
|
25
|
+
* Per-vertex normals for path primitives (reference `*_n` variants). Every segment uses
|
|
26
|
+
* the normal of its **start** vertex, matching `_emit_normal_line_strip` /
|
|
27
|
+
* `_emit_normal_line_loop`, and the joints between them interpolate the two normals. A
|
|
28
|
+
* closed path needs one entry per vertex, an open one per segment (as the reference
|
|
29
|
+
* accepts). Takes precedence over `normal` when both are given.
|
|
30
|
+
*/
|
|
31
|
+
normals?: readonly Vec3[];
|
|
32
|
+
joint?: LineJoint;
|
|
33
|
+
layer?: LayerMask;
|
|
34
|
+
};
|
|
35
|
+
export type PointCommand = {
|
|
36
|
+
readonly kind: "point";
|
|
37
|
+
readonly position: Vec3;
|
|
38
|
+
readonly color: Color;
|
|
39
|
+
readonly size: number;
|
|
40
|
+
readonly sizeMode: "screen" | "world";
|
|
41
|
+
readonly round?: boolean;
|
|
42
|
+
readonly layer: LayerMask;
|
|
43
|
+
};
|
|
44
|
+
export type LineCommand = {
|
|
45
|
+
readonly kind: "line";
|
|
46
|
+
readonly start: Vec3;
|
|
47
|
+
readonly end: Vec3;
|
|
48
|
+
readonly color: Color;
|
|
49
|
+
readonly colorEnd: Color;
|
|
50
|
+
readonly width: number;
|
|
51
|
+
readonly widthMode: "screen" | "world";
|
|
52
|
+
readonly dash?: readonly [number, number, number];
|
|
53
|
+
readonly normal?: Vec3;
|
|
54
|
+
readonly joint?: LineJoint;
|
|
55
|
+
readonly layer: LayerMask;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* One path vertex of a `lineStrip`/`lineLoop` that the reference turns into a joint
|
|
59
|
+
* instance (`_emit_joint`). The renderer rebuilds the round/bevel/miter wedge on the GPU
|
|
60
|
+
* from `previous`, `center`, and `next`, so no CPU-side expansion happens here.
|
|
61
|
+
*/
|
|
62
|
+
export type JointCommand = {
|
|
63
|
+
readonly kind: "joint";
|
|
64
|
+
readonly previous: Vec3;
|
|
65
|
+
readonly center: Vec3;
|
|
66
|
+
readonly next: Vec3;
|
|
67
|
+
readonly color: Color;
|
|
68
|
+
readonly width: number;
|
|
69
|
+
readonly widthMode: "screen" | "world";
|
|
70
|
+
/**
|
|
71
|
+
* Same `[visible, space, offset]` shape as `LineCommand.dash`, with the accumulated
|
|
72
|
+
* path distance of this vertex already folded into `offset` so the wedge keeps the
|
|
73
|
+
* dash phase of the segments that meet it.
|
|
74
|
+
*/
|
|
75
|
+
readonly dash?: readonly [number, number, number];
|
|
76
|
+
/**
|
|
77
|
+
* Normal of the previous path vertex and of this one, mirroring
|
|
78
|
+
* `_emit_normal_joint(previous, center, next, previous_normal, next_normal, ...)`.
|
|
79
|
+
* The wedge interpolates between them so a normal-aware joint keeps the shading of the
|
|
80
|
+
* segments it joins. Both are absent for plain joints.
|
|
81
|
+
*/
|
|
82
|
+
readonly previousNormal?: Vec3;
|
|
83
|
+
readonly nextNormal?: Vec3;
|
|
84
|
+
readonly joint: RenderedJoint;
|
|
85
|
+
readonly layer: LayerMask;
|
|
86
|
+
};
|
|
87
|
+
export type ArrowOptions = LineOptions & {
|
|
88
|
+
headLength?: number;
|
|
89
|
+
headAngle?: number;
|
|
90
|
+
};
|
|
91
|
+
export type FrameCommand = PointCommand | LineCommand | JointCommand | TriangleCommand | TextCommand | FrameCommand2D;
|
|
92
|
+
export type TriangleCommand = {
|
|
93
|
+
readonly kind: "triangle";
|
|
94
|
+
readonly a: Vec3;
|
|
95
|
+
readonly b: Vec3;
|
|
96
|
+
readonly c: Vec3;
|
|
97
|
+
readonly color: Color;
|
|
98
|
+
readonly layer: LayerMask;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Where a text block is placed, mirroring reference split between world-space `Text2d` and the
|
|
102
|
+
* screen-space UI `Text`:
|
|
103
|
+
*
|
|
104
|
+
* - `world-plane` puts the block on a fixed local XY plane at a world position, so it
|
|
105
|
+
* foreshortens with the camera like the reference `Label3D`.
|
|
106
|
+
* - `world-billboard` keeps that plane facing the camera at all times.
|
|
107
|
+
* - `screen` places the block at a **top-left origin pixel position** (`position.z` is
|
|
108
|
+
* ignored) at a fixed pixel size, independent of projection and depth.
|
|
109
|
+
*/
|
|
110
|
+
export type TextSpace = "world-plane" | "world-billboard" | "screen";
|
|
111
|
+
/** One section of a text block, the equivalent of a reference `TextSpan`. */
|
|
112
|
+
export type TextSpanOptions = {
|
|
113
|
+
readonly text: string;
|
|
114
|
+
readonly color?: Color;
|
|
115
|
+
readonly fontSize?: number;
|
|
116
|
+
readonly fontFamily?: string;
|
|
117
|
+
/** reference `TextFont::weight`, 1 to 1000. Defaults to the block's, then to 400. */
|
|
118
|
+
readonly weight?: number;
|
|
119
|
+
/** reference `TextFont::style`, minus `Oblique`: Canvas2D drops the slant angle. */
|
|
120
|
+
readonly style?: TextFontStyle;
|
|
121
|
+
/** reference `TextFont::width`, as a `font-stretch` keyword. Inert unless the face has a `wdth` axis. */
|
|
122
|
+
readonly width?: TextFontWidth;
|
|
123
|
+
};
|
|
124
|
+
export type TextOptions = {
|
|
125
|
+
color?: Color;
|
|
126
|
+
/**
|
|
127
|
+
* Outline width in font pixels, drawn around every glyph in the block. `0` (the default) draws no
|
|
128
|
+
* outline. Font pixels rather than screen pixels keeps the outline proportional to the glyphs:
|
|
129
|
+
* a block scaled up by `pixelSize` carries its outline with it, and a `screen` block's outline is
|
|
130
|
+
* in screen pixels, since there is nothing between those two units.
|
|
131
|
+
*/
|
|
132
|
+
outlineWidth?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Outline colour, its alpha giving how opaque the ring is. Defaults to the block's own colour,
|
|
135
|
+
* which widens the glyphs rather than ringing them; give it a contrasting colour to make a block
|
|
136
|
+
* readable against whatever it is drawn over.
|
|
137
|
+
*/
|
|
138
|
+
outlineColor?: Color;
|
|
139
|
+
/**
|
|
140
|
+
* Block font size in pixels. It is both the layout unit and the glyph atlas' rasterisation
|
|
141
|
+
* size, exactly as in the reference `Label3D.font_size`; the two world spaces scale it by
|
|
142
|
+
* `pixelSize`, and `screen` uses it directly.
|
|
143
|
+
*/
|
|
144
|
+
fontSize?: number;
|
|
145
|
+
/**
|
|
146
|
+
* World units per font pixel in the two world spaces, the reference `Label3D.pixel_size`.
|
|
147
|
+
* Ignored by `screen`, which is already in pixels. Raise `fontSize` and lower this together
|
|
148
|
+
* to keep a block's world size while gaining rasterisation detail.
|
|
149
|
+
*/
|
|
150
|
+
pixelSize?: number;
|
|
151
|
+
fontFamily?: string;
|
|
152
|
+
/**
|
|
153
|
+
* reference `TextFont::weight`, 1 to 1000, default `400`. A face that does not carry the weight is
|
|
154
|
+
* emboldened by the browser in one synthesised step, so the advance does not change.
|
|
155
|
+
*/
|
|
156
|
+
weight?: number;
|
|
157
|
+
/**
|
|
158
|
+
* reference `TextFont::style`. `italic` is the only slant Canvas2D honours: its shorthand drops the
|
|
159
|
+
* angle of `Oblique(a)`, so a synthesised slant is all an oblique could mean here.
|
|
160
|
+
*/
|
|
161
|
+
style?: TextFontStyle;
|
|
162
|
+
/**
|
|
163
|
+
* reference `TextFont::width`, spelled as a `font-stretch` keyword. Canvas2D keeps the keyword only when
|
|
164
|
+
* the face has a `wdth` axis; the bundled static subset has none, so every stop draws identically.
|
|
165
|
+
*/
|
|
166
|
+
width?: TextFontWidth;
|
|
167
|
+
/**
|
|
168
|
+
* Absolute line height in pixels, reference `LineHeight::Px`. Exclusive with `lineHeightScale`;
|
|
169
|
+
* omitting both leaves the line height at reference default, `RelativeToFont(1.2)`.
|
|
170
|
+
*/
|
|
171
|
+
lineHeight?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Line height as a multiple of the line's own largest span, reference `LineHeight::RelativeToFont`.
|
|
174
|
+
* Exclusive with `lineHeight`.
|
|
175
|
+
*/
|
|
176
|
+
lineHeightScale?: number;
|
|
177
|
+
letterSpacing?: number;
|
|
178
|
+
justify?: TextJustify;
|
|
179
|
+
lineBreak?: TextLineBreak;
|
|
180
|
+
/**
|
|
181
|
+
* `TextBounds`. Only `width` feeds layout: it is the wrap width. `height` is deliberately not a
|
|
182
|
+
* layout input, matching reference, whose `Text2d` never truncates against it — a block that runs
|
|
183
|
+
* past the height still draws every line.
|
|
184
|
+
*/
|
|
185
|
+
bounds?: readonly [number, number];
|
|
186
|
+
anchor?: TextAnchor;
|
|
187
|
+
space?: TextSpace;
|
|
188
|
+
/**
|
|
189
|
+
* Local rotation of a `world-plane` block, in radians, as reference `Label3D.rotation` Euler angles
|
|
190
|
+
* (applied Y, then X, then Z). The reference `Label3D` labels use `[-PI/2, 0, 0]` to lay the block
|
|
191
|
+
* flat on the XZ plane, readable from above; the two camera-relative spaces ignore it.
|
|
192
|
+
*/
|
|
193
|
+
rotation?: readonly [number, number, number];
|
|
194
|
+
/**
|
|
195
|
+
* Which registered glyph source draws this block: its encoding and raster scale. Blocks that name
|
|
196
|
+
* nothing use the first source, so a frame can mix a sharp pass and a cheap pass.
|
|
197
|
+
*/
|
|
198
|
+
source?: string;
|
|
199
|
+
/** Whether geometry in front of the block occludes it. Defaults to `true`, like reference `Text2d`. */
|
|
200
|
+
depthTest?: boolean;
|
|
201
|
+
layer?: LayerMask;
|
|
202
|
+
};
|
|
203
|
+
/** A span after the block defaults have been folded in, so the renderer never re-resolves them. */
|
|
204
|
+
export type ResolvedTextSpan = {
|
|
205
|
+
readonly text: string;
|
|
206
|
+
readonly color: Color;
|
|
207
|
+
readonly fontSize: number;
|
|
208
|
+
readonly fontFamily: string;
|
|
209
|
+
readonly weight: number;
|
|
210
|
+
readonly style: TextFontStyle;
|
|
211
|
+
readonly width: TextFontWidth;
|
|
212
|
+
};
|
|
213
|
+
export type TextCommand = {
|
|
214
|
+
readonly kind: "text";
|
|
215
|
+
readonly position: Vec3;
|
|
216
|
+
readonly spans: readonly ResolvedTextSpan[];
|
|
217
|
+
readonly color: Color;
|
|
218
|
+
readonly outlineWidth: number;
|
|
219
|
+
readonly outlineColor: Color;
|
|
220
|
+
readonly fontSize: number;
|
|
221
|
+
readonly pixelSize: number;
|
|
222
|
+
readonly fontFamily: string;
|
|
223
|
+
readonly weight: number;
|
|
224
|
+
readonly style: TextFontStyle;
|
|
225
|
+
readonly width: TextFontWidth;
|
|
226
|
+
/**
|
|
227
|
+
* Resolved line height in pixels: the value a `LineHeight::Px` block asked for, or
|
|
228
|
+
* `1.2 × fontSize` for the default, which `lineHeightScale` then marks as resolved per line.
|
|
229
|
+
* Only block measurements read this; layout uses whichever of the two fields applies.
|
|
230
|
+
*/
|
|
231
|
+
readonly lineHeight: number;
|
|
232
|
+
/**
|
|
233
|
+
* `LineHeight::RelativeToFont` multiple, present only when the block left the line height at
|
|
234
|
+
* the default. Layout then resolves each line against that line's own largest span.
|
|
235
|
+
*/
|
|
236
|
+
readonly lineHeightScale?: number;
|
|
237
|
+
readonly letterSpacing: number;
|
|
238
|
+
readonly justify: TextJustify;
|
|
239
|
+
readonly lineBreak: TextLineBreak;
|
|
240
|
+
readonly bounds?: readonly [number, number];
|
|
241
|
+
readonly anchor: TextAnchor;
|
|
242
|
+
readonly space: TextSpace;
|
|
243
|
+
readonly rotation: readonly [number, number, number];
|
|
244
|
+
readonly source?: string;
|
|
245
|
+
readonly depthTest: boolean;
|
|
246
|
+
readonly layer: LayerMask;
|
|
247
|
+
};
|
|
248
|
+
export type MeshOptions = {
|
|
249
|
+
color?: Color;
|
|
250
|
+
solid?: boolean;
|
|
251
|
+
layer?: LayerMask;
|
|
252
|
+
};
|
|
253
|
+
export type CurveOptions = LineOptions & {
|
|
254
|
+
tolerance?: number;
|
|
255
|
+
transform?: CurveTransform;
|
|
256
|
+
};
|
|
257
|
+
export type GridOptions = LineOptions & {
|
|
258
|
+
rotation?: readonly [number, number, number];
|
|
259
|
+
skew?: readonly [number, number];
|
|
260
|
+
outer?: "none" | "x" | "z" | "xz";
|
|
261
|
+
};
|
|
262
|
+
export type PointDefaults = {
|
|
263
|
+
color?: Color;
|
|
264
|
+
size?: number;
|
|
265
|
+
sizeMode?: "screen" | "world";
|
|
266
|
+
layer?: LayerMask;
|
|
267
|
+
};
|
|
268
|
+
export type LineDefaults = {
|
|
269
|
+
color?: Color;
|
|
270
|
+
colorEnd?: Color;
|
|
271
|
+
width?: number;
|
|
272
|
+
widthMode?: "screen" | "world";
|
|
273
|
+
dash?: readonly [number, number, number];
|
|
274
|
+
normal?: Vec3;
|
|
275
|
+
joint?: LineJoint;
|
|
276
|
+
layer?: LayerMask;
|
|
277
|
+
};
|
|
278
|
+
export type TextDefaults = {
|
|
279
|
+
color?: Color;
|
|
280
|
+
outlineWidth?: number;
|
|
281
|
+
outlineColor?: Color;
|
|
282
|
+
fontSize?: number;
|
|
283
|
+
pixelSize?: number;
|
|
284
|
+
fontFamily?: string;
|
|
285
|
+
/** Default reference `TextFont::weight`, 1 to 1000. */
|
|
286
|
+
weight?: number;
|
|
287
|
+
/** Default reference `TextFont::style`. */
|
|
288
|
+
style?: TextFontStyle;
|
|
289
|
+
/** Default reference `TextFont::width`, as a `font-stretch` keyword. */
|
|
290
|
+
width?: TextFontWidth;
|
|
291
|
+
/**
|
|
292
|
+
* Absolute line height in pixels, reference `LineHeight::Px`. Omitted means reference default,
|
|
293
|
+
* `RelativeToFont(1.2)`: every line is 1.2 times its own largest span, so a line holding a
|
|
294
|
+
* larger span gets a taller box.
|
|
295
|
+
*/
|
|
296
|
+
lineHeight?: number;
|
|
297
|
+
/** Line height as a multiple of the line's largest span, reference `LineHeight::RelativeToFont`. */
|
|
298
|
+
lineHeightScale?: number;
|
|
299
|
+
letterSpacing?: number;
|
|
300
|
+
justify?: TextJustify;
|
|
301
|
+
lineBreak?: TextLineBreak;
|
|
302
|
+
anchor?: TextAnchor;
|
|
303
|
+
space?: TextSpace;
|
|
304
|
+
rotation?: readonly [number, number, number];
|
|
305
|
+
source?: string;
|
|
306
|
+
depthTest?: boolean;
|
|
307
|
+
layer?: LayerMask;
|
|
308
|
+
};
|
|
309
|
+
export type FrameDrawListDefaults = {
|
|
310
|
+
point?: PointDefaults;
|
|
311
|
+
line?: LineDefaults;
|
|
312
|
+
text?: TextDefaults;
|
|
313
|
+
};
|
|
314
|
+
export declare const DEFAULT_COLOR: Color;
|
|
315
|
+
export declare const DEFAULT_LAYER = 1;
|
|
316
|
+
/** Default block font size in pixels; the world spaces scale it by `DEFAULT_TEXT_PIXEL_SIZE`. */
|
|
317
|
+
export declare const DEFAULT_TEXT_SIZE = 16;
|
|
318
|
+
/** Default world units per font pixel, i.e. a 0.32 world-unit glyph at the default size. */
|
|
319
|
+
export declare const DEFAULT_TEXT_PIXEL_SIZE = 0.02;
|
|
320
|
+
/** `world-plane` blocks face +Z until a rotation lays them down, like a reference `Label3D`. */
|
|
321
|
+
export declare const DEFAULT_TEXT_ROTATION: readonly [number, number, number];
|
|
322
|
+
/** reference `LineHeight` default is `RelativeToFont(1.2)`. */
|
|
323
|
+
export declare const DEFAULT_LINE_HEIGHT_RATIO = 1.2;
|
|
324
|
+
export type ResolvedPointDefaults = {
|
|
325
|
+
color: Color | undefined;
|
|
326
|
+
size: number | undefined;
|
|
327
|
+
sizeMode: "screen" | "world" | undefined;
|
|
328
|
+
layer: LayerMask | undefined;
|
|
329
|
+
};
|
|
330
|
+
export type ResolvedLineDefaults = {
|
|
331
|
+
color: Color | undefined;
|
|
332
|
+
colorEnd: Color | undefined;
|
|
333
|
+
width: number | undefined;
|
|
334
|
+
widthMode: "screen" | "world" | undefined;
|
|
335
|
+
dash: readonly [number, number, number] | undefined;
|
|
336
|
+
normal: Vec3 | undefined;
|
|
337
|
+
joint: LineJoint | undefined;
|
|
338
|
+
layer: LayerMask | undefined;
|
|
339
|
+
};
|
|
340
|
+
export type ResolvedTextDefaults = {
|
|
341
|
+
color: Color | undefined;
|
|
342
|
+
outlineWidth: number | undefined;
|
|
343
|
+
outlineColor: Color | undefined;
|
|
344
|
+
fontSize: number | undefined;
|
|
345
|
+
pixelSize: number | undefined;
|
|
346
|
+
fontFamily: string | undefined;
|
|
347
|
+
weight: number | undefined;
|
|
348
|
+
style: TextFontStyle | undefined;
|
|
349
|
+
width: TextFontWidth | undefined;
|
|
350
|
+
lineHeight: number | undefined;
|
|
351
|
+
lineHeightScale: number | undefined;
|
|
352
|
+
letterSpacing: number | undefined;
|
|
353
|
+
justify: TextJustify | undefined;
|
|
354
|
+
lineBreak: TextLineBreak | undefined;
|
|
355
|
+
anchor: TextAnchor | undefined;
|
|
356
|
+
space: TextSpace | undefined;
|
|
357
|
+
rotation: readonly [number, number, number] | undefined;
|
|
358
|
+
source: string | undefined;
|
|
359
|
+
depthTest: boolean | undefined;
|
|
360
|
+
layer: LayerMask | undefined;
|
|
361
|
+
};
|
|
362
|
+
export type ResolvedFrameDrawListDefaults = {
|
|
363
|
+
point: ResolvedPointDefaults;
|
|
364
|
+
line: ResolvedLineDefaults;
|
|
365
|
+
text: ResolvedTextDefaults;
|
|
366
|
+
};
|
|
367
|
+
/** Validates and resolves style defaults so invalid values fail at construction time. */
|
|
368
|
+
export declare function resolveFrameDrawListDefaults(defaults?: FrameDrawListDefaults): ResolvedFrameDrawListDefaults;
|
|
369
|
+
/**
|
|
370
|
+
* One frame's draw list: records primitives, then hands them to `GpuDebugDraw3D` as
|
|
371
|
+
* `FrameCommand[]`. This is the `ImDrawList` / `GizmoBuffer` layer; GPU command encoding
|
|
372
|
+
* happens later in the renderer.
|
|
373
|
+
*/
|
|
374
|
+
export declare class FrameDrawList {
|
|
375
|
+
#private;
|
|
376
|
+
constructor(defaults?: FrameDrawListDefaults);
|
|
377
|
+
/**
|
|
378
|
+
* The 2D layer: `Vec2` primitives on the reference-style `Camera2d` spaces described in
|
|
379
|
+
* `camera-2d.ts`. Drawing here records into the same frame and layer mask as the 3D methods.
|
|
380
|
+
*/
|
|
381
|
+
get d2(): FrameDrawList2D;
|
|
382
|
+
point(position: Vec3, options?: PointOptions): this;
|
|
383
|
+
line(start: Vec3, end: Vec3, options?: LineOptions): this;
|
|
384
|
+
ray(origin: Vec3, direction: Vec3, options?: LineOptions): this;
|
|
385
|
+
arrow(origin: Vec3, direction: Vec3, options?: ArrowOptions): this;
|
|
386
|
+
axes(origin: Vec3, length?: number, width?: number): this;
|
|
387
|
+
lineStrip(points: readonly Vec3[], options?: LineOptions, closed?: boolean): this;
|
|
388
|
+
polyline(points: readonly Vec3[], options?: LineOptions, closed?: boolean): this;
|
|
389
|
+
triangle(a: Vec3, b: Vec3, c: Vec3, options?: {
|
|
390
|
+
color?: Color;
|
|
391
|
+
layer?: LayerMask;
|
|
392
|
+
}): this;
|
|
393
|
+
mesh(mesh: {
|
|
394
|
+
readonly triangles: readonly (readonly [Vec3, Vec3, Vec3])[];
|
|
395
|
+
readonly segments: readonly (readonly [Vec3, Vec3])[];
|
|
396
|
+
}, options?: MeshOptions): this;
|
|
397
|
+
curve(curve: Curve3D, options?: CurveOptions): this;
|
|
398
|
+
grid(center: Vec3, cells: readonly [number, number], spacing: readonly [number, number], options?: GridOptions): this;
|
|
399
|
+
/**
|
|
400
|
+
* Records one text block. `text` is either the block's string or a list of spans, mirroring
|
|
401
|
+
* reference `Text2d`/`Text` root plus its child `TextSpan`s; a span's own style overrides the
|
|
402
|
+
* block default. Layout happens at draw time, because only the renderer knows where the
|
|
403
|
+
* glyph atlas placed each character.
|
|
404
|
+
*/
|
|
405
|
+
text(position: Vec3, text: string | readonly TextSpanOptions[], options?: TextOptions): this;
|
|
406
|
+
get points(): readonly PointCommand[];
|
|
407
|
+
get lines(): readonly LineCommand[];
|
|
408
|
+
get joints(): readonly JointCommand[];
|
|
409
|
+
get texts(): readonly TextCommand[];
|
|
410
|
+
commands(visibleLayers?: LayerMask): readonly FrameCommand[];
|
|
411
|
+
seal(): void;
|
|
412
|
+
private assertOpen;
|
|
413
|
+
}
|