@aethervtt/shard-render 0.0.1
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 +3 -0
- package/dist/assets.d.ts +104 -0
- package/dist/assets.js +213 -0
- package/dist/atmosphere-model.d.ts +96 -0
- package/dist/atmosphere-model.js +370 -0
- package/dist/atmosphere-nodes.d.ts +55 -0
- package/dist/atmosphere-nodes.js +780 -0
- package/dist/atmosphere-plugin.d.ts +5 -0
- package/dist/atmosphere-plugin.js +42 -0
- package/dist/atmosphere-shaders.d.ts +7 -0
- package/dist/atmosphere-shaders.js +595 -0
- package/dist/atmosphere-state.d.ts +72 -0
- package/dist/atmosphere-state.js +18 -0
- package/dist/atmosphere.d.ts +191 -0
- package/dist/atmosphere.js +950 -0
- package/dist/camera.d.ts +83 -0
- package/dist/camera.js +163 -0
- package/dist/clusters.d.ts +68 -0
- package/dist/clusters.js +288 -0
- package/dist/culling-shaders.d.ts +2 -0
- package/dist/culling-shaders.js +203 -0
- package/dist/culling.d.ts +84 -0
- package/dist/culling.js +498 -0
- package/dist/debug-shaders.d.ts +3 -0
- package/dist/debug-shaders.js +207 -0
- package/dist/debug-views.d.ts +60 -0
- package/dist/debug-views.js +197 -0
- package/dist/deferred-plugin.d.ts +5 -0
- package/dist/deferred-plugin.js +20 -0
- package/dist/deferred-shaders.d.ts +2 -0
- package/dist/deferred-shaders.js +151 -0
- package/dist/deferred.d.ts +22 -0
- package/dist/deferred.js +296 -0
- package/dist/deform.d.ts +80 -0
- package/dist/deform.js +213 -0
- package/dist/describe-plugin.d.ts +5 -0
- package/dist/describe-plugin.js +19 -0
- package/dist/display-nodes.d.ts +5 -0
- package/dist/display-nodes.js +189 -0
- package/dist/dynamic-resolution.d.ts +47 -0
- package/dist/dynamic-resolution.js +191 -0
- package/dist/environment-plugin.d.ts +6 -0
- package/dist/environment-plugin.js +44 -0
- package/dist/environment-shaders.d.ts +2 -0
- package/dist/environment-shaders.js +260 -0
- package/dist/environment-state.d.ts +71 -0
- package/dist/environment-state.js +144 -0
- package/dist/environment.d.ts +70 -0
- package/dist/environment.js +529 -0
- package/dist/forward.d.ts +123 -0
- package/dist/forward.js +1216 -0
- package/dist/fxaa.d.ts +2 -0
- package/dist/fxaa.js +65 -0
- package/dist/gizmo-font.d.ts +21 -0
- package/dist/gizmo-font.js +132 -0
- package/dist/gizmos-plugin.d.ts +5 -0
- package/dist/gizmos-plugin.js +34 -0
- package/dist/gizmos.d.ts +156 -0
- package/dist/gizmos.js +772 -0
- package/dist/gpu-assets.d.ts +114 -0
- package/dist/gpu-assets.js +494 -0
- package/dist/graph.d.ts +204 -0
- package/dist/graph.js +417 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +540 -0
- package/dist/instances.d.ts +349 -0
- package/dist/instances.js +1335 -0
- package/dist/large-world.d.ts +13 -0
- package/dist/large-world.js +20 -0
- package/dist/lights.d.ts +160 -0
- package/dist/lights.js +468 -0
- package/dist/material-noise.d.ts +19 -0
- package/dist/material-noise.js +7 -0
- package/dist/material-pipelines.d.ts +46 -0
- package/dist/material-pipelines.js +166 -0
- package/dist/materials.d.ts +108 -0
- package/dist/materials.js +219 -0
- package/dist/noise.d.ts +76 -0
- package/dist/noise.js +286 -0
- package/dist/overlay-registry.d.ts +18 -0
- package/dist/overlay-registry.js +30 -0
- package/dist/overlays.d.ts +35 -0
- package/dist/overlays.js +344 -0
- package/dist/paths.d.ts +20 -0
- package/dist/paths.js +46 -0
- package/dist/picking-plugin.d.ts +2 -0
- package/dist/picking-plugin.js +20 -0
- package/dist/picking.d.ts +94 -0
- package/dist/picking.js +456 -0
- package/dist/pixel-perfect-plugin.d.ts +9 -0
- package/dist/pixel-perfect-plugin.js +135 -0
- package/dist/pixel-perfect.d.ts +27 -0
- package/dist/pixel-perfect.js +70 -0
- package/dist/plugin.d.ts +111 -0
- package/dist/plugin.js +182 -0
- package/dist/pool.d.ts +19 -0
- package/dist/pool.js +43 -0
- package/dist/post-common.d.ts +51 -0
- package/dist/post-common.js +148 -0
- package/dist/post-nodes.d.ts +39 -0
- package/dist/post-nodes.js +849 -0
- package/dist/post-plugin.d.ts +5 -0
- package/dist/post-plugin.js +26 -0
- package/dist/post-shaders.d.ts +8 -0
- package/dist/post-shaders.js +698 -0
- package/dist/post.d.ts +175 -0
- package/dist/post.js +453 -0
- package/dist/readback.d.ts +4 -0
- package/dist/readback.js +95 -0
- package/dist/render-scale.d.ts +53 -0
- package/dist/render-scale.js +63 -0
- package/dist/shaders.d.ts +122 -0
- package/dist/shaders.js +1168 -0
- package/dist/shadows.d.ts +119 -0
- package/dist/shadows.js +562 -0
- package/dist/skin-asset.d.ts +26 -0
- package/dist/skin-asset.js +25 -0
- package/dist/skinning-plugin.d.ts +5 -0
- package/dist/skinning-plugin.js +16 -0
- package/dist/skinning.d.ts +19 -0
- package/dist/skinning.js +343 -0
- package/dist/standard-fields.d.ts +67 -0
- package/dist/standard-fields.js +73 -0
- package/dist/standard.d.ts +7 -0
- package/dist/standard.js +37 -0
- package/dist/stats.d.ts +25 -0
- package/dist/stats.js +18 -0
- package/dist/target.d.ts +55 -0
- package/dist/target.js +70 -0
- package/dist/testing.d.ts +34 -0
- package/dist/testing.js +126 -0
- package/dist/timer.d.ts +28 -0
- package/dist/timer.js +136 -0
- package/dist/view.d.ts +117 -0
- package/dist/view.js +389 -0
- package/dist/visibility.d.ts +10 -0
- package/dist/visibility.js +84 -0
- package/package.json +49 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { type World } from '@aethervtt/shard-core';
|
|
2
|
+
import { GpuBuffer, type GpuContext } from '@aethervtt/shard-gpu';
|
|
3
|
+
import type { Mesh } from '@aethervtt/shard-mesh';
|
|
4
|
+
import { MaterialAsset } from './assets.js';
|
|
5
|
+
import { DeformStore } from './deform.js';
|
|
6
|
+
export declare const InstanceSlot: import("@aethervtt/shard-core").ComponentDef<{
|
|
7
|
+
readonly slot: import("@aethervtt/shard-core").FieldType<number, "u32">;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const NotShadowCaster: import("@aethervtt/shard-core").ComponentDef<{}>;
|
|
10
|
+
export declare const NotShadowReceiver: import("@aethervtt/shard-core").ComponentDef<{}>;
|
|
11
|
+
export declare const Mesh3d: import("@aethervtt/shard-core").ComponentDef<{
|
|
12
|
+
readonly mesh: import("@aethervtt/shard-core").FieldType<import("@aethervtt/shard-core").AssetRef<"Mesh"> | null, "object">;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const MeshMaterial: import("@aethervtt/shard-core").ComponentDef<{
|
|
15
|
+
readonly material: import("@aethervtt/shard-core").FieldType<import("@aethervtt/shard-core").AssetRef<"Material"> | null, "object">;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const MAX_LOD_LEVELS = 8;
|
|
18
|
+
export declare const Lod: import("@aethervtt/shard-core").ComponentDef<{
|
|
19
|
+
readonly levels: import("@aethervtt/shard-core").FieldType<import("@aethervtt/shard-core").InferFields<{
|
|
20
|
+
mesh: import("@aethervtt/shard-core").FieldType<import("@aethervtt/shard-core").AssetRef<"Mesh"> | null, "object">;
|
|
21
|
+
screenSize: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
22
|
+
}>[], "object">;
|
|
23
|
+
readonly hysteresis: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
24
|
+
readonly bias: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const SkinnedMesh: import("@aethervtt/shard-core").ComponentDef<{
|
|
27
|
+
readonly skin: import("@aethervtt/shard-core").FieldType<import("@aethervtt/shard-core").AssetRef<"Skin"> | null, "object">;
|
|
28
|
+
readonly joints: import("@aethervtt/shard-core").FieldType<(number | null)[], "object">;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const MorphWeights: import("@aethervtt/shard-core").ComponentDef<{
|
|
31
|
+
readonly weights: import("@aethervtt/shard-core").FieldType<number[], "object">;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const VisibilityRange: import("@aethervtt/shard-core").ComponentDef<{
|
|
34
|
+
readonly start: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
35
|
+
readonly end: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const InstanceData: import("@aethervtt/shard-core").ComponentDef<{
|
|
38
|
+
readonly x: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
39
|
+
readonly y: import("@aethervtt/shard-core").FieldType<number, "f32">;
|
|
40
|
+
}>;
|
|
41
|
+
/** Floats per instance record: affine rows (12), batch, flags, visibility range, entity. */
|
|
42
|
+
export declare const INSTANCE_FLOATS = 16;
|
|
43
|
+
export declare const INSTANCE_BYTES: number;
|
|
44
|
+
export declare const InstanceFlags: {
|
|
45
|
+
readonly Visible: 1;
|
|
46
|
+
readonly Caster: 2;
|
|
47
|
+
readonly Receiver: 4;
|
|
48
|
+
readonly Range: 8;
|
|
49
|
+
readonly Lod: 16;
|
|
50
|
+
/** Skinned: the vertex stage reads joint matrices; culling reads the slot's own sphere. */
|
|
51
|
+
readonly Skinned: 32;
|
|
52
|
+
/** Morphed: the vertex stage adds morph target deltas. */
|
|
53
|
+
readonly Morph: 64;
|
|
54
|
+
};
|
|
55
|
+
/** Record value for "no batch". LOD slots store `LOD_BIT | lodSet`. */
|
|
56
|
+
export declare const NO_BATCH = 4294967295;
|
|
57
|
+
export declare const LOD_BIT = 2147483648;
|
|
58
|
+
/** Visible-list entries: slot in the low 28 bits, LOD level in the top 4. */
|
|
59
|
+
export declare const SLOT_MASK = 268435455;
|
|
60
|
+
/** A LOD state entry with no level chosen yet. */
|
|
61
|
+
export declare const LOD_UNSET = 255;
|
|
62
|
+
/** All instances of one (mesh, material) pair: one draw per view. */
|
|
63
|
+
export interface Batch {
|
|
64
|
+
index: number;
|
|
65
|
+
mesh: Mesh;
|
|
66
|
+
material: MaterialAsset;
|
|
67
|
+
meshGuid: string | undefined;
|
|
68
|
+
materialGuid: string | undefined;
|
|
69
|
+
/** Instances that can land in this batch (LOD slots count for every level of their set). */
|
|
70
|
+
count: number;
|
|
71
|
+
/** Whether the material's textures are ready this frame. */
|
|
72
|
+
ready: boolean;
|
|
73
|
+
/** Blended (alpha, additive, premultiplied): drawn after opaque, back to front, no shadows. */
|
|
74
|
+
transparent: boolean;
|
|
75
|
+
/** Can go through the G-buffer: standard lighting and not blended. */
|
|
76
|
+
deferrable: boolean;
|
|
77
|
+
/** Plain (non-LOD) slots in this batch, for culling one batch without scanning all slots. */
|
|
78
|
+
members: Uint32Array;
|
|
79
|
+
memberCount: number;
|
|
80
|
+
/** Where this batch's instances start in a view's visible region (GPU culling). */
|
|
81
|
+
region: number;
|
|
82
|
+
/** Per-cull scratch: slots that passed, before packing. */
|
|
83
|
+
scratch: Uint32Array;
|
|
84
|
+
scratchCount: number;
|
|
85
|
+
/** Per-cull scratch for forward-only slots in deferred views. */
|
|
86
|
+
forwardScratch: Uint32Array;
|
|
87
|
+
forwardCount: number;
|
|
88
|
+
}
|
|
89
|
+
/** A Lod component's levels resolved to batches, shared by every entity with the same values. */
|
|
90
|
+
export interface LodSet {
|
|
91
|
+
index: number;
|
|
92
|
+
key: string;
|
|
93
|
+
batches: number[];
|
|
94
|
+
thresholds: Float32Array;
|
|
95
|
+
hysteresis: number;
|
|
96
|
+
bias: number;
|
|
97
|
+
count: number;
|
|
98
|
+
}
|
|
99
|
+
export interface DrawItem {
|
|
100
|
+
batch: Batch;
|
|
101
|
+
/** First entry in the visible buffer (the draw's firstInstance). */
|
|
102
|
+
first: number;
|
|
103
|
+
count: number;
|
|
104
|
+
/** Byte offset of the draw's indirect arguments (GPU culling), or -1 for a direct draw. */
|
|
105
|
+
indirect: number;
|
|
106
|
+
}
|
|
107
|
+
/** One view's culled draws: a camera, or a shadow map face. */
|
|
108
|
+
export interface DrawList {
|
|
109
|
+
items: DrawItem[];
|
|
110
|
+
length: number;
|
|
111
|
+
visible: number;
|
|
112
|
+
culled: number;
|
|
113
|
+
hidden: number;
|
|
114
|
+
pending: number;
|
|
115
|
+
/** Index in the frame's GPU cull views, or -1 (CPU culled). */
|
|
116
|
+
cullView: number;
|
|
117
|
+
}
|
|
118
|
+
export declare function createDrawList(): DrawList;
|
|
119
|
+
/** What a view culls with: frustum planes, the camera it measures distance and LOD from. */
|
|
120
|
+
export interface CullParams {
|
|
121
|
+
planes: Float32Array | null;
|
|
122
|
+
require: number;
|
|
123
|
+
/** Where distances (visibility ranges, LOD) are measured from. */
|
|
124
|
+
eye: Float32Array | undefined;
|
|
125
|
+
/** Screen size of a sphere: r · lodScale / distance (perspective) or r · lodScale (ortho). */
|
|
126
|
+
lodScale: number;
|
|
127
|
+
orthographic: boolean;
|
|
128
|
+
/** LOD state per slot for this view's camera; updated when `updateLod`. */
|
|
129
|
+
lodState: Uint8Array | undefined;
|
|
130
|
+
updateLod: boolean;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* World bounding sphere of a slot: the mesh's local sphere (from its bounds) through the slot's
|
|
134
|
+
* affine transform, radius scaled by the largest axis. Mirrors `slot_sphere` in the cull shader.
|
|
135
|
+
*/
|
|
136
|
+
export declare function slotSphere(out: Float32Array, f: Float32Array, o: number, bounds: Float32Array): Float32Array;
|
|
137
|
+
/** Sphere against six planes (inside where n·p + d ≥ 0). */
|
|
138
|
+
export declare function sphereInFrustum(planes: Float32Array, s: Float32Array): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* The LOD level for a size, from the previous level with hysteresis. Returns `count` (culled) when
|
|
141
|
+
* smaller than the last threshold. Mirrors `select_lod` in the cull shader.
|
|
142
|
+
*/
|
|
143
|
+
export declare function selectLod(size: number, thresholds: ArrayLike<number>, count: number, hysteresis: number, previous: number): number;
|
|
144
|
+
type LodValue = {
|
|
145
|
+
levels: {
|
|
146
|
+
mesh: {
|
|
147
|
+
guid: string | undefined;
|
|
148
|
+
} | null;
|
|
149
|
+
screenSize: number;
|
|
150
|
+
}[];
|
|
151
|
+
hysteresis: number;
|
|
152
|
+
bias: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* The persistent instance buffer. Each Mesh3d entity owns a slot holding its transform, batch (or
|
|
156
|
+
* LOD set), flags, and visibility range; only slots whose data changed are uploaded, in coalesced
|
|
157
|
+
* runs. Views cull slots on the CPU here, or on the GPU (`GpuCuller`), into per-view visible lists
|
|
158
|
+
* the vertex stage indexes through.
|
|
159
|
+
*/
|
|
160
|
+
export declare class InstanceStore {
|
|
161
|
+
capacity: number;
|
|
162
|
+
/** Slots in use or freed; slots >= high were never used. */
|
|
163
|
+
high: number;
|
|
164
|
+
f32: Float32Array<ArrayBuffer>;
|
|
165
|
+
u32: Uint32Array<ArrayBuffer>;
|
|
166
|
+
/**
|
|
167
|
+
* Each slot's InstanceFlags, mirrored from its record: prepare compares against these every
|
|
168
|
+
* frame, and reading them from the 64-byte records would touch a cache line per instance.
|
|
169
|
+
*/
|
|
170
|
+
flags: Uint8Array<ArrayBuffer>;
|
|
171
|
+
/** Hidden instances per ECS table id, from the last time prepare visited the table. */
|
|
172
|
+
readonly tableHidden: number[];
|
|
173
|
+
/** Batch index (>= 0), LOD set (-2 - index), or -1 (none), per slot. */
|
|
174
|
+
batchOf: Int32Array<ArrayBuffer>;
|
|
175
|
+
/** Index of the slot in its batch's member list, or -1. */
|
|
176
|
+
private memberIndex;
|
|
177
|
+
/** Visibility range per slot, as the GPU sees it (f16-rounded start, end). */
|
|
178
|
+
ranges: Float32Array<ArrayBuffer>;
|
|
179
|
+
meshRefs: ({
|
|
180
|
+
guid: string | undefined;
|
|
181
|
+
} | null)[];
|
|
182
|
+
materialRefs: ({
|
|
183
|
+
guid: string | undefined;
|
|
184
|
+
} | null)[];
|
|
185
|
+
/** Lod component value per slot, or null. */
|
|
186
|
+
lods: (LodValue | null)[];
|
|
187
|
+
private dirty;
|
|
188
|
+
private dirtyLo;
|
|
189
|
+
private dirtyHi;
|
|
190
|
+
/**
|
|
191
|
+
* Last frame's transform per slot (12 floats), for motion vectors. A slot that moved last frame
|
|
192
|
+
* but not this one catches up, so a stopped object has no velocity.
|
|
193
|
+
*/
|
|
194
|
+
prev: Float32Array<ArrayBuffer>;
|
|
195
|
+
private prevDirty;
|
|
196
|
+
private prevLo;
|
|
197
|
+
private prevHi;
|
|
198
|
+
private movedFrame;
|
|
199
|
+
private moved;
|
|
200
|
+
private movedCount;
|
|
201
|
+
private lastMoved;
|
|
202
|
+
private lastMovedCount;
|
|
203
|
+
private frame;
|
|
204
|
+
readonly prevBuffer: GpuBuffer;
|
|
205
|
+
private readonly free;
|
|
206
|
+
/** Slots waiting for their mesh or material to load. */
|
|
207
|
+
readonly pending: Set<number>;
|
|
208
|
+
readonly batches: Batch[];
|
|
209
|
+
/** Batches in draw order (sorted by pipeline, then material, then mesh). */
|
|
210
|
+
readonly sorted: Batch[];
|
|
211
|
+
private readonly byMesh;
|
|
212
|
+
readonly lodSets: LodSet[];
|
|
213
|
+
private readonly lodByKey;
|
|
214
|
+
readonly defaultMaterial: MaterialAsset;
|
|
215
|
+
/** Bytes of instance data uploaded this frame. */
|
|
216
|
+
uploadedBytes: number;
|
|
217
|
+
/** Slots with a batch and not hidden, and hidden ones: stats for GPU-culled views. */
|
|
218
|
+
drawableCount: number;
|
|
219
|
+
hiddenCount: number;
|
|
220
|
+
/** Bumps when batches or LOD sets change shape (the GPU tables re-upload). */
|
|
221
|
+
structureVersion: number;
|
|
222
|
+
/** Visible slot lists of every CPU-culled view this frame, concatenated. */
|
|
223
|
+
visible: Uint32Array<ArrayBuffer>;
|
|
224
|
+
visibleCount: number;
|
|
225
|
+
readonly instanceBuffer: GpuBuffer;
|
|
226
|
+
readonly visibleBuffer: GpuBuffer;
|
|
227
|
+
private generation;
|
|
228
|
+
private readonly gpu;
|
|
229
|
+
bindGroup: GPUBindGroup | undefined;
|
|
230
|
+
private bound;
|
|
231
|
+
layout: GPUBindGroupLayout;
|
|
232
|
+
/** Set by the GPU culler: views it culls read their visible lists from this buffer. */
|
|
233
|
+
gpuVisible: GpuBuffer | undefined;
|
|
234
|
+
/** Bind group over `gpuVisible`, for draws of GPU-culled views. */
|
|
235
|
+
gpuBindGroup: GPUBindGroup | undefined;
|
|
236
|
+
private gpuBound;
|
|
237
|
+
/** Joint matrices, morph weights, and deform records of skinned and morphed slots. */
|
|
238
|
+
readonly deform: DeformStore;
|
|
239
|
+
constructor(gpu: GpuContext);
|
|
240
|
+
get live(): number;
|
|
241
|
+
private grow;
|
|
242
|
+
alloc(entity: number): number;
|
|
243
|
+
release(slot: number): void;
|
|
244
|
+
private boundsDirty;
|
|
245
|
+
private readonly cachedBounds;
|
|
246
|
+
/**
|
|
247
|
+
* The world bounds of every shadow caster (spheres), cached until an instance changes. GPU
|
|
248
|
+
* culling fits cascade depth ranges to it, having no CPU cull to take a union from.
|
|
249
|
+
*/
|
|
250
|
+
casterBounds(out: Float32Array): Float32Array;
|
|
251
|
+
markDirty(slot: number): void;
|
|
252
|
+
/**
|
|
253
|
+
* Records a transform change: `from` is where the slot's record is now (copied to its previous
|
|
254
|
+
* transform), unless the slot is new, when both get `to`.
|
|
255
|
+
*/
|
|
256
|
+
moveSlot(slot: number, g: ArrayLike<number>, offset: number, fresh: boolean): void;
|
|
257
|
+
/**
|
|
258
|
+
* The floating origin moved (spec 0040): adds `x, y, z` to every slot's current and previous
|
|
259
|
+
* translation, so this frame's moves compare against last frame's pose in the new frame and
|
|
260
|
+
* motion vectors stay continuous. Runs once per shift, not per frame.
|
|
261
|
+
*/
|
|
262
|
+
shiftOrigin(x: number, y: number, z: number): void;
|
|
263
|
+
private markPrevDirty;
|
|
264
|
+
/** Slots that moved last frame but not this one: their previous transform catches up. */
|
|
265
|
+
settleMoved(): void;
|
|
266
|
+
/** Assigns a slot to a batch (>= 0), a LOD set (-2 - index), or nothing (-1). */
|
|
267
|
+
assign(slot: number, assignment: number): void;
|
|
268
|
+
/** A plain batch assignment. */
|
|
269
|
+
setBatch(slot: number, index: number): void;
|
|
270
|
+
private addMember;
|
|
271
|
+
private removeMember;
|
|
272
|
+
batchFor(mesh: Mesh, material: MaterialAsset, meshGuid: string | undefined, materialGuid: string | undefined): Batch;
|
|
273
|
+
/** The LOD set for a Lod value and material (created on first use). Undefined if a mesh is missing. */
|
|
274
|
+
lodSetFor(lod: LodValue, material: MaterialAsset, materialGuid: string | undefined, meshes: import('@aethervtt/shard-assets').AssetStore<Mesh, 'Mesh'>): LodSet | undefined;
|
|
275
|
+
/** Orders batches by pipeline (set by the renderer: material type and variant). */
|
|
276
|
+
batchKey: (b: Batch) => number;
|
|
277
|
+
/** Draw order: grouped by pipeline, then material, then mesh, so switches stay rare. */
|
|
278
|
+
sortBatches(key?: (b: Batch) => number): void;
|
|
279
|
+
/** Materials and meshes in the order their first batch appeared (draw order within a pipeline). */
|
|
280
|
+
private readonly materialOrder;
|
|
281
|
+
private readonly meshOrder;
|
|
282
|
+
private compareBatches;
|
|
283
|
+
/** Writes a slot's visibility range (packed as two halves, as the GPU reads it). */
|
|
284
|
+
setRange(slot: number, start: number, end: number): void;
|
|
285
|
+
/** Uploads dirty slots in coalesced runs. Returns bytes written. */
|
|
286
|
+
upload(): number;
|
|
287
|
+
beginFrame(): void;
|
|
288
|
+
private transparentCount;
|
|
289
|
+
private forwardOnlyCount;
|
|
290
|
+
private tSlots;
|
|
291
|
+
private tBatches;
|
|
292
|
+
private tDepths;
|
|
293
|
+
private readonly tOrder;
|
|
294
|
+
/**
|
|
295
|
+
* CPU culling of every slot into `list` (and, for camera views, `transparent` back to front and
|
|
296
|
+
* deferred `forwardOnly`). Same tests as the GPU culler: bounding sphere against the frustum,
|
|
297
|
+
* visibility range, LOD level. `bounds` gets the union of what passed (cascade fitting). With
|
|
298
|
+
* `transparentOnly`, only blended batches are culled (the GPU culls the rest).
|
|
299
|
+
*/
|
|
300
|
+
cullCpu(list: DrawList, params: CullParams, bounds?: Float32Array, transparent?: DrawList, forward?: Float32Array, forwardOnly?: DrawList, transparentOnly?: boolean): void;
|
|
301
|
+
/** Transparent-only CPU cull over blended batches' members (LOD slots aren't members). */
|
|
302
|
+
cullTransparentMembers(list: DrawList, params: CullParams, forward: Float32Array): void;
|
|
303
|
+
/**
|
|
304
|
+
* CPU culling with positional arguments: planes, flag mask, bounds, transparent list, eye, view
|
|
305
|
+
* direction, and the deferred forward-only list. LOD selects fresh (no hysteresis state).
|
|
306
|
+
*/
|
|
307
|
+
cull(list: DrawList, planes: Float32Array | null, require?: number, bounds?: Float32Array, transparent?: DrawList, eye?: Float32Array, forward?: Float32Array, forwardOnly?: DrawList): void;
|
|
308
|
+
private pushTransparent;
|
|
309
|
+
/** Sorts this cull's transparent instances back to front; runs of one batch share a draw. */
|
|
310
|
+
private packTransparent;
|
|
311
|
+
private reserve;
|
|
312
|
+
private item;
|
|
313
|
+
/**
|
|
314
|
+
* False only when every instance of a small batch is hidden (Visibility), so views skip its
|
|
315
|
+
* draw. The GPU culler otherwise issues one indirect draw per batch, empty or not: a planet's
|
|
316
|
+
* pooled chunks are mostly hidden, and empty draws still cost their binds and calls.
|
|
317
|
+
*/
|
|
318
|
+
anyVisible(batch: Batch): boolean;
|
|
319
|
+
private nearKeys;
|
|
320
|
+
private nearItems;
|
|
321
|
+
/**
|
|
322
|
+
* Reorders a camera's opaque draws nearest first within each run that shares a pipeline and
|
|
323
|
+
* material, so the depth test rejects hidden fragments before they're shaded (overdraw on heavy
|
|
324
|
+
* shaders, like terrain, costs the most). Pipeline and material switches stay as few as before.
|
|
325
|
+
* A batch's distance is its first member's origin: exact for single-instance draws (terrain
|
|
326
|
+
* chunks), a fair guess for instanced ones. No allocation after warm-up: one typed-array sort of
|
|
327
|
+
* packed keys (run, log distance, index).
|
|
328
|
+
*/
|
|
329
|
+
orderNearFirst(list: DrawList, eye: ArrayLike<number>): void;
|
|
330
|
+
/** Copies each batch's scratch into the shared visible array, in draw order. */
|
|
331
|
+
pack(list: DrawList): void;
|
|
332
|
+
private createBindGroup;
|
|
333
|
+
/** Uploads this frame's CPU visible lists and (re)builds the bind groups the vertex stage reads. */
|
|
334
|
+
finishFrame(): void;
|
|
335
|
+
}
|
|
336
|
+
/** Projected diameter of a sphere as a fraction of viewport height. Mirrors the cull shader. */
|
|
337
|
+
export declare function lodSize(radius: number, distance: number, params: CullParams): number;
|
|
338
|
+
export declare function createInstanceLayout(gpu: GpuContext): GPUBindGroupLayout;
|
|
339
|
+
export declare const Instances: import("@aethervtt/shard-core").ResourceDef<InstanceStore>;
|
|
340
|
+
/** Present when skinningPlugin is installed: SkinnedMesh and MorphWeights deform what they draw. */
|
|
341
|
+
export declare const DeformPath: import("@aethervtt/shard-core").ResourceDef<{
|
|
342
|
+
installed: true;
|
|
343
|
+
}>;
|
|
344
|
+
export declare const prepareInstances: import("@aethervtt/shard-core").SystemDef<{
|
|
345
|
+
q: import("@aethervtt/shard-core").Query;
|
|
346
|
+
}>;
|
|
347
|
+
/** Frees a Mesh3d's slot when the component goes away (including on despawn). */
|
|
348
|
+
export declare function observeInstanceRemovals(world: World): void;
|
|
349
|
+
export {};
|