@expofp/renderer 3.2.5 → 3.27.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 +111 -0
- package/dist/Renderer.d.ts +88 -0
- package/dist/Renderer.js +53 -0
- package/dist/controls/CameraControls.d.ts +102 -0
- package/dist/controls/CameraControls.js +239 -0
- package/dist/controls/camera-api.d.ts +206 -0
- package/dist/controls/camera-api.js +181 -0
- package/dist/controls/camera-move.d.ts +13 -0
- package/dist/controls/camera-move.js +18 -0
- package/dist/controls/camera-state.d.ts +40 -0
- package/dist/controls/camera-state.js +65 -0
- package/dist/controls/gestures.d.ts +70 -0
- package/dist/controls/gestures.js +84 -0
- package/dist/controls/handlers/Inertia.d.ts +111 -0
- package/dist/controls/handlers/Inertia.js +215 -0
- package/dist/controls/handlers/Pan.d.ts +23 -0
- package/dist/controls/handlers/Pan.js +32 -0
- package/dist/controls/handlers/Pitch.d.ts +94 -0
- package/dist/controls/handlers/Pitch.js +191 -0
- package/dist/controls/handlers/Roll.d.ts +103 -0
- package/dist/controls/handlers/Roll.js +182 -0
- package/dist/controls/handlers/Zoom.d.ts +15 -0
- package/dist/controls/handlers/Zoom.js +26 -0
- package/dist/controls/index.d.ts +56 -0
- package/dist/controls/index.js +58 -0
- package/dist/controls/zoom-to.d.ts +89 -0
- package/dist/controls/zoom-to.js +91 -0
- package/dist/core/InstanceUniforms.d.ts +93 -0
- package/dist/core/InstanceUniforms.js +266 -0
- package/dist/core/SquareDataTexture.d.ts +277 -0
- package/dist/core/SquareDataTexture.js +476 -0
- package/dist/core/batch/BatchedMesh.d.ts +74 -0
- package/dist/core/batch/BatchedMesh.js +149 -0
- package/dist/core/instanced/FrustumCulling.d.ts +141 -0
- package/dist/core/instanced/FrustumCulling.js +246 -0
- package/dist/core/instanced/InstancedMesh.d.ts +302 -0
- package/dist/core/instanced/InstancedMesh.js +497 -0
- package/dist/core/instanced/Instances.d.ts +119 -0
- package/dist/core/instanced/Instances.js +230 -0
- package/dist/core/instanced/Raycasting.d.ts +118 -0
- package/dist/core/instanced/Raycasting.js +134 -0
- package/dist/core/instanced/instanced-material.d.ts +77 -0
- package/dist/core/instanced/instanced-material.js +224 -0
- package/dist/core/lines/BatchedLines.d.ts +135 -0
- package/dist/core/lines/BatchedLines.js +213 -0
- package/dist/core/lines/FrustumCulling.d.ts +43 -0
- package/dist/core/lines/FrustumCulling.js +85 -0
- package/dist/core/lines/Raycasting.d.ts +44 -0
- package/dist/core/lines/Raycasting.js +91 -0
- package/dist/core/lines/lines-material.d.ts +47 -0
- package/dist/core/lines/lines-material.js +115 -0
- package/dist/core/shader-source.d.ts +50 -0
- package/dist/core/shader-source.js +84 -0
- package/dist/core/text/BatchedText.d.ts +227 -0
- package/dist/core/text/BatchedText.js +467 -0
- package/dist/core/text/MemberTexture.d.ts +90 -0
- package/dist/core/text/MemberTexture.js +194 -0
- package/dist/core/text/Text.d.ts +73 -0
- package/dist/core/text/Text.js +215 -0
- package/dist/core/text/batched-text-material.d.ts +56 -0
- package/dist/core/text/batched-text-material.js +121 -0
- package/dist/core/text/glyph-packing.d.ts +17 -0
- package/dist/core/text/glyph-packing.js +61 -0
- package/dist/core/typed-array.d.ts +16 -0
- package/dist/core/typed-array.js +20 -0
- package/dist/debug/components/DebugPanelProvider.d.ts +20 -0
- package/dist/debug/components/DebugPanelProvider.js +38 -0
- package/dist/debug/components/DebugTools.d.ts +22 -0
- package/dist/debug/components/DebugTools.js +28 -0
- package/dist/debug/components/Gui.d.ts +20 -0
- package/dist/debug/components/Gui.js +32 -0
- package/dist/debug/components/MemoryInfo.d.ts +22 -0
- package/dist/debug/components/MemoryInfo.js +42 -0
- package/dist/debug/components/Panel.d.ts +31 -0
- package/dist/debug/components/Panel.js +98 -0
- package/dist/debug/components/Stats.d.ts +9 -0
- package/dist/debug/components/Stats.js +24 -0
- package/dist/debug/debug-context.d.ts +41 -0
- package/dist/debug/debug-context.js +59 -0
- package/dist/debug/index.d.ts +51 -0
- package/dist/debug/index.js +64 -0
- package/dist/events/LayoutDriver.d.ts +31 -0
- package/dist/events/LayoutDriver.js +88 -0
- package/dist/events/PointerMissed.d.ts +23 -0
- package/dist/events/PointerMissed.js +58 -0
- package/dist/events/def-culling.d.ts +46 -0
- package/dist/events/def-culling.js +69 -0
- package/dist/events/layout-targets.d.ts +104 -0
- package/dist/events/layout-targets.js +245 -0
- package/dist/events/pointer.d.ts +118 -0
- package/dist/events/pointer.js +168 -0
- package/dist/external/ExternalCanvas.d.ts +56 -0
- package/dist/external/ExternalCanvas.js +178 -0
- package/dist/external/external-camera.d.ts +17 -0
- package/dist/external/external-camera.js +82 -0
- package/dist/external/external-events.d.ts +14 -0
- package/dist/external/external-events.js +33 -0
- package/dist/index.d.ts +11 -783
- package/dist/index.js +12 -8031
- package/dist/objects/Background.d.ts +31 -0
- package/dist/objects/Background.js +37 -0
- package/dist/objects/Lighting.d.ts +20 -0
- package/dist/objects/Lighting.js +85 -0
- package/dist/objects/containers/SlotContainer.d.ts +266 -0
- package/dist/objects/containers/SlotContainer.js +251 -0
- package/dist/objects/containers/hooks.d.ts +46 -0
- package/dist/objects/containers/hooks.js +118 -0
- package/dist/objects/containers/index.d.ts +6 -0
- package/dist/objects/containers/index.js +4 -0
- package/dist/objects/containers/keys.d.ts +10 -0
- package/dist/objects/containers/keys.js +18 -0
- package/dist/objects/containers/mesh-writes.d.ts +106 -0
- package/dist/objects/containers/mesh-writes.js +97 -0
- package/dist/objects/containers/props.d.ts +23 -0
- package/dist/objects/containers/props.js +1 -0
- package/dist/objects/images/ImageInstance.d.ts +29 -0
- package/dist/objects/images/ImageInstance.js +83 -0
- package/dist/objects/images/Images.d.ts +37 -0
- package/dist/objects/images/Images.js +204 -0
- package/dist/objects/images/atlas-packer.d.ts +128 -0
- package/dist/objects/images/atlas-packer.js +315 -0
- package/dist/objects/images/image-container.d.ts +51 -0
- package/dist/objects/images/image-container.js +70 -0
- package/dist/objects/images/index.d.ts +2 -0
- package/dist/objects/images/index.js +1 -0
- package/dist/objects/images/texture-budget.d.ts +120 -0
- package/dist/objects/images/texture-budget.js +215 -0
- package/dist/objects/layer/Layer.d.ts +27 -0
- package/dist/objects/layer/Layer.js +114 -0
- package/dist/objects/layer/index.d.ts +2 -0
- package/dist/objects/layer/index.js +1 -0
- package/dist/objects/layer/mount-scheduler.d.ts +102 -0
- package/dist/objects/layer/mount-scheduler.js +145 -0
- package/dist/objects/layer/visibility-gui.d.ts +19 -0
- package/dist/objects/layer/visibility-gui.js +93 -0
- package/dist/objects/lines/LineInstance.d.ts +21 -0
- package/dist/objects/lines/LineInstance.js +73 -0
- package/dist/objects/lines/Lines.d.ts +17 -0
- package/dist/objects/lines/Lines.js +29 -0
- package/dist/objects/lines/index.d.ts +2 -0
- package/dist/objects/lines/index.js +1 -0
- package/dist/objects/lines/line-container.d.ts +35 -0
- package/dist/objects/lines/line-container.js +40 -0
- package/dist/objects/materials/ColorMaterial.d.ts +85 -0
- package/dist/objects/materials/ColorMaterial.js +89 -0
- package/dist/objects/materials/LineMaterial.d.ts +44 -0
- package/dist/objects/materials/LineMaterial.js +72 -0
- package/dist/objects/materials/ModelMaterial.d.ts +41 -0
- package/dist/objects/materials/ModelMaterial.js +84 -0
- package/dist/objects/materials/TextureMaterial.d.ts +30 -0
- package/dist/objects/materials/TextureMaterial.js +29 -0
- package/dist/objects/materials/dim.d.ts +123 -0
- package/dist/objects/materials/dim.js +213 -0
- package/dist/objects/materials/shared.d.ts +6 -0
- package/dist/objects/materials/shared.js +51 -0
- package/dist/objects/models/ModelInstance.d.ts +22 -0
- package/dist/objects/models/ModelInstance.js +33 -0
- package/dist/objects/models/Models.d.ts +22 -0
- package/dist/objects/models/Models.js +177 -0
- package/dist/objects/models/gltf-cache.d.ts +17 -0
- package/dist/objects/models/gltf-cache.js +50 -0
- package/dist/objects/models/index.d.ts +2 -0
- package/dist/objects/models/index.js +1 -0
- package/dist/objects/models/model-asset.d.ts +48 -0
- package/dist/objects/models/model-asset.js +77 -0
- package/dist/objects/models/model-container.d.ts +139 -0
- package/dist/objects/models/model-container.js +227 -0
- package/dist/objects/shapes/ShapeInstance.d.ts +26 -0
- package/dist/objects/shapes/ShapeInstance.js +40 -0
- package/dist/objects/shapes/Shapes.d.ts +21 -0
- package/dist/objects/shapes/Shapes.js +120 -0
- package/dist/objects/shapes/index.d.ts +2 -0
- package/dist/objects/shapes/index.js +1 -0
- package/dist/objects/shapes/shape-container.d.ts +165 -0
- package/dist/objects/shapes/shape-container.js +272 -0
- package/dist/objects/shapes/shape-geometry.d.ts +27 -0
- package/dist/objects/shapes/shape-geometry.js +94 -0
- package/dist/objects/text/TextInstance.d.ts +22 -0
- package/dist/objects/text/TextInstance.js +95 -0
- package/dist/objects/text/Texts.d.ts +30 -0
- package/dist/objects/text/Texts.js +41 -0
- package/dist/objects/text/index.d.ts +2 -0
- package/dist/objects/text/index.js +1 -0
- package/dist/objects/text/text-container.d.ts +105 -0
- package/dist/objects/text/text-container.js +206 -0
- package/dist/objects/text/text-layout.d.ts +83 -0
- package/dist/objects/text/text-layout.js +154 -0
- package/dist/space/Camera.d.ts +103 -0
- package/dist/space/Camera.js +321 -0
- package/dist/space/Scene.d.ts +44 -0
- package/dist/space/Scene.js +112 -0
- package/dist/space/Space.d.ts +288 -0
- package/dist/space/Space.js +329 -0
- package/dist/space/VisibleRect.d.ts +72 -0
- package/dist/space/VisibleRect.js +129 -0
- package/dist/space/camera-handle.d.ts +67 -0
- package/dist/space/camera-handle.js +63 -0
- package/dist/space/camera-kind.d.ts +26 -0
- package/dist/space/camera-kind.js +30 -0
- package/dist/space/canvas-size.d.ts +24 -0
- package/dist/space/canvas-size.js +20 -0
- package/dist/space/clipping.d.ts +55 -0
- package/dist/space/clipping.js +108 -0
- package/dist/space/layout-measure.d.ts +65 -0
- package/dist/space/layout-measure.js +173 -0
- package/dist/space/viewport.d.ts +112 -0
- package/dist/space/viewport.js +67 -0
- package/dist/types/defs.d.ts +169 -0
- package/dist/types/defs.js +1 -0
- package/dist/types/events.d.ts +183 -0
- package/dist/types/events.js +1 -0
- package/dist/types/guards.d.ts +14 -0
- package/dist/types/guards.js +42 -0
- package/dist/update/index.d.ts +3 -0
- package/dist/update/index.js +2 -0
- package/dist/update/slot-writers.d.ts +30 -0
- package/dist/update/slot-writers.js +72 -0
- package/dist/update/store.d.ts +41 -0
- package/dist/update/store.js +98 -0
- package/dist/utils/arrays.d.ts +13 -0
- package/dist/utils/arrays.js +20 -0
- package/dist/utils/colors.d.ts +19 -0
- package/dist/utils/colors.js +27 -0
- package/dist/utils/logging.d.ts +26 -0
- package/dist/utils/logging.js +47 -0
- package/dist/utils/math.d.ts +24 -0
- package/dist/utils/math.js +27 -0
- package/package.json +67 -19
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { type Color, DataTexture, type Matrix3, type Matrix4, type PixelFormat, type TextureDataType, type TypedArray, type TypedArrayConstructor, type Vector2, type Vector3, type Vector4, type WebGLRenderer, WebGLUtils } from 'three';
|
|
2
|
+
/** Represents the number of elements per pixel. */
|
|
3
|
+
export type ChannelSize = 1 | 2 | 3 | 4;
|
|
4
|
+
/** Represents the texture information including its data, size, format, and data type. */
|
|
5
|
+
export interface TextureInfo {
|
|
6
|
+
/** The allocated typed array. */
|
|
7
|
+
array: TypedArray;
|
|
8
|
+
/** The square texture's edge in pixels. */
|
|
9
|
+
size: number;
|
|
10
|
+
/** The pixel format. */
|
|
11
|
+
format: PixelFormat;
|
|
12
|
+
/** The data type. */
|
|
13
|
+
type: TextureDataType;
|
|
14
|
+
}
|
|
15
|
+
/** Represents information for updating rows in the texture. */
|
|
16
|
+
export interface UpdateRowInfo {
|
|
17
|
+
/** The first row of the range. */
|
|
18
|
+
row: number;
|
|
19
|
+
/** How many rows the range spans. */
|
|
20
|
+
count: number;
|
|
21
|
+
}
|
|
22
|
+
/** Defines the possible types of uniforms that can be used in shaders. */
|
|
23
|
+
export type UniformType = 'float' | 'vec2' | 'vec3' | 'vec4' | 'mat3' | 'mat4';
|
|
24
|
+
/** Represents a value that can be used as a uniform. */
|
|
25
|
+
export type UniformValueObj = Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | Color;
|
|
26
|
+
/** Defines a uniform value as either a number or a compatible three object. */
|
|
27
|
+
export type UniformValue = number | UniformValueObj;
|
|
28
|
+
/** Represents the schema for a uniform, defining its offset, size, and type. */
|
|
29
|
+
export interface UniformMapType {
|
|
30
|
+
/** The uniform's element offset within an instance's record. */
|
|
31
|
+
offset: number;
|
|
32
|
+
/** How many elements it spans. */
|
|
33
|
+
size: number;
|
|
34
|
+
/** Its GLSL type. */
|
|
35
|
+
type: UniformType;
|
|
36
|
+
}
|
|
37
|
+
/** Represents a map of uniform names to their schema definitions. */
|
|
38
|
+
export type UniformMap = Map<string, UniformMapType>;
|
|
39
|
+
/**
|
|
40
|
+
* The GLSL one shader stage needs in order to read a texture's uniforms, split by where it goes.
|
|
41
|
+
*
|
|
42
|
+
* Split rather than handed over as one string that opens `main` itself, which is what this used to
|
|
43
|
+
* emit: a prologue carrying its own `void main() {` made every patch that came after it aim at *that*
|
|
44
|
+
* one instead of the shader's, and the ordering that produced had to be re-explained at each call
|
|
45
|
+
* site. Both halves now go in through `shader-source`, which owns the anchor.
|
|
46
|
+
*/
|
|
47
|
+
export interface UniformsStageGLSL {
|
|
48
|
+
/** Samplers and varyings, which belong above `main`. */
|
|
49
|
+
declarations: string;
|
|
50
|
+
/** The fetch and the varying traffic, which belong as `main`'s first statements. */
|
|
51
|
+
body: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Calculates the square texture size based on the capacity and pixels per instance, so the texture
|
|
55
|
+
* is large enough to store every instance in a square layout.
|
|
56
|
+
* @param capacity - The maximum number of instances allowed in the texture.
|
|
57
|
+
* @param pixelsPerInstance - The number of pixels required for each instance.
|
|
58
|
+
* @returns The size of the square texture needed to store all the instances.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getSquareTextureSize(capacity: number, pixelsPerInstance: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* Generates texture information (size, format, type) for a square texture.
|
|
63
|
+
* @param arrayType - The constructor for the TypedArray.
|
|
64
|
+
* @param channels - The number of channels in the texture.
|
|
65
|
+
* @param pixelsPerInstance - The number of pixels required for each instance.
|
|
66
|
+
* @param capacity - The maximum number of instances allowed in the texture.
|
|
67
|
+
* @returns An object containing the texture's array, size, format, and data type.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getSquareTextureInfo(arrayType: TypedArrayConstructor, channels: ChannelSize, pixelsPerInstance: number, capacity: number): TextureInfo;
|
|
70
|
+
/**
|
|
71
|
+
* A `DataTexture` laid out as a square grid of per-instance records, with partial row uploads and
|
|
72
|
+
* per-instance uniforms addressed by instance id.
|
|
73
|
+
*
|
|
74
|
+
* Vendored from three.ez, which ships two near-identical copies of this file — one per package —
|
|
75
|
+
* and we would otherwise bundle both:
|
|
76
|
+
* - {@link https://github.com/agargaro/batched-mesh-extensions/blob/master/src/core/SquareDataTexture.ts | batched-mesh-extensions}
|
|
77
|
+
* - {@link https://github.com/agargaro/instanced-mesh/blob/master/src/core/utils/SquareDataTexture.ts | instanced-mesh}
|
|
78
|
+
*
|
|
79
|
+
* This is the batched-mesh-extensions version, the later of the two: its `update` hands whole-texture
|
|
80
|
+
* uploads back to three instead of hand-binding a texture unit, which drops `bindToProgram`,
|
|
81
|
+
* `getSlot`, `updateFull` and `updatePartial` along with the `?? maxTextures - 1` slot guess the
|
|
82
|
+
* instanced-mesh copy still carries.
|
|
83
|
+
*
|
|
84
|
+
* Three deliberate departures from both originals:
|
|
85
|
+
*
|
|
86
|
+
* 1. **No `flat` on the varyings.** With flat shading a fragment takes its value from the
|
|
87
|
+
* primitive's *provoking* vertex, and WebGL's default last-vertex convention is the expensive one
|
|
88
|
+
* for drivers — which is why upstream wants `WEBGL_provoking_vertex` enabled. Every value here is
|
|
89
|
+
* per-instance and therefore identical across a primitive's vertices, so interpolating instead of
|
|
90
|
+
* flat-shading yields the same result and needs no extension.
|
|
91
|
+
* 2. **The index varying is always `float`**, so `getUniformsGLSL` no longer takes an index type.
|
|
92
|
+
* It follows from the first: GLSL ES 3.00 requires integer varyings to be `flat`, so an index
|
|
93
|
+
* that is not float could not have the qualifier removed. **Callers must therefore hand it a float
|
|
94
|
+
* index** — `BatchedMeshExt` does, from three's own `getIndirectIndex( gl_DrawID )`, and
|
|
95
|
+
* `InstancedMeshExt` does, from the float index texture that replaced upstream's `uint` attribute.
|
|
96
|
+
* 3. **`clone` and `copy` produce an independent texture.** See each method.
|
|
97
|
+
*/
|
|
98
|
+
export declare class SquareDataTexture extends DataTexture {
|
|
99
|
+
/**
|
|
100
|
+
* Whether to enable partial texture updates by row. If `false`, the entire texture is updated.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
partialUpdate: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The maximum number of update calls per frame. Past it, the whole texture is re-uploaded instead.
|
|
106
|
+
* @default Infinity
|
|
107
|
+
*/
|
|
108
|
+
maxUpdateCalls: number;
|
|
109
|
+
/** Format/type conversion helper, built on first upload. */
|
|
110
|
+
protected _utils: WebGLUtils | null;
|
|
111
|
+
/** Whether any row has been marked since the last upload. */
|
|
112
|
+
protected _needsUpdate: boolean;
|
|
113
|
+
/** Width at the last upload, used to notice a resize; `null` until the first one. */
|
|
114
|
+
protected _lastWidth: number | null;
|
|
115
|
+
/** The typed array backing the texture. */
|
|
116
|
+
protected _data: TypedArray;
|
|
117
|
+
/** Elements per pixel. */
|
|
118
|
+
protected _channels: ChannelSize;
|
|
119
|
+
/** Pixels each instance occupies. */
|
|
120
|
+
protected _pixelsPerInstance: number;
|
|
121
|
+
/** Elements each instance occupies. */
|
|
122
|
+
protected _stride: number;
|
|
123
|
+
/** Rows marked dirty for the next partial upload. */
|
|
124
|
+
protected _rowToUpdate: boolean[];
|
|
125
|
+
/** Reused pool of dirty-row ranges, refilled each upload so a frame allocates nothing. */
|
|
126
|
+
protected readonly _rowRanges: UpdateRowInfo[];
|
|
127
|
+
/** Uniform layout, shared with whoever built the schema. */
|
|
128
|
+
protected _uniformMap: UniformMap;
|
|
129
|
+
/** Whether uniforms are fetched in the fragment shader rather than passed as varyings. */
|
|
130
|
+
protected _fetchUniformsInFragmentShader: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* The backing typed array. An instanced mesh reads and writes its matrix and color data through
|
|
133
|
+
* it directly, the way three's own `InstancedMesh` writes its instance attributes — a per-instance
|
|
134
|
+
* accessor would be pure overhead on that hot path. Pair a write with {@link enqueueUpdate} so the
|
|
135
|
+
* row is re-uploaded.
|
|
136
|
+
* @returns The array.
|
|
137
|
+
*/
|
|
138
|
+
get data(): TypedArray;
|
|
139
|
+
/**
|
|
140
|
+
* @param arrayType - The constructor for the TypedArray.
|
|
141
|
+
* @param channels - The number of channels in the texture.
|
|
142
|
+
* @param pixelsPerInstance - The number of pixels required for each instance.
|
|
143
|
+
* @param capacity - The total number of instances.
|
|
144
|
+
* @param uniformMap - Optional map for handling uniform values.
|
|
145
|
+
* @param fetchInFragmentShader - Optional flag that determines if uniform values should be fetched
|
|
146
|
+
* in the fragment shader instead of the vertex shader.
|
|
147
|
+
*/
|
|
148
|
+
constructor(arrayType: TypedArrayConstructor, channels: ChannelSize, pixelsPerInstance: number, capacity: number, uniformMap?: UniformMap, fetchInFragmentShader?: boolean);
|
|
149
|
+
/**
|
|
150
|
+
* Resizes the texture to accommodate a new number of instances.
|
|
151
|
+
* @param count - The new total number of instances.
|
|
152
|
+
*/
|
|
153
|
+
resize(count: number): void;
|
|
154
|
+
/**
|
|
155
|
+
* Marks a row of the texture for update during the next render cycle, so only rows that changed
|
|
156
|
+
* are re-uploaded.
|
|
157
|
+
* @param index - The index of the instance to update.
|
|
158
|
+
*/
|
|
159
|
+
enqueueUpdate(index: number): void;
|
|
160
|
+
/**
|
|
161
|
+
* Uploads whatever changed since the last frame, a row range at a time.
|
|
162
|
+
*
|
|
163
|
+
* Defers to three's own full upload whenever it is going to happen anyway — before the texture
|
|
164
|
+
* exists, after a resize, or when the version moved — and whenever the dirty rows are so scattered
|
|
165
|
+
* that `maxUpdateCalls` would be exceeded.
|
|
166
|
+
* @param renderer - The renderer to upload through.
|
|
167
|
+
*/
|
|
168
|
+
update(renderer: WebGLRenderer): void;
|
|
169
|
+
/**
|
|
170
|
+
* Sets a uniform value at the specified instance ID in the texture.
|
|
171
|
+
* @param id - The instance ID to set the uniform for.
|
|
172
|
+
* @param name - The name of the uniform.
|
|
173
|
+
* @param value - The value to set for the uniform.
|
|
174
|
+
*/
|
|
175
|
+
setUniformAt(id: number, name: string, value: UniformValue): void;
|
|
176
|
+
/**
|
|
177
|
+
* Retrieves a uniform value at the specified instance ID from the texture.
|
|
178
|
+
* @param id - The instance ID to retrieve the uniform from.
|
|
179
|
+
* @param name - The name of the uniform.
|
|
180
|
+
* @param target - Optional target object to store the uniform value.
|
|
181
|
+
* @returns The uniform value for the specified instance.
|
|
182
|
+
*/
|
|
183
|
+
getUniformAt(id: number, name: string, target?: UniformValueObj): UniformValue;
|
|
184
|
+
/**
|
|
185
|
+
* Generates the GLSL for reading this texture's uniforms.
|
|
186
|
+
*
|
|
187
|
+
* The index varying is `float` and has no index-type parameter, because these varyings carry no
|
|
188
|
+
* `flat` qualifier — see the class docs. `indexName` must name a float in the shader.
|
|
189
|
+
* @param textureName - The name of the texture in the GLSL shader.
|
|
190
|
+
* @param indexName - The name of the index in the GLSL shader.
|
|
191
|
+
* @returns What each stage declares and what it runs first; see {@link UniformsStageGLSL}.
|
|
192
|
+
*/
|
|
193
|
+
getUniformsGLSL(textureName: string, indexName: string): {
|
|
194
|
+
vertex: UniformsStageGLSL;
|
|
195
|
+
fragment: UniformsStageGLSL;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Copies another texture's pixels and layout, leaving nothing shared between the two.
|
|
199
|
+
*
|
|
200
|
+
* Both originals assign `_rowToUpdate` by reference and inherit `Texture.copy`'s by-reference
|
|
201
|
+
* `source`, so a copy and its original wrote through into each other's pixels and marked each
|
|
202
|
+
* other's rows dirty. Only `_uniformMap` stays shared, which is safe: it is the layout descriptor
|
|
203
|
+
* built once from the schema and never mutated.
|
|
204
|
+
* @param source - The texture to copy.
|
|
205
|
+
* @returns `this`.
|
|
206
|
+
*/
|
|
207
|
+
copy(source: SquareDataTexture): this;
|
|
208
|
+
/**
|
|
209
|
+
* Duplicates the texture.
|
|
210
|
+
*
|
|
211
|
+
* Neither original overrides this, so three's `Texture.clone` ran `new this.constructor()` with no
|
|
212
|
+
* arguments — and this constructor derives its size, format and typed array from those arguments,
|
|
213
|
+
* so the inherited clone always threw, taking every `copy` of an owning mesh down with it.
|
|
214
|
+
* @returns The independent copy.
|
|
215
|
+
*/
|
|
216
|
+
clone(): this;
|
|
217
|
+
/**
|
|
218
|
+
* Groups the dirty rows into contiguous ranges, so neighbors upload in one call. Fills the reused
|
|
219
|
+
* {@link _rowRanges} pool — growing it only when a frame has more ranges than ever before — rather
|
|
220
|
+
* than allocating a fresh array and range objects every frame.
|
|
221
|
+
* @returns How many ranges were written to the pool.
|
|
222
|
+
*/
|
|
223
|
+
protected collectDirtyRanges(): number;
|
|
224
|
+
/**
|
|
225
|
+
* Uploads the given row ranges with `texSubImage2D`.
|
|
226
|
+
* @param webglTexture - The uploaded texture to write into.
|
|
227
|
+
* @param renderer - The renderer to upload through.
|
|
228
|
+
* @param rangeCount - How many of the pooled {@link _rowRanges} to upload.
|
|
229
|
+
*/
|
|
230
|
+
protected updateRows(webglTexture: WebGLTexture, renderer: WebGLRenderer, rangeCount: number): void;
|
|
231
|
+
/**
|
|
232
|
+
* The vertex stage's share: either the whole fetch plus the varyings it feeds, or — when uniforms
|
|
233
|
+
* are read in the fragment shader — just the index handed across.
|
|
234
|
+
* @param textureName - The sampler name.
|
|
235
|
+
* @param indexName - The per-instance index available in the vertex shader; must be a float.
|
|
236
|
+
* @returns What the stage declares and what it runs first.
|
|
237
|
+
*/
|
|
238
|
+
protected getUniformsVertexGLSL(textureName: string, indexName: string): UniformsStageGLSL;
|
|
239
|
+
/**
|
|
240
|
+
* The fragment stage's share: either the varyings the vertex shader filled, or the fetch itself.
|
|
241
|
+
* @param textureName - The sampler name.
|
|
242
|
+
* @param indexName - The per-instance index carried across as a varying.
|
|
243
|
+
* @returns What the stage declares and what it runs first.
|
|
244
|
+
*/
|
|
245
|
+
protected getUniformsFragmentGLSL(textureName: string, indexName: string): UniformsStageGLSL;
|
|
246
|
+
/**
|
|
247
|
+
* GLSL fetching every texel one instance occupies.
|
|
248
|
+
* @param textureName - The sampler name.
|
|
249
|
+
* @param indexName - The instance index expression.
|
|
250
|
+
* @returns The GLSL statements.
|
|
251
|
+
*/
|
|
252
|
+
protected texelsFetchGLSL(textureName: string, indexName: string): string;
|
|
253
|
+
/**
|
|
254
|
+
* GLSL unpacking each uniform out of the fetched texels.
|
|
255
|
+
* @returns The GLSL declarations.
|
|
256
|
+
*/
|
|
257
|
+
protected getFromTexelsGLSL(): string;
|
|
258
|
+
/**
|
|
259
|
+
* The varying declarations carrying each uniform from vertex to fragment stage.
|
|
260
|
+
*
|
|
261
|
+
* No `flat` qualifier, unlike both originals — see the class docs.
|
|
262
|
+
* @returns The declaration, assignment and read snippets.
|
|
263
|
+
*/
|
|
264
|
+
protected getVarying(): {
|
|
265
|
+
declareVarying: string;
|
|
266
|
+
assignVarying: string;
|
|
267
|
+
getVarying: string;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* The swizzle selecting a uniform's components out of its texel.
|
|
271
|
+
* @param offset - The uniform's element offset within an instance.
|
|
272
|
+
* @param size - How many elements it spans.
|
|
273
|
+
* @returns The component swizzle, such as `rgb`.
|
|
274
|
+
*/
|
|
275
|
+
protected getUniformComponents(offset: number, size: number): string;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=SquareDataTexture.d.ts.map
|