@woosh/meep-engine 3.10.0 → 3.11.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/README.md +168 -152
- package/package.json +1 -1
- package/src/REVIEW_2026_08_06.md +610 -610
- package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/ConvexHullShape3D.js +28 -4
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +26 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/FrameGraph.js +47 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +0 -3
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +0 -3
- package/src/shade/device/ShadeGPUCommandContext.d.ts +21 -0
- package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
- package/src/shade/device/ShadeGPUCommandContext.js +940 -749
- package/src/shade/device/timing/GPUTimerArray.d.ts +22 -4
- package/src/shade/device/timing/GPUTimerArray.d.ts.map +1 -1
- package/src/shade/device/timing/GPUTimerArray.js +88 -14
- package/src/shade/device/timing/GPU_PROFILER_PROPOSAL_2026_08_28.md +349 -98
- package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts +93 -0
- package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUFrameRecorder.js +297 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.d.ts +62 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.js +77 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.d.ts +73 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.js +88 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.d.ts +20 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.js +50 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.d.ts +63 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.js +73 -0
- package/src/shade/device/timing/profile/GPUProfileSession.d.ts +173 -0
- package/src/shade/device/timing/profile/GPUProfileSession.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSession.js +470 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.d.ts +60 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.js +65 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts +19 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.js +25 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.d.ts +159 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.js +202 -0
- package/src/shade/device/timing/profile/GPUProfileWork.d.ts +90 -0
- package/src/shade/device/timing/profile/GPUProfileWork.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileWork.js +115 -0
- package/src/shade/device/timing/profile/SGPTDefect.d.ts +43 -0
- package/src/shade/device/timing/profile/SGPTDefect.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTDefect.js +65 -0
- package/src/shade/device/timing/profile/SGPTHeader.d.ts +38 -0
- package/src/shade/device/timing/profile/SGPTHeader.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTHeader.js +46 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.d.ts +37 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.js +45 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.d.ts +103 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.js +287 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts +19 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.js +26 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.d.ts +8 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.js +15 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT.md +345 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts +10 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.js +9 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts +17 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.js +16 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts +16 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.js +15 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts +15 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.js +29 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.js +6 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.js +6 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts +16 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.js +15 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.js +6 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts +13 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.js +23 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts +12 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.js +11 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts +18 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.js +46 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts +20 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts.map +1 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.js +174 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts +21 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts.map +1 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.js +114 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.d.ts +20 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.d.ts.map +1 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.js +43 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.d.ts +18 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.js +34 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts +42 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.js +172 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts +20 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.js +65 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.d.ts +19 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.js +134 -0
- package/src/shade/device/timing/profile/sgpt_read_header.d.ts +22 -0
- package/src/shade/device/timing/profile/sgpt_read_header.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_header.js +94 -0
- package/src/shade/device/timing/profile/sgpt_read_records.d.ts +27 -0
- package/src/shade/device/timing/profile/sgpt_read_records.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_records.js +153 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts +54 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.js +329 -0
- package/src/shade/device/timing/profile/sgpt_write_header.d.ts +22 -0
- package/src/shade/device/timing/profile/sgpt_write_header.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_write_header.js +47 -0
- package/src/shade/device/timing/profile/sgpt_write_record.d.ts +23 -0
- package/src/shade/device/timing/profile/sgpt_write_record.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_write_record.js +62 -0
- package/src/shade/playground/volumetrics_froxel/README.md +88 -0
- package/src/shade/playground/volumetrics_froxel/index.html +251 -0
- package/src/shade/playground/volumetrics_froxel/main.d.ts +2 -0
- package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -0
- package/src/shade/playground/volumetrics_froxel/main.js +619 -0
- package/src/shade/renderer/Renderer.d.ts +34 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +2536 -2455
- package/src/shade/renderer/volumetrics/NOTES.md +42 -1
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.d.ts +21 -0
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_camera_ray_planar_depth_scale.js +47 -0
- package/src/shade/renderer/volumetrics/chunk_integrate_optical_depth.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/chunk_integrate_optical_depth.js +19 -8
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.d.ts +37 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_content_offset.js +56 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +6 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +367 -324
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +14 -3
- package/src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.js +48 -36
- package/src/engine/save/GameStateLoader.d.ts +0 -49
- package/src/engine/save/GameStateLoader.d.ts.map +0 -1
- package/src/engine/save/GameStateLoader.js +0 -168
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_volumetrics_build_scattering_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_volumetrics_build_scattering_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js"],"names":[],"mappings":"AAgQA,oEAIG;8BA3P2B,4BAA4B"}
|
|
@@ -19,6 +19,7 @@ import { chunk_directional_lights_iteration_mask } from "../shader/chunk/light/i
|
|
|
19
19
|
import { chunk_get_directional_light_info_by_index } from "../shader/chunk/light/io/chunk_get_directional_light_info_by_index.js";
|
|
20
20
|
import { chunk_sky_lut_compute_uv } from "../atmosphere/chunk_sky_lut_compute_uv.js";
|
|
21
21
|
import { chunk_calculate_multiscattering } from "./chunk_calculate_multiscattering.js";
|
|
22
|
+
import { chunk_camera_ray_planar_depth_scale } from "./chunk_camera_ray_planar_depth_scale.js";
|
|
22
23
|
import { PARTICIPATING_MEDIA_VOLUME_STRUCT } from "./PARTICIPATING_MEDIA_VOLUME_STRUCT.js";
|
|
23
24
|
import { SCENE_VOLUMETRICS_METADATA_STRUCT } from "./SCENE_VOLUMETRICS_METADATA_STRUCT.js";
|
|
24
25
|
|
|
@@ -145,6 +146,14 @@ fn main(
|
|
|
145
146
|
var inScatter = vec3<f32>(0.0);
|
|
146
147
|
var throughput = vec3<f32>(1.0);
|
|
147
148
|
|
|
149
|
+
// Every t below is a PLANAR view-space depth off the froxel curve, but the loop uses their
|
|
150
|
+
// difference as a segment length in Beer's law and walks them along a unit ray to place world
|
|
151
|
+
// positions. Both want arc length, which is longer by 1/cos(theta). Uncorrected, the optical
|
|
152
|
+
// path is under-integrated by cos(theta) and fog thins toward the frame edges.
|
|
153
|
+
//
|
|
154
|
+
// Constant for the whole column, so this is one reciprocal per invocation rather than per slice.
|
|
155
|
+
let depth_to_distance = camera_ray_planar_depth_scale(view_ray.direction, camera);
|
|
156
|
+
|
|
148
157
|
// start at the near plane
|
|
149
158
|
var t_prev = camera_near_far.x;
|
|
150
159
|
|
|
@@ -154,7 +163,7 @@ fn main(
|
|
|
154
163
|
|
|
155
164
|
// in-scatter (.rgb) and the TAA-accumulated mono extinction coefficient (.a) now share the
|
|
156
165
|
// volume-lighting texture, so a single sample provides both.
|
|
157
|
-
let vl_start = far_sample_lighting(camera_near_far.x, uvw_start, view_ray.origin + view_ray.direction * camera_near_far.x, view_ray.direction);
|
|
166
|
+
let vl_start = far_sample_lighting(camera_near_far.x, uvw_start, view_ray.origin + view_ray.direction * (camera_near_far.x * depth_to_distance), view_ray.direction);
|
|
158
167
|
var light_prev = vl_start.rgb;
|
|
159
168
|
var extinction_prev = vl_start.a;
|
|
160
169
|
|
|
@@ -187,12 +196,13 @@ fn main(
|
|
|
187
196
|
f32(resolution.z)
|
|
188
197
|
));
|
|
189
198
|
|
|
190
|
-
|
|
199
|
+
// planar depth difference -> arc length along the view ray (C-01b)
|
|
200
|
+
let dt = max(0.0, t_next - t_prev) * depth_to_distance;
|
|
191
201
|
|
|
192
202
|
// 2. Fetch "Next" Value (The end of this segment)
|
|
193
203
|
let uvw_next = vec3<f32>(tile_uv, next_index_dithered / f32(resolution.z));
|
|
194
204
|
|
|
195
|
-
let world_pos_next = view_ray.origin + view_ray.direction * t_next;
|
|
205
|
+
let world_pos_next = view_ray.origin + view_ray.direction * (t_next * depth_to_distance);
|
|
196
206
|
let vl_next = far_sample_lighting(t_next, uvw_next, world_pos_next, view_ray.direction);
|
|
197
207
|
let media_extinction = vl_next.a;
|
|
198
208
|
let light_next = vl_next.rgb;
|
|
@@ -236,6 +246,7 @@ fn main(
|
|
|
236
246
|
chunk_cluster_depth_to_z_slice,
|
|
237
247
|
chunk_stbn_sample_vec3,
|
|
238
248
|
chunk_camera_ray_from_uv,
|
|
249
|
+
chunk_camera_ray_planar_depth_scale,
|
|
239
250
|
chunk_directional_lights_iteration_mask,
|
|
240
251
|
chunk_get_directional_light_info_by_index,
|
|
241
252
|
chunk_sky_lut_compute_uv,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetrics_position_world_to_froxel_uvw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumetrics_position_world_to_froxel_uvw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/volumetrics_position_world_to_froxel_uvw.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,uDAFU,SAAS,CAyClB;0BA/CyB,iCAAiC"}
|
|
@@ -1,37 +1,49 @@
|
|
|
1
|
-
import { chunk_ndc_to_uv } from "../shader/chunk/texture/chunk_ndc_to_uv.js";
|
|
2
|
-
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import { chunk_ndc_to_uv } from "../shader/chunk/texture/chunk_ndc_to_uv.js";
|
|
2
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
3
|
+
import { chunk_volumetrics_froxel_content_offset } from "./chunk_volumetrics_froxel_content_offset.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NOTE: we don't clamp final slice coordinate, this is intentional, we let the linear texture sampler take care of that.
|
|
7
|
+
* See {@link build_light_cluster_parameters}
|
|
8
|
+
* @type {CodeChunk}
|
|
9
|
+
*/
|
|
10
|
+
export const volumetrics_position_world_to_froxel_uvw = CodeChunk.from(
|
|
11
|
+
//language=WGSL
|
|
12
|
+
`
|
|
13
|
+
fn volumetrics_position_world_to_froxel_uvw(
|
|
14
|
+
position_ws: vec3<f32>
|
|
15
|
+
) -> vec3<f32>{
|
|
16
|
+
|
|
17
|
+
let position_vs = camera.view_matrix * vec4(position_ws, 1.0);
|
|
18
|
+
let position_clip = camera.projection_matrix * position_vs;
|
|
19
|
+
|
|
20
|
+
let uv = ndc_to_uv(position_clip.xy / position_clip.w);
|
|
21
|
+
|
|
22
|
+
let view_depth = -position_vs.z;
|
|
23
|
+
|
|
24
|
+
// froxel_cluster_parameters, NOT cluster_parameters: this addresses the FROXEL grid, which the
|
|
25
|
+
// participating-media pass builds on that curve. cluster_parameters is the aerial LUT's. The
|
|
26
|
+
// two are identical while froxel_far is unset — which is why the mix-up went unnoticed — and
|
|
27
|
+
// diverge as soon as the grid is packed into a shorter range.
|
|
28
|
+
let cluster_parameters = volumetrics_metadata.froxel_cluster_parameters;
|
|
29
|
+
|
|
30
|
+
// see 'cluster_depth_to_z_slice' for explanation
|
|
31
|
+
let slice_position:f32 = log2(fma(view_depth, cluster_parameters.x, cluster_parameters.y)) * cluster_parameters.z;
|
|
32
|
+
|
|
33
|
+
// A cell-averaged grid: texel k holds the slab [k+j, k+1+j], not the point at slice k, so the
|
|
34
|
+
// texel-centre convention alone reads about half a froxel too far out. See
|
|
35
|
+
// chunk_volumetrics_froxel_content_offset for where the ~0.53 comes from.
|
|
36
|
+
let content_offset = volumetrics_froxel_content_offset(cluster_parameters.z);
|
|
37
|
+
|
|
38
|
+
let w = (slice_position + 0.5 - content_offset) / f32(volumetrics_metadata.resolution.z);
|
|
39
|
+
|
|
40
|
+
return vec3(
|
|
41
|
+
uv,
|
|
42
|
+
w
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
`, [
|
|
46
|
+
chunk_ndc_to_uv,
|
|
47
|
+
chunk_volumetrics_froxel_content_offset,
|
|
48
|
+
]
|
|
37
49
|
)
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export default GameStateLoader;
|
|
2
|
-
declare class GameStateLoader extends EnginePlugin {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @type {Storage}
|
|
6
|
-
*/
|
|
7
|
-
storage: Storage;
|
|
8
|
-
startup(): Promise<void>;
|
|
9
|
-
save(name: any, resolve: any, reject: any, progress: any): void;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
* @param {string} name
|
|
13
|
-
* @param {function} resolve
|
|
14
|
-
* @param {function} reject
|
|
15
|
-
* @param {function} progress
|
|
16
|
-
*/
|
|
17
|
-
legacyLoad(name: string, resolve: Function, reject: Function, progress: Function): void;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* @param name
|
|
21
|
-
* @param resolve
|
|
22
|
-
* @param reject
|
|
23
|
-
*/
|
|
24
|
-
legacyExists(name: any, resolve: any, reject: any): void;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param {string} name
|
|
28
|
-
* @param {function(ArrayBuffer)} resolve
|
|
29
|
-
* @param {(reason: *) => void} reject
|
|
30
|
-
* @param {function(number)} [progress]
|
|
31
|
-
*/
|
|
32
|
-
load(name: string, resolve: (arg0: ArrayBuffer) => any, reject: (reason: any) => void, progress?: (arg0: number) => any): void;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {string} name
|
|
36
|
-
* @param {function(number)} resolve
|
|
37
|
-
* @param {function} reject
|
|
38
|
-
*/
|
|
39
|
-
count(name: string, resolve: (arg0: number) => any, reject: Function): void;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @param {string} name
|
|
43
|
-
* @param {function(boolean)} resolve
|
|
44
|
-
* @param {function} reject
|
|
45
|
-
*/
|
|
46
|
-
exists(name: string, resolve: (arg0: boolean) => any, reject: Function): void;
|
|
47
|
-
}
|
|
48
|
-
import { EnginePlugin } from "../plugin/EnginePlugin.js";
|
|
49
|
-
//# sourceMappingURL=GameStateLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GameStateLoader.d.ts","sourceRoot":"","sources":["../../../../src/engine/save/GameStateLoader.js"],"names":[],"mappings":";AAIA;IAII;;;OAGG;IACH,SAFU,OAAO,CAEF;IAEf,yBAEC;IAED,gEAeC;IAED;;;;;;OAMG;IACH,iBALW,MAAM,iEAShB;IAED;;;;;OAKG;IACH,yDAIC;IAED;;;;;;OAMG;IACH,WALW,MAAM,kBACG,WAAW,mCACL,IAAI,oBACV,MAAM,gBA6CzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,kBACG,MAAM,kCAoBzB;IAED;;;;;OAKG;IACH,aAJW,MAAM,kBACG,OAAO,kCAwB1B;CACJ;6BAnK4B,2BAA2B"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { GameSaveStateMetadata } from "../../../../view/game/save/GameSaveStateMetadata.js";
|
|
2
|
-
import { array_pick_best_element } from "../../core/collection/array/array_pick_best_element.js";
|
|
3
|
-
import { EnginePlugin } from "../plugin/EnginePlugin.js";
|
|
4
|
-
|
|
5
|
-
class GameStateLoader extends EnginePlugin {
|
|
6
|
-
|
|
7
|
-
id = 'game-state-loader';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @type {Storage}
|
|
12
|
-
*/
|
|
13
|
-
storage = null;
|
|
14
|
-
|
|
15
|
-
async startup() {
|
|
16
|
-
this.storage = this.engine.storage;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
save(name, resolve, reject, progress) {
|
|
20
|
-
const engine = this.engine;
|
|
21
|
-
|
|
22
|
-
const currentScene = engine.sceneManager.current_scene;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @type {GameSaveStateManager}
|
|
28
|
-
*/
|
|
29
|
-
const gameSaves = engine.plugins.getById('game-save-state-manager');
|
|
30
|
-
|
|
31
|
-
const saveComplete = gameSaves.store({ scene: currentScene, name });
|
|
32
|
-
saveComplete.then(resolve, reject);
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated
|
|
38
|
-
* @param {string} name
|
|
39
|
-
* @param {function} resolve
|
|
40
|
-
* @param {function} reject
|
|
41
|
-
* @param {function} progress
|
|
42
|
-
*/
|
|
43
|
-
legacyLoad(name, resolve, reject, progress) {
|
|
44
|
-
console.warn('legacyLoad', name);
|
|
45
|
-
|
|
46
|
-
this.storage.loadBinary(name, resolve, reject, progress);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated
|
|
51
|
-
* @param name
|
|
52
|
-
* @param resolve
|
|
53
|
-
* @param reject
|
|
54
|
-
*/
|
|
55
|
-
legacyExists(name, resolve, reject) {
|
|
56
|
-
console.warn('legacyExists', name);
|
|
57
|
-
|
|
58
|
-
this.storage.contains(name, resolve, reject);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @param {string} name
|
|
64
|
-
* @param {function(ArrayBuffer)} resolve
|
|
65
|
-
* @param {(reason: *) => void} reject
|
|
66
|
-
* @param {function(number)} [progress]
|
|
67
|
-
*/
|
|
68
|
-
load(name, resolve, reject, progress) {
|
|
69
|
-
const engine = this.engine;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @type {GameSaveStateManager}
|
|
75
|
-
*/
|
|
76
|
-
const gameSaves = engine.plugins.getById('game-save-state-manager');
|
|
77
|
-
|
|
78
|
-
gameSaves.update()
|
|
79
|
-
.then(() => {
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
* @type {Array<GameSaveStateMetadata>}
|
|
83
|
-
*/
|
|
84
|
-
const matches = gameSaves.data.filter(m => {
|
|
85
|
-
|
|
86
|
-
if (m.locked) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (m.name === name) {
|
|
91
|
-
return true;
|
|
92
|
-
} else {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
//find most recent
|
|
98
|
-
const mostRecent = array_pick_best_element(matches, m => m.timestamp);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (mostRecent === undefined) {
|
|
102
|
-
//try legacy
|
|
103
|
-
return new Promise((lResolve, lReject) => this.legacyLoad(name, lResolve, lReject, progress));
|
|
104
|
-
|
|
105
|
-
} else {
|
|
106
|
-
|
|
107
|
-
return gameSaves.loadData(mostRecent.id);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}).then(resolve, reject);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
* @param {string} name
|
|
116
|
-
* @param {function(number)} resolve
|
|
117
|
-
* @param {function} reject
|
|
118
|
-
*/
|
|
119
|
-
count(name, resolve, reject) {
|
|
120
|
-
const engine = this.engine;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
* @type {GameSaveStateManager}
|
|
125
|
-
*/
|
|
126
|
-
const gameSaves = engine.plugins.getById('game-save-state-manager');
|
|
127
|
-
|
|
128
|
-
gameSaves.update()
|
|
129
|
-
.then(() => {
|
|
130
|
-
|
|
131
|
-
const matches = gameSaves.data.filter(m => m.name === name);
|
|
132
|
-
|
|
133
|
-
resolve(matches.length);
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
*
|
|
140
|
-
* @param {string} name
|
|
141
|
-
* @param {function(boolean)} resolve
|
|
142
|
-
* @param {function} reject
|
|
143
|
-
*/
|
|
144
|
-
exists(name, resolve, reject) {
|
|
145
|
-
const engine = this.engine;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @type {GameSaveStateManager}
|
|
150
|
-
*/
|
|
151
|
-
const gameSaves = engine.plugins.getById('game-save-state-manager');
|
|
152
|
-
|
|
153
|
-
gameSaves.update()
|
|
154
|
-
.then(() => {
|
|
155
|
-
const exists = gameSaves.data.some(m => !m.locked && (m.name === name));
|
|
156
|
-
|
|
157
|
-
if (!exists) {
|
|
158
|
-
//try legacy
|
|
159
|
-
this.legacyExists(name, resolve, reject);
|
|
160
|
-
} else {
|
|
161
|
-
resolve(exists);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
}).catch(reject);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export default GameStateLoader;
|