@woosh/meep-engine 3.60.7 → 3.60.9
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/package.json +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.d.ts +4 -1
- package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.js +35 -5
- package/src/engine/graphics3/AnimationSystem.d.ts +1 -1
- package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationSystem.js +34 -5
- package/src/engine/graphics3/FoliageWindSystem.d.ts +2 -1
- package/src/engine/graphics3/FoliageWindSystem.d.ts.map +1 -1
- package/src/engine/graphics3/FoliageWindSystem.js +50 -3
- package/src/engine/graphics3/GPUFluidSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUFluidSystem.js +16 -14
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +2 -2
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +84 -32
- package/src/engine/graphics3/LightSystem.d.ts +4 -0
- package/src/engine/graphics3/LightSystem.d.ts.map +1 -1
- package/src/engine/graphics3/LightSystem.js +23 -6
- package/src/engine/graphics3/MeshSkinSystem.d.ts +1 -1
- package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSkinSystem.js +50 -5
- package/src/engine/graphics3/MeshSystem.d.ts +1 -0
- package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSystem.js +22 -8
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts +5 -1
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics3/ShadedGeometrySystem.js +56 -7
- package/src/engine/graphics3/WaterSystem.d.ts +3 -0
- package/src/engine/graphics3/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/WaterSystem.js +10 -2
- package/src/engine/graphics3/animation/AnimationClipsSink.d.ts +15 -7
- package/src/engine/graphics3/animation/AnimationClipsSink.d.ts.map +1 -1
- package/src/engine/graphics3/animation/AnimationClipsSink.js +42 -8
- package/src/engine/network/state/ReplicationSlotTable.d.ts +9 -5
- package/src/engine/network/state/ReplicationSlotTable.d.ts.map +1 -1
- package/src/engine/network/state/ReplicationSlotTable.js +36 -8
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
- package/src/generation/markers/GridActionRuleSet.js +12 -3
- package/src/shade/renderer/GraphicsContext.d.ts +8 -0
- package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
- package/src/shade/renderer/GraphicsContext.js +29 -0
- package/src/shade/renderer/Renderer.d.ts +10 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +22 -2
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/light/GPULightCollection.d.ts +3 -1
- package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/GPULightCollection.js +34 -9
- package/src/shade/renderer/light/LightCollection.d.ts +13 -3
- package/src/shade/renderer/light/LightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/LightCollection.js +19 -3
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.d.ts +22 -0
- package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.js +30 -0
- package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.d.ts +75 -0
- package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.js +338 -0
- package/src/shade/renderer/material/dispatch/MATERIAL_DISPATCH_CONSTANTS.d.ts +50 -0
- package/src/shade/renderer/material/dispatch/MATERIAL_DISPATCH_CONSTANTS.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/MATERIAL_DISPATCH_CONSTANTS.js +54 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts +37 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatch.js +31 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatchRecords.d.ts +42 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatchRecords.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/MaterialDispatchRecords.js +132 -0
- package/src/shade/renderer/material/dispatch/chunk_material_mesh_key.d.ts +21 -0
- package/src/shade/renderer/material/dispatch/chunk_material_mesh_key.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/chunk_material_mesh_key.js +46 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_keys.d.ts +20 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_keys.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_keys.js +111 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_pack.d.ts +18 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_pack.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/chunk_material_quad_pack.js +33 -0
- package/src/shade/renderer/material/dispatch/gbuffer_compute.d.ts +116 -0
- package/src/shade/renderer/material/dispatch/gbuffer_compute.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/gbuffer_compute.js +249 -0
- package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.d.ts +56 -0
- package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.js +315 -0
- package/src/shade/renderer/material/dispatch/shader_material_dispatch_commands.d.ts +16 -0
- package/src/shade/renderer/material/dispatch/shader_material_dispatch_commands.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/shader_material_dispatch_commands.js +83 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_count.d.ts +22 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_count.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_count.js +133 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_scatter.d.ts +14 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_scatter.d.ts.map +1 -0
- package/src/shade/renderer/material/dispatch/shader_material_pixel_scatter.js +98 -0
- package/src/shade/renderer/material/standard/VT_MATERIAL_TEMPLATE.d.ts +1 -0
- package/src/shade/renderer/material/standard/VT_MATERIAL_TEMPLATE.d.ts.map +1 -1
- package/src/shade/renderer/material/standard/VT_MATERIAL_TEMPLATE.js +11 -0
- package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts +41 -6
- package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
- package/src/shade/renderer/material/standard/fragment_gbuffer.js +88 -29
- package/src/shade/renderer/material/template/ShadeMaterialTemplate.d.ts +13 -1
- package/src/shade/renderer/material/template/ShadeMaterialTemplate.d.ts.map +1 -1
- package/src/shade/renderer/material/template/ShadeMaterialTemplate.js +18 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +6 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +17 -7
- package/src/shade/renderer/scene/Scene.d.ts +4 -3
- package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/Scene.js +54 -53
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts +16 -0
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -1
- package/src/shade/renderer/scene/rows/GPUSceneRows.js +34 -0
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.d.ts +19 -0
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.js +55 -20
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_keyed_append.d.ts +31 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_keyed_append.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_keyed_append.js +77 -0
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts +6 -0
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.js +15 -1
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
chunk_read_meshlet_triangle_vertices
|
|
21
21
|
} from "../../shader/chunk/geometry/meshlet/chunk_read_meshlet_triangle_vertices.js";
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
chunk_anti_alias_roughness_kaplanyan_footprint
|
|
24
24
|
} from "../../shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.js";
|
|
25
25
|
import {
|
|
26
26
|
chunk_build_orthonormal_matrix_nt
|
|
@@ -69,15 +69,26 @@ export const g_buffer_viz_resources = new ShaderResourceGroupDescriptor();
|
|
|
69
69
|
|
|
70
70
|
g_buffer_viz_resources.label = "viz buffer";
|
|
71
71
|
|
|
72
|
-
g_buffer_viz_resources
|
|
73
|
-
.addTexture("viz_buffer_triangle", "uint")
|
|
74
|
-
.addTexture("viz_buffer_mesh", "uint")
|
|
75
|
-
.addUniform("view", VIEW_UNIFORM_STRUCT)
|
|
76
|
-
.addUniform("camera", CAMERA_UNIFORM_STRUCT)
|
|
77
|
-
;
|
|
72
|
+
add_g_buffer_viz_resources(g_buffer_viz_resources);
|
|
78
73
|
|
|
79
74
|
g_buffer_viz_resources.addVisibility(GPUShaderStage.FRAGMENT);
|
|
80
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Declare in `group` what {@link build_gbuffer_laydown} reads of the visibility buffer and the
|
|
78
|
+
* view that drew it: the first four bindings of group 1, under the names the body reads them by.
|
|
79
|
+
*
|
|
80
|
+
* @param {ShaderResourceGroupDescriptor} group
|
|
81
|
+
* @returns {ShaderResourceGroupDescriptor} `group`
|
|
82
|
+
*/
|
|
83
|
+
export function add_g_buffer_viz_resources(group) {
|
|
84
|
+
return group
|
|
85
|
+
.addTexture("viz_buffer_triangle", "uint")
|
|
86
|
+
.addTexture("viz_buffer_mesh", "uint")
|
|
87
|
+
.addUniform("view", VIEW_UNIFORM_STRUCT)
|
|
88
|
+
.addUniform("camera", CAMERA_UNIFORM_STRUCT)
|
|
89
|
+
;
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
/**
|
|
82
93
|
* Group 2 of every material's G-buffer pipeline: what the body pulls vertices from.
|
|
83
94
|
*
|
|
@@ -123,18 +134,30 @@ export function build_gbuffer_shader_resources(material_group) {
|
|
|
123
134
|
export const g_buffer_shader_resources = build_gbuffer_shader_resources(SHADING_MATERIAL_RESOURCE_GROUP);
|
|
124
135
|
|
|
125
136
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* only evolve in one place.
|
|
137
|
+
* The viz-buffer → G-buffer laydown of one pixel, around a template's surface function. Everything
|
|
138
|
+
* else — vertex pulling, perspective-correct barycentric derivatives, normal frame construction,
|
|
139
|
+
* roughness AA, G-buffer encoding — is shared verbatim between templates and between every entry
|
|
140
|
+
* point that runs it, so it can only evolve in one place.
|
|
141
|
+
*
|
|
142
|
+
* Reconstructs the {@link chunk_material_surface_contract} input from the visibility buffer and
|
|
143
|
+
* calls `material_surface` once; what comes back is anti-aliased, dithered and encoded here.
|
|
144
|
+
*
|
|
145
|
+
* ```wgsl
|
|
146
|
+
* fn gbuffer_laydown(coord: vec2<f32>) -> GBufferOutput
|
|
147
|
+
* ```
|
|
130
148
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
149
|
+
* `coord` is the pixel's centre in framebuffer coordinates — what a fragment's `position` holds.
|
|
150
|
+
*
|
|
151
|
+
* Every derivative it takes is analytic, from the barycentrics, except one: the specular
|
|
152
|
+
* anti-aliasing footprint, `fwidth` of the normal-mapped normal. That one the entry point supplies,
|
|
153
|
+
* by `derivatives`.
|
|
133
154
|
*
|
|
134
155
|
* @param {CodeChunk} surface defines `fn material_surface(s: MaterialSurfaceInput) -> MaterialSurfaceOutput`
|
|
156
|
+
* @param {CodeChunk} derivatives defines `fn gbuffer_fwidth(v: vec2<f32>) -> vec2<f32>`, `fwidth` as
|
|
157
|
+
* the stage can take it — {@link chunk_gbuffer_fwidth_fragment} in a fragment shader
|
|
135
158
|
* @returns {CodeChunk}
|
|
136
159
|
*/
|
|
137
|
-
export function
|
|
160
|
+
export function build_gbuffer_laydown(surface, derivatives) {
|
|
138
161
|
return CodeChunk.from(
|
|
139
162
|
// language=WGSL
|
|
140
163
|
`
|
|
@@ -145,18 +168,14 @@ struct GBufferOutput {
|
|
|
145
168
|
@location(3) emissive : u32,
|
|
146
169
|
}
|
|
147
170
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
@fragment
|
|
152
|
-
fn main(
|
|
153
|
-
@builtin(position) coord : vec4<f32>,
|
|
171
|
+
fn gbuffer_laydown(
|
|
172
|
+
coord : vec2<f32>,
|
|
154
173
|
) -> GBufferOutput {
|
|
155
174
|
var output : GBufferOutput;
|
|
156
175
|
|
|
157
176
|
let encoded_meshlet_triangle = textureLoad(
|
|
158
177
|
viz_buffer_triangle,
|
|
159
|
-
vec2<i32>(coord
|
|
178
|
+
vec2<i32>(coord),
|
|
160
179
|
0
|
|
161
180
|
).r;
|
|
162
181
|
|
|
@@ -166,7 +185,7 @@ fn main(
|
|
|
166
185
|
|
|
167
186
|
let mesh_index = textureLoad(
|
|
168
187
|
viz_buffer_mesh,
|
|
169
|
-
vec2<i32>(coord
|
|
188
|
+
vec2<i32>(coord),
|
|
170
189
|
0
|
|
171
190
|
).r;
|
|
172
191
|
|
|
@@ -211,7 +230,7 @@ fn main(
|
|
|
211
230
|
projected_vertex_position_0,
|
|
212
231
|
projected_vertex_position_1,
|
|
213
232
|
projected_vertex_position_2,
|
|
214
|
-
coord
|
|
233
|
+
coord
|
|
215
234
|
);
|
|
216
235
|
|
|
217
236
|
let position_ws = interpolate_attribute_3f32(
|
|
@@ -317,18 +336,21 @@ fn main(
|
|
|
317
336
|
surface_input.face_normal_ws = world_face_normal;
|
|
318
337
|
surface_input.view_direction_ws = view_direction;
|
|
319
338
|
surface_input.vertex_color = geometry_color;
|
|
320
|
-
surface_input.pixel = coord
|
|
339
|
+
surface_input.pixel = coord;
|
|
321
340
|
|
|
322
341
|
let surface = material_surface(surface_input);
|
|
323
342
|
|
|
324
343
|
// transform_global normal
|
|
325
344
|
let world_shading_normal:vec3<f32> = normalize( world_tangent_frame * surface.normal );
|
|
326
345
|
|
|
327
|
-
// let's filter rougness based on local normals
|
|
328
|
-
let filtered_roughness =
|
|
346
|
+
// let's filter rougness based on local normals, over the footprint the stage measures
|
|
347
|
+
let filtered_roughness = anti_alias_roughness_kaplanyan_footprint(
|
|
348
|
+
surface.roughness,
|
|
349
|
+
gbuffer_fwidth(kaplanyan_plane_half_vector(world_shading_normal, world_tangent_frame[0], world_tangent_frame[1]))
|
|
350
|
+
);
|
|
329
351
|
|
|
330
352
|
// apply dither
|
|
331
|
-
let output_roughness = filtered_roughness + dither_color_8bit_triangle_noise(coord
|
|
353
|
+
let output_roughness = filtered_roughness + dither_color_8bit_triangle_noise(coord);
|
|
332
354
|
|
|
333
355
|
output.albedo = vec4<f32>(
|
|
334
356
|
surface.albedo,
|
|
@@ -347,6 +369,7 @@ fn main(
|
|
|
347
369
|
return output;
|
|
348
370
|
}`, [
|
|
349
371
|
surface,
|
|
372
|
+
derivatives,
|
|
350
373
|
chunk_material_surface_contract,
|
|
351
374
|
|
|
352
375
|
chunk_mat4_extract_position,
|
|
@@ -359,7 +382,7 @@ fn main(
|
|
|
359
382
|
|
|
360
383
|
chunk_barycentric_interpolate_uv,
|
|
361
384
|
chunk_compute_normal_matrix_from_m4,
|
|
362
|
-
|
|
385
|
+
chunk_anti_alias_roughness_kaplanyan_footprint,
|
|
363
386
|
chunk_build_orthonormal_matrix_nt,
|
|
364
387
|
chunk_read_meshlet_triangle_vertices,
|
|
365
388
|
chunk_decode_meshlet_element,
|
|
@@ -367,12 +390,48 @@ fn main(
|
|
|
367
390
|
chunk_rgbe9995_encode,
|
|
368
391
|
chunk_dither_color_8bit_triangle_noise,
|
|
369
392
|
chunk_scene_database_access,
|
|
370
|
-
chunk_node3d_flags,
|
|
393
|
+
chunk_node3d_flags,
|
|
371
394
|
chunk_view_mip_bias,
|
|
372
395
|
]
|
|
373
396
|
);
|
|
374
397
|
}
|
|
375
398
|
|
|
399
|
+
/**
|
|
400
|
+
* `fn gbuffer_fwidth(v: vec2<f32>) -> vec2<f32>` for {@link build_gbuffer_laydown} in a fragment
|
|
401
|
+
* shader: the fragment's own `fwidth`, across its quad.
|
|
402
|
+
*
|
|
403
|
+
* @type {CodeChunk}
|
|
404
|
+
*/
|
|
405
|
+
export const chunk_gbuffer_fwidth_fragment = CodeChunk.from(
|
|
406
|
+
// language=WGSL
|
|
407
|
+
`
|
|
408
|
+
fn gbuffer_fwidth(v: vec2<f32>) -> vec2<f32> {
|
|
409
|
+
return fwidth(v);
|
|
410
|
+
}
|
|
411
|
+
`);
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The fragment entry of a template's G-buffer pipeline: {@link build_gbuffer_laydown} at the
|
|
415
|
+
* fragment's own pixel, which the material-depth mask has already narrowed to the material's.
|
|
416
|
+
*
|
|
417
|
+
* @param {CodeChunk} surface defines `fn material_surface(s: MaterialSurfaceInput) -> MaterialSurfaceOutput`
|
|
418
|
+
* @returns {CodeChunk}
|
|
419
|
+
*/
|
|
420
|
+
export function build_gbuffer_fragment_body(surface) {
|
|
421
|
+
return CodeChunk.from(
|
|
422
|
+
// language=WGSL
|
|
423
|
+
`
|
|
424
|
+
@fragment
|
|
425
|
+
fn main(
|
|
426
|
+
@builtin(position) coord : vec4<f32>,
|
|
427
|
+
) -> GBufferOutput {
|
|
428
|
+
return gbuffer_laydown(coord.xy);
|
|
429
|
+
}`, [
|
|
430
|
+
build_gbuffer_laydown(surface, chunk_gbuffer_fwidth_fragment),
|
|
431
|
+
]
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
376
435
|
/**
|
|
377
436
|
* The G-buffer pipeline of a template: its group 0 and surface function around the shared body,
|
|
378
437
|
* after the shared binding-free vertex stage.
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
* material built on it serves the G-buffer pass and both alpha-tested passes. Groups 1 and 2 belong
|
|
12
12
|
* to the passes, so a template must not reuse their names (`viz_buffer_triangle`, `viz_buffer_mesh`,
|
|
13
13
|
* `view`, `camera`, `scene_database`, `geometries`, `meshlets`, `meshlet_metadata`, `meshlet_data`,
|
|
14
|
-
* `materials`, `t_noise`)
|
|
14
|
+
* `materials`, `t_noise`) — nor those of the experimental compute material dispatch, which
|
|
15
|
+
* assembles a laydown of its own around {@link gbuffer_surface} (`material_quads`, `g_buffer_pbr`,
|
|
16
|
+
* `g_buffer_normal`, `g_buffer_albedo`, `g_buffer_emissive`, `material_dispatch`,
|
|
17
|
+
* `material_dispatch_places`).
|
|
15
18
|
*
|
|
16
19
|
* **The surface function** — `fn material_surface(s: MaterialSurfaceInput) -> MaterialSurfaceOutput`,
|
|
17
20
|
* see {@link chunk_material_surface_contract} — is all a template contributes to the G-buffer pass.
|
|
@@ -101,6 +104,15 @@ export class ShadeMaterialTemplate {
|
|
|
101
104
|
* @returns {RenderPipelineDescriptor}
|
|
102
105
|
*/
|
|
103
106
|
gbuffer_pipeline_descriptor(services: GPUMaterialServices): RenderPipelineDescriptor;
|
|
107
|
+
/**
|
|
108
|
+
* The surface function the template's G-buffer laydown runs, for a pass that assembles a
|
|
109
|
+
* laydown of its own around it — {@link surface}, unless the template builds one from what the
|
|
110
|
+
* services carry.
|
|
111
|
+
*
|
|
112
|
+
* @param {GPUMaterialServices} services
|
|
113
|
+
* @returns {CodeChunk} defines `material_surface`
|
|
114
|
+
*/
|
|
115
|
+
gbuffer_surface(services: GPUMaterialServices): CodeChunk;
|
|
104
116
|
/**
|
|
105
117
|
* Once, when the material's context is created and before its uniform is written: obtain what
|
|
106
118
|
* the bind group will name, and upload anything the template owns, so the first bind group
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShadeMaterialTemplate.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/material/template/ShadeMaterialTemplate.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"ShadeMaterialTemplate.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/material/template/ShadeMaterialTemplate.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAqEI;;;;;;;;;OASG;IACH;QAR2B,IAAI,EAApB,MAAM;QACiC,SAAS,EAAhD,6BAA6B;QACL,OAAO,EAA/B,SAAS,GAAC,IAAI;QACY,YAAY,GAAtC,UAAU,GAAC,IAAI;QACU,OAAO,GAAhC,SAAS,GAAC,IAAI;QACI,OAAO,GAAzB,OAAO;QACW,OAAO,GAAzB,OAAO;OAwBjB;IApGD;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAE5B;;OAEG;IACH,MAFU,MAAM,CAEX;IAEL;;;;OAIG;IACH,WAFU,6BAA6B,CAE7B;IAEV;;;;;;;OAOG;IACH,cAFU,UAAU,GAAC,IAAI,CAEL;IAEpB;;;;;OAKG;IACH,SAFU,SAAS,GAAC,IAAI,CAEhB;IAER;;;;OAIG;IACH,SAFU,SAAS,GAAC,IAAI,CAET;IAEf;;;;;OAKG;IACH,SAFU,OAAO,CAED;IAEhB;;;;;;OAMG;IACH,SAFU,OAAO,CAED;IAyChB;;;;;OAKG;IACH,sCAHW,mBAAmB,GACjB,wBAAwB,CAcpC;IAED;;;;;;;OAOG;IACH,0BAHW,mBAAmB,GACjB,SAAS,CAMrB;IAED;;;;;;;OAOG;IACH,WAHW,kBAAkB,YAClB,mBAAmB,QAG7B;IAED;;;;;;;;OAQG;IACH,wBANW,aAAa,uBAQvB;IAED;;;;;;;OAOG;IACH,yBAHW,aAAa,OAKvB;IAED;;;;;;OAMG;IACH,uBANW,kBAAkB,wCAGlB,mBAAmB,gBAK7B;IAED;;;;;;;OAOG;IACH,YALW,kBAAkB,YAClB,mBAAmB,GACjB,OAAO,CAKnB;IAED;;;;;OAKG;IACH,aAHW,kBAAkB,YAClB,mBAAmB,QAG7B;IAGL;;;OAGG;IACH,kCAFU,OAAO,CAEsC;;CANtD;uCA/OY,OAAO,iEAAiE,EAAE,wBAAwB;wBAClG,OAAO,oCAAoC,EAAE,SAAS;4CACtD,OAAO,wDAAwD,EAAE,6BAA6B;yBAC9F,OAAO,iCAAiC,EAAE,UAAU;iCACpD,OAAO,0BAA0B,EAAE,kBAAkB;4BACrD,OAAO,qBAAqB,EAAE,aAAa;kCAC3C,OAAO,0BAA0B,EAAE,mBAAmB"}
|
|
@@ -27,7 +27,10 @@ let ordinal_counter = 0;
|
|
|
27
27
|
* material built on it serves the G-buffer pass and both alpha-tested passes. Groups 1 and 2 belong
|
|
28
28
|
* to the passes, so a template must not reuse their names (`viz_buffer_triangle`, `viz_buffer_mesh`,
|
|
29
29
|
* `view`, `camera`, `scene_database`, `geometries`, `meshlets`, `meshlet_metadata`, `meshlet_data`,
|
|
30
|
-
* `materials`, `t_noise`)
|
|
30
|
+
* `materials`, `t_noise`) — nor those of the experimental compute material dispatch, which
|
|
31
|
+
* assembles a laydown of its own around {@link gbuffer_surface} (`material_quads`, `g_buffer_pbr`,
|
|
32
|
+
* `g_buffer_normal`, `g_buffer_albedo`, `g_buffer_emissive`, `material_dispatch`,
|
|
33
|
+
* `material_dispatch_places`).
|
|
31
34
|
*
|
|
32
35
|
* **The surface function** — `fn material_surface(s: MaterialSurfaceInput) -> MaterialSurfaceOutput`,
|
|
33
36
|
* see {@link chunk_material_surface_contract} — is all a template contributes to the G-buffer pass.
|
|
@@ -158,6 +161,20 @@ export class ShadeMaterialTemplate {
|
|
|
158
161
|
return this.#gbuffer_pipeline_descriptor;
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
/**
|
|
165
|
+
* The surface function the template's G-buffer laydown runs, for a pass that assembles a
|
|
166
|
+
* laydown of its own around it — {@link surface}, unless the template builds one from what the
|
|
167
|
+
* services carry.
|
|
168
|
+
*
|
|
169
|
+
* @param {GPUMaterialServices} services
|
|
170
|
+
* @returns {CodeChunk} defines `material_surface`
|
|
171
|
+
*/
|
|
172
|
+
gbuffer_surface(services) {
|
|
173
|
+
assert.notNull(this.surface, `template '${this.name}' has no surface function`);
|
|
174
|
+
|
|
175
|
+
return this.surface;
|
|
176
|
+
}
|
|
177
|
+
|
|
161
178
|
/**
|
|
162
179
|
* Once, when the material's context is created and before its uniform is written: obtain what
|
|
163
180
|
* the bind group will name, and upload anything the template owns, so the first bind group
|
|
@@ -51,7 +51,7 @@ export class NSS {
|
|
|
51
51
|
* @returns {number}
|
|
52
52
|
*/
|
|
53
53
|
static recommended_jitter_sequence_size(upscale_ratio: number): number;
|
|
54
|
-
static "__#
|
|
54
|
+
static "__#214@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
|
|
55
55
|
/**
|
|
56
56
|
* @param {GraphicsContext} graphics
|
|
57
57
|
*/
|
|
@@ -155,6 +155,12 @@ export class GPUSceneContext {
|
|
|
155
155
|
* dataset ({@link Scene.dataset}) before this is first asked for, because the rows are written
|
|
156
156
|
* from that dataset's components.
|
|
157
157
|
*
|
|
158
|
+
* The rows are the entities of the dataset the scene names when they are asked for. Once it
|
|
159
|
+
* names another, the next ask moves them there — the same rows, taking the next dataset's
|
|
160
|
+
* entities — and every holder must have let go of the last dataset's by then: their ids are
|
|
161
|
+
* the next one's too. While the scene names none, the rows stay the last dataset's, which is
|
|
162
|
+
* what its holders let go of.
|
|
163
|
+
*
|
|
158
164
|
* @returns {GPUSceneRows}
|
|
159
165
|
*/
|
|
160
166
|
get rows(): GPUSceneRows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QASzB;
|
|
1
|
+
{"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QASzB;IA4KD;;;;OAIG;IACH,sBAHW,eAAe,SACf,KAAK,EAyCf;IAtND;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAGV;;OAEG;IACH,sBAFU,cAAc,CAEH;IASrB;;;OAGG;IACH,mBAEC;IAOD,uCAEC;IAOD;;;;;OAKG;IACH,yBAEC;IAUD;;;;;OAKG;IACH,kBAEC;IAQD;;;OAGG;IACH,iCAEC;IAOD;;;OAGG;IACH,8CAEC;IAOD;;;OAGG;IACH,8CAEC;IA2ID;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,gDAEC;IAED;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,+CAEC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAH0C,SAAS,GAAxC,oBAAoB;QAClB,yBAAyB,CA4DrC;IAED;;OAEG;IACH,6CAEC;IAYD;;;OAGG;IACH,kCAEC;IAED;;;;;OAKG;IACH,uCAEC;IAED;;;;;;;;;;;OAWG;IACH,uCAUC;IAED,+BAUC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAEC;IAED;;;;;OAKG;IACH,sCAMC;IAOD;;;;;;;OAOG;IACH,8EAEC;IA6BD;;;;;OAKG;IACH,cAsEC;IAED;;;OAGG;IACH,YAFW,eAAe,QA2BzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAHW,sBAAsB,cACtB,MAAM,QAuBhB;IAUD;;;;;;;;;;;OAWG;IACH,oBAHW,UAAU,GACR,MAAM,CAQlB;IAoCD;;;;;;;OAOG;IACH,gBAuBC;IAwCL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;8BAx2BY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;iCAC/C,OAAO,mCAAmC,EAAE,kBAAkB;iCAC9D,OAAO,mCAAmC,EAAE,kBAAkB;4BAC9D,OAAO,8BAA8B,EAAE,aAAa;8BACpD,OAAO,iDAAiD,EAAE,eAAe;yBACzE,OAAO,2DAA2D,EAAE,UAAU;+BA5B5D,iDAAiD;sBAM1D,YAAY;oCAFE,uCAAuC;6BAC9C,yBAAyB;uBAH/B,yBAAyB;mCACb,gCAAgC;oCAF/B,mDAAmD;kDAMrC,wCAAwC;0CAlBhD,0DAA0D;8BAItE,8CAA8C;iCAF3C,iDAAiD;+BAInD,2CAA2C;qCADrC,qDAAqD;oCAItD,qCAAqC;4BAC7C,gCAAgC;uCASrB,iDAAiD;6BAQ3D,wBAAwB;wCADb,mCAAmC;uCAlBpC,wCAAwC"}
|
|
@@ -235,7 +235,8 @@ export class GPUSceneContext {
|
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
237
|
* Entities as rows of {@link scene_database} — see {@link rows}. Built the first time it is
|
|
238
|
-
* asked for, which needs the scene to name its dataset by then
|
|
238
|
+
* asked for, which needs the scene to name its dataset by then, and moved to whichever dataset
|
|
239
|
+
* the scene names after.
|
|
239
240
|
*
|
|
240
241
|
* @type {GPUSceneRows|null}
|
|
241
242
|
*/
|
|
@@ -547,6 +548,12 @@ export class GPUSceneContext {
|
|
|
547
548
|
* dataset ({@link Scene.dataset}) before this is first asked for, because the rows are written
|
|
548
549
|
* from that dataset's components.
|
|
549
550
|
*
|
|
551
|
+
* The rows are the entities of the dataset the scene names when they are asked for. Once it
|
|
552
|
+
* names another, the next ask moves them there — the same rows, taking the next dataset's
|
|
553
|
+
* entities — and every holder must have let go of the last dataset's by then: their ids are
|
|
554
|
+
* the next one's too. While the scene names none, the rows stay the last dataset's, which is
|
|
555
|
+
* what its holders let go of.
|
|
556
|
+
*
|
|
550
557
|
* @returns {GPUSceneRows}
|
|
551
558
|
*/
|
|
552
559
|
get rows() {
|
|
@@ -588,9 +595,10 @@ export class GPUSceneContext {
|
|
|
588
595
|
* @returns {GPUSceneRows}
|
|
589
596
|
*/
|
|
590
597
|
#obtain_rows() {
|
|
591
|
-
|
|
592
|
-
|
|
598
|
+
const dataset = this.#scene.dataset;
|
|
599
|
+
const rows = this.#rows;
|
|
593
600
|
|
|
601
|
+
if (rows === null) {
|
|
594
602
|
assert.notNull(dataset, 'the scene names no dataset — set Scene.dataset before asking for its rows');
|
|
595
603
|
assert.defined(dataset, 'the scene names no dataset — set Scene.dataset before asking for its rows');
|
|
596
604
|
|
|
@@ -603,6 +611,8 @@ export class GPUSceneContext {
|
|
|
603
611
|
tlas: this.#tlas,
|
|
604
612
|
skinning: () => this.skinning,
|
|
605
613
|
});
|
|
614
|
+
} else if (dataset !== rows.dataset && dataset !== null && dataset !== undefined) {
|
|
615
|
+
rows.bind(dataset);
|
|
606
616
|
}
|
|
607
617
|
|
|
608
618
|
return this.#rows;
|
|
@@ -621,10 +631,10 @@ export class GPUSceneContext {
|
|
|
621
631
|
this.#root_written = true;
|
|
622
632
|
}
|
|
623
633
|
|
|
624
|
-
// Entities are rows — marked by the systems that place them, written here.
|
|
625
|
-
// because the scene may name its dataset after this context was made.
|
|
626
|
-
if (this.#
|
|
627
|
-
this
|
|
634
|
+
// Entities are rows — marked by the systems that place them, written here. Obtained on demand
|
|
635
|
+
// because the scene may name its dataset, or another one, after this context was made.
|
|
636
|
+
if (this.#scene.dataset !== null && this.#scene.dataset !== undefined) {
|
|
637
|
+
this.#obtain_rows();
|
|
628
638
|
}
|
|
629
639
|
|
|
630
640
|
if (this.#rows !== null) {
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export class Scene {
|
|
14
14
|
/**
|
|
15
|
-
* The dataset whose entities are this scene's rows
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The dataset whose entities are this scene's rows, one at a time. Whoever owns both names it
|
|
16
|
+
* here, before anything asks the scene's GPU context for its rows. Naming another moves the
|
|
17
|
+
* rows to it at the context's next ask, once everything placed from the last one has been let
|
|
18
|
+
* go: entity ids repeat across datasets. Null for a scene that draws nothing, and between two.
|
|
18
19
|
*
|
|
19
20
|
* @type {EntityComponentDataset|null}
|
|
20
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/Scene.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACI
|
|
1
|
+
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/Scene.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;OAOG;IACH,SAFU,sBAAsB,GAAC,IAAI,CAEtB;IAEf;;;;;OAKG;IACH,QAFU,eAAe,CAEM;IAE/B;;;OAGG;IACH,oBAFU,gBAAgB,CAEkB;IAE5C;;;OAGG;IACH,aAFU,gBAAgB,CAEW;IAGzC;;;OAGG;IACH,kBAFU,OAAO,CAEM;CANtB;qCA1CY,OAAO,+CAA+C,EAAE,sBAAsB;gCAJ3D,6BAA6B;iCAD5B,gDAAgD;iCAEhD,oCAAoC"}
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { LightProbeVolume } from "../global_illumination/lpv/LightProbeVolume.js";
|
|
2
|
-
import { LightCollection } from "../light/LightCollection.js";
|
|
3
|
-
import { SceneVolumetrics } from "../volumetrics/SceneVolumetrics.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import("../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset} EntityComponentDataset
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A scene: the dataset whose entities are what it draws and poses, and the three things that are
|
|
11
|
-
* not entities — its lights' collection, a light probe volume, volumetrics.
|
|
12
|
-
*
|
|
13
|
-
* Everything drawn is an entity of {@link dataset} holding a row of the scene's GPU database
|
|
14
|
-
* (`GPUSceneContext.rows`), at `entity + 1`. A game's systems take rows as components appear; a
|
|
15
|
-
* scene with no systems places a model with `prefab_place`, a primitive with `place_primitive`
|
|
16
|
-
* and a light with `place_light`. Nothing is added to the scene itself.
|
|
17
|
-
*/
|
|
18
|
-
export class Scene {
|
|
19
|
-
/**
|
|
20
|
-
* The dataset whose entities are this scene's rows
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import { LightProbeVolume } from "../global_illumination/lpv/LightProbeVolume.js";
|
|
2
|
+
import { LightCollection } from "../light/LightCollection.js";
|
|
3
|
+
import { SceneVolumetrics } from "../volumetrics/SceneVolumetrics.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import("../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset} EntityComponentDataset
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A scene: the dataset whose entities are what it draws and poses, and the three things that are
|
|
11
|
+
* not entities — its lights' collection, a light probe volume, volumetrics.
|
|
12
|
+
*
|
|
13
|
+
* Everything drawn is an entity of {@link dataset} holding a row of the scene's GPU database
|
|
14
|
+
* (`GPUSceneContext.rows`), at `entity + 1`. A game's systems take rows as components appear; a
|
|
15
|
+
* scene with no systems places a model with `prefab_place`, a primitive with `place_primitive`
|
|
16
|
+
* and a light with `place_light`. Nothing is added to the scene itself.
|
|
17
|
+
*/
|
|
18
|
+
export class Scene {
|
|
19
|
+
/**
|
|
20
|
+
* The dataset whose entities are this scene's rows, one at a time. Whoever owns both names it
|
|
21
|
+
* here, before anything asks the scene's GPU context for its rows. Naming another moves the
|
|
22
|
+
* rows to it at the context's next ask, once everything placed from the last one has been let
|
|
23
|
+
* go: entity ids repeat across datasets. Null for a scene that draws nothing, and between two.
|
|
24
|
+
*
|
|
25
|
+
* @type {EntityComponentDataset|null}
|
|
26
|
+
*/
|
|
27
|
+
dataset = null;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Each light at an entity of {@link dataset} — `lights.add(light, entity)`, or `place_light`
|
|
31
|
+
* for a caller with no entity of its own.
|
|
32
|
+
*
|
|
33
|
+
* @type {LightCollection}
|
|
34
|
+
*/
|
|
35
|
+
lights = new LightCollection();
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {LightProbeVolume}
|
|
40
|
+
*/
|
|
41
|
+
light_probe_volume = new LightProbeVolume();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {SceneVolumetrics}
|
|
46
|
+
*/
|
|
47
|
+
volumetrics = new SceneVolumetrics();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @readonly
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
*/
|
|
54
|
+
Scene.prototype.isScene = true;
|
|
@@ -39,6 +39,9 @@ export function entity_of_row(row: number): number;
|
|
|
39
39
|
* root, which is exact because the ECS composes every chain on the CPU regardless. A primitive
|
|
40
40
|
* {@link attach_mesh}es and takes the `meshes` row of the same index.
|
|
41
41
|
*
|
|
42
|
+
* **The entities are one dataset's at a time.** {@link bind} moves the rows to another once nothing
|
|
43
|
+
* of the last is held; the same object carries on, so whatever listens to it keeps listening.
|
|
44
|
+
*
|
|
42
45
|
* **Change flow is mark, then flush.** The systems that place entities listen to the dataset's
|
|
43
46
|
* change events and {@link mark_local} or {@link mark_world}; nothing is read at mark time. The
|
|
44
47
|
* flush, in `GPUSceneContext.build`, reads each marked entity's components once, consults
|
|
@@ -81,9 +84,22 @@ export class GPUSceneRows {
|
|
|
81
84
|
skinning: () => GPUMeshSkinningContext;
|
|
82
85
|
});
|
|
83
86
|
/**
|
|
87
|
+
* The dataset whose entities the rows are — see {@link bind}.
|
|
88
|
+
*
|
|
84
89
|
* @returns {EntityComponentDataset}
|
|
85
90
|
*/
|
|
86
91
|
get dataset(): import("../../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset;
|
|
92
|
+
/**
|
|
93
|
+
* Write the rows from another dataset's entities from now on.
|
|
94
|
+
*
|
|
95
|
+
* Only while nothing is held. Entity ids come out of each dataset's own pool, so a hold carried
|
|
96
|
+
* across would be the next dataset's entity of the same id — merged with its holds, and taking
|
|
97
|
+
* its row when released. Every holder lets go of the last dataset first, and the rows they gave
|
|
98
|
+
* back are already off the tables.
|
|
99
|
+
*
|
|
100
|
+
* @param {EntityComponentDataset} dataset
|
|
101
|
+
*/
|
|
102
|
+
bind(dataset: EntityComponentDataset): void;
|
|
87
103
|
/**
|
|
88
104
|
* Bumped every time the `meshes` table gains or loses an entity's row. A row read and kept is
|
|
89
105
|
* only as valid as this number.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUSceneRows.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/scene/rows/GPUSceneRows.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AACH,sCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;GAMG;AACH,mCAHW,MAAM,GACJ,MAAM,CAIlB;AAqMD
|
|
1
|
+
{"version":3,"file":"GPUSceneRows.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/scene/rows/GPUSceneRows.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AACH,sCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;GAMG;AACH,mCAHW,MAAM,GACJ,MAAM,CAIlB;AAqMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;IA2II;;;;;;;;;OASG;IACH;QAR2C,OAAO,EAAvC,sBAAsB;QACC,UAAU;QACV,MAAM;QACD,UAAU,EAAtC,kBAAkB;QACU,SAAS,EAArC,kBAAkB;QACyB,IAAI,EAA/C,iCAAiC;QACW,QAAQ,QAAxC,sBAAsB;OAmB5C;IAED;;;;OAIG;IACH,iGAEC;IAED;;;;;;;;;OASG;IACH,cAFW,sBAAsB,QAmBhC;IAED;;;;;OAKG;IACH,gCAEC;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;OAQG;IACH,oBAA8B;IAE9B;;;;;;;;;;;OAWG;IACH,mBAA6B;IAE7B;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;OAWG;IACH,8BAHoB,MAAM,QAAE,eAAe,QAAE,aAAa,QAAE,OAAO,QAAE,MAAM,KAAG,IAAI,QASjF;IAED;;;;;;;;;OASG;IACH,6BAHW,KAAK,GACH,OAAO,CAyBnB;IAED;;;;;;;;;;;;;OAaG;IACH,gBAFW,MAAM,QA0ChB;IAED;;;;;;;;OAQG;IACH,gBAFW,MAAM,QA4BhB;IAED;;;;OAIG;IACH,mBAFW,MAAM,QAIhB;IAED;;;;;;;;;;;;;OAaG;IACH,sBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,mBAFW,MAAM,QAIhB;IA4BD;;;;;OAKG;IACH,2EAOC;IAED;;;;OAIG;IACH,gCAEC;IAqCD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oBANW,MAAM,YACN,eAAe,YACf,aAAa,YACb,OAAO,cACP,OAAO,QAkDjB;IAED;;;;;OAKG;IACH,oBAFW,MAAM,QAUhB;IAwCD;;;;OAIG;IACH,SAFa,MAAM,CAsDlB;IAgOD;;;;OAIG;IACH;;;;;;;;OAQG;IACH,4BAHW,MAAM,kBACG,MAAM,KAAG,IAAI,QAiBhC;IAyGD;;;;;;;;;OASG;IACH,gBAgBC;;CACJ;qCAn1CY,OAAO,kDAAkD,EAAE,sBAAsB;;iCAEjF,OAAO,sCAAsC,EAAE,kBAAkB;iCACjE,OAAO,sCAAsC,EAAE,kBAAkB;gDACjE,OAAO,yCAAyC,EAAE,iCAAiC;qCACnF,OAAO,oDAAoD,EAAE,sBAAsB;8BACnF,OAAO,mCAAmC,EAAE,eAAe;4BAC3D,OAAO,iCAAiC,EAAE,aAAa;oBACvD,OAAO,wCAAwC,EAAE,KAAK"}
|
|
@@ -260,6 +260,9 @@ function mesh_entry_flags(entry) {
|
|
|
260
260
|
* root, which is exact because the ECS composes every chain on the CPU regardless. A primitive
|
|
261
261
|
* {@link attach_mesh}es and takes the `meshes` row of the same index.
|
|
262
262
|
*
|
|
263
|
+
* **The entities are one dataset's at a time.** {@link bind} moves the rows to another once nothing
|
|
264
|
+
* of the last is held; the same object carries on, so whatever listens to it keeps listening.
|
|
265
|
+
*
|
|
263
266
|
* **Change flow is mark, then flush.** The systems that place entities listen to the dataset's
|
|
264
267
|
* change events and {@link mark_local} or {@link mark_world}; nothing is read at mark time. The
|
|
265
268
|
* flush, in `GPUSceneContext.build`, reads each marked entity's components once, consults
|
|
@@ -450,12 +453,43 @@ export class GPUSceneRows {
|
|
|
450
453
|
}
|
|
451
454
|
|
|
452
455
|
/**
|
|
456
|
+
* The dataset whose entities the rows are — see {@link bind}.
|
|
457
|
+
*
|
|
453
458
|
* @returns {EntityComponentDataset}
|
|
454
459
|
*/
|
|
455
460
|
get dataset() {
|
|
456
461
|
return this.#dataset;
|
|
457
462
|
}
|
|
458
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Write the rows from another dataset's entities from now on.
|
|
466
|
+
*
|
|
467
|
+
* Only while nothing is held. Entity ids come out of each dataset's own pool, so a hold carried
|
|
468
|
+
* across would be the next dataset's entity of the same id — merged with its holds, and taking
|
|
469
|
+
* its row when released. Every holder lets go of the last dataset first, and the rows they gave
|
|
470
|
+
* back are already off the tables.
|
|
471
|
+
*
|
|
472
|
+
* @param {EntityComponentDataset} dataset
|
|
473
|
+
*/
|
|
474
|
+
bind(dataset) {
|
|
475
|
+
assert.defined(dataset, 'dataset');
|
|
476
|
+
assert.equal(dataset.isEntityComponentDataset, true, 'dataset.isEntityComponentDataset !== true');
|
|
477
|
+
|
|
478
|
+
if (dataset === this.#dataset) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
assert.equal(
|
|
483
|
+
this.#acquired.nextSetBit(0), -1,
|
|
484
|
+
'rows of the last dataset are still held — every holder lets go of it before the rows take the next'
|
|
485
|
+
);
|
|
486
|
+
|
|
487
|
+
// what is left are entities released since they were marked, which the flush would skip
|
|
488
|
+
this.#marked.length = 0;
|
|
489
|
+
|
|
490
|
+
this.#dataset = dataset;
|
|
491
|
+
}
|
|
492
|
+
|
|
459
493
|
/**
|
|
460
494
|
* Bumped every time the `meshes` table gains or loses an entity's row. A row read and kept is
|
|
461
495
|
* only as valid as this number.
|
package/src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.d.ts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Kaplanyan's roughness filtering, given the screen-space footprint of the plane-plane half vector
|
|
3
|
+
* rather than taking it — so a stage without implicit derivatives can hand in its own.
|
|
4
|
+
*
|
|
5
|
+
* ```wgsl
|
|
6
|
+
* fn kaplanyan_plane_half_vector(normal: vec3<f32>, tangent: vec3<f32>, bitangent: vec3<f32>) -> vec2<f32>
|
|
7
|
+
* fn anti_alias_roughness_kaplanyan_footprint(roughness: f32, footprint_bounding_box: vec2<f32>) -> f32
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `footprint_bounding_box` is `fwidth` of the half vector, as {@link chunk_anti_alias_roughness_kaplanyan}
|
|
11
|
+
* takes it.
|
|
12
|
+
*
|
|
2
13
|
* @param sigma screen space variance
|
|
3
14
|
* @param Kappa clamping treshold
|
|
4
15
|
* @see "Filtering Distributions of Normals for Shading Antialiasing" by A.S. Kaplanyan et al (NVIDIA) 2016, Eurographics Proceedings
|
|
5
16
|
* @see https://github.com/tksuoran/erhe/blob/57734a5ae170aa2a50c3068fe19ffc3a667c52d0/src/editor/res/shaders/circular_brushed_metal.frag#L53
|
|
6
17
|
* @type {CodeChunk}
|
|
7
18
|
*/
|
|
19
|
+
export const chunk_anti_alias_roughness_kaplanyan_footprint: CodeChunk;
|
|
20
|
+
/**
|
|
21
|
+
* Kaplanyan's roughness filtering with the footprint from the fragment's own `fwidth` — fragment
|
|
22
|
+
* stage only.
|
|
23
|
+
*
|
|
24
|
+
* @see chunk_anti_alias_roughness_kaplanyan_footprint
|
|
25
|
+
* @type {CodeChunk}
|
|
26
|
+
*/
|
|
8
27
|
export const chunk_anti_alias_roughness_kaplanyan: CodeChunk;
|
|
9
28
|
import { CodeChunk } from "../../../compiler/CodeChunk.js";
|
|
10
29
|
//# sourceMappingURL=chunk_anti_alias_roughness_kaplanyan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_anti_alias_roughness_kaplanyan.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,mDAFU,SAAS,
|
|
1
|
+
{"version":3,"file":"chunk_anti_alias_roughness_kaplanyan.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/geometry/normal/chunk_anti_alias_roughness_kaplanyan.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,6DAFU,SAAS,CAoCf;AAEJ;;;;;;GAMG;AACH,mDAFU,SAAS,CAkBhB;0BA/EuB,gCAAgC"}
|