@woosh/meep-engine 3.17.2 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor/actions/concrete/ComponentAddAction.d.ts +1 -0
- package/editor/actions/concrete/ComponentAddAction.d.ts.map +1 -1
- package/editor/actions/concrete/ComponentAddAction.js +4 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts +1 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts.map +1 -1
- package/editor/actions/concrete/ComponentRemoveAction.js +4 -0
- package/editor/actions/concrete/EntityCreateAction.d.ts +1 -0
- package/editor/actions/concrete/EntityCreateAction.d.ts.map +1 -1
- package/editor/actions/concrete/EntityCreateAction.js +7 -0
- package/editor/actions/concrete/EntityRemoveAction.d.ts +1 -0
- package/editor/actions/concrete/EntityRemoveAction.d.ts.map +1 -1
- package/editor/actions/concrete/EntityRemoveAction.js +4 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +10 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +1 -1
- package/editor/actions/concrete/PatchTerrainHeightAction.js +107 -85
- package/editor/actions/concrete/TransformModifyAction.d.ts +1 -0
- package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
- package/editor/actions/concrete/TransformModifyAction.js +4 -0
- package/editor/particles/effect/ParticleEffectDocument.d.ts.map +1 -1
- package/editor/particles/effect/ParticleEffectDocument.js +10 -6
- package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
- package/editor/particles/effect/ParticleReferenceSimulation.js +98 -4
- package/editor/particles/effect/make_starter_particle_effect.d.ts.map +1 -1
- package/editor/particles/effect/make_starter_particle_effect.js +0 -2
- package/editor/tools/engine/ToolEngine.d.ts +30 -0
- package/editor/tools/engine/ToolEngine.d.ts.map +1 -1
- package/editor/tools/engine/ToolEngine.js +257 -188
- package/editor/view/ecs/EntityList.d.ts.map +1 -1
- package/editor/view/ecs/EntityList.js +6 -5
- package/editor/view/particles/effect/ParticleEmitterInspectorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleEmitterInspectorView.js +17 -9
- package/package.json +1 -1
- package/src/CODEC_LAYOUT_VERIFICATION.md +1 -2
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts +56 -0
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts.map +1 -0
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.js +73 -0
- package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.d.ts.map +1 -1
- package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.js +18 -63
- package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts +53 -0
- package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_byte_group.js +140 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts +32 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.js +77 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts +46 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.js +146 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts +40 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.js +700 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts +24 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.js +39 -0
- package/src/core/math/random/seededRandom_Mulberry32.d.ts.map +1 -1
- package/src/core/math/random/seededRandom_Mulberry32.js +4 -2
- package/src/core/process/undo/Action.d.ts +19 -0
- package/src/core/process/undo/Action.d.ts.map +1 -1
- package/src/core/process/undo/Action.js +17 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +78 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +310 -0
- package/src/engine/graphics3/GraphicsEngine.d.ts +17 -0
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +30 -10
- package/src/engine/graphics3/particles/particle_gpu_records.d.ts.map +1 -1
- package/src/engine/graphics3/particles/particle_gpu_records.js +0 -2
- package/src/engine/interpolation/InterpolationSystem.d.ts +7 -0
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationSystem.js +10 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +14 -34
- package/src/engine/network/time/RenderPlayout.d.ts +76 -0
- package/src/engine/network/time/RenderPlayout.d.ts.map +1 -0
- package/src/engine/network/time/RenderPlayout.js +163 -0
- package/src/engine/network/transport/adapters/WebSocketTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebSocketTransport.js +11 -4
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +4 -12
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +39 -13
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
- package/src/engine/sound/simulation/core/VolumeField.js +4 -1
- package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +23 -2
- package/src/shade/playground/particle_system/README.md +139 -139
- package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_prototype.js +0 -2
- package/src/shade/playground/particle_system/particle_scene.d.ts +6 -9
- package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_scene.js +6 -13
- package/src/shade/playground/ssr_reprojection/README.md +103 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts +17 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.js +68 -0
- package/src/shade/playground/ssr_reprojection/index.html +79 -0
- package/src/shade/playground/ssr_reprojection/main.d.ts +2 -0
- package/src/shade/playground/ssr_reprojection/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/main.js +245 -0
- package/src/shade/playground/ssr_reprojection/scene.d.ts +18 -0
- package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/scene.js +51 -0
- package/src/shade/renderer/Renderer.d.ts +2 -23
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +185 -218
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +5 -8
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +12 -12
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTable.js +6 -0
- package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +7 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts +4 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.js +51 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.js +5 -35
- package/src/shade/renderer/particles/DESIGN.md +703 -514
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +16 -4
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +1189 -991
- package/src/shade/renderer/particles/ParticleConstants.d.ts +64 -0
- package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
- package/src/shade/renderer/particles/ParticleConstants.js +71 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts +57 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.js +181 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts +7 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.js +12 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +33 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +67 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts +40 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.js +187 -0
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +15 -2
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +14 -8
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts +58 -4
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.js +79 -4
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts +23 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.js +35 -2
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts +4 -2
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js +5 -8
- package/src/shade/renderer/particles/data/particle_emitter_record.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/particle_emitter_record.js +0 -6
- package/src/shade/renderer/particles/graph_particles.d.ts +25 -3
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +108 -31
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts +6 -4
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +5 -5
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +5 -0
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/EmitterRegistry.js +27 -6
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +4 -0
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +6 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +35 -27
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.js +424 -425
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +20 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts +4 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +38 -2
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts +22 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.js +42 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.js +53 -22
- package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.js +213 -216
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +50 -0
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/shader_particle_render.js +1 -1
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts +36 -0
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.js +102 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +102 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +329 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts +112 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.js +318 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +35 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +108 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts +3 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +70 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts +62 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.js +55 -0
- package/src/shade/renderer/postprocess/PostProcess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/PostProcess.js +2 -1
- package/src/shade/renderer/postprocess/ssr/REPROJECTION_PROPOSAL.md +286 -0
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +57 -21
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +230 -129
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts +11 -0
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.js +6 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.js +32 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.js +41 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts +3 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +30 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +70 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts +21 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.js +363 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_get_neighbour_weight.js +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts +2 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.js +24 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts +1 -6
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.js +16 -332
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts +1 -6
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.js +25 -358
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -5
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +201 -276
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts +1 -0
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +167 -143
- package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts +15 -0
- package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts.map +1 -0
- package/src/shade/renderer/shader/graph/graph_create_buffer.js +20 -0
- package/src/shade/renderer/view/GPUViewContext.d.ts +3 -4
- package/src/shade/renderer/view/GPUViewContext.d.ts.map +1 -1
- package/src/shade/renderer/view/GPUViewContext.js +5 -5
- package/src/core/binary/meshopt/__meshopt_test_streams.d.ts +0 -24
- package/src/core/binary/meshopt/__meshopt_test_streams.d.ts.map +0 -1
- package/src/core/binary/meshopt/__meshopt_test_streams.js +0 -237
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +0 -84
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +0 -1
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +0 -266
- package/src/engine/asset/loaders/gltf_test_fixtures.d.ts +0 -97
- package/src/engine/asset/loaders/gltf_test_fixtures.d.ts.map +0 -1
- package/src/engine/asset/loaders/gltf_test_fixtures.js +0 -359
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts +0 -86
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/animation/skin_test_fixtures.js +0 -250
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts +0 -16
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.js +0 -27
- package/src/shade/renderer/particles/particle_test_fixtures.d.ts +0 -151
- package/src/shade/renderer/particles/particle_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/particles/particle_test_fixtures.js +0 -229
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.js +0 -23
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +0 -457
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal meshopt attribute encoders, for tests only - nothing in production imports this.
|
|
3
|
-
*
|
|
4
|
-
* They emit the simplest stream the format admits (every group stored raw), which is legal and
|
|
5
|
-
* compresses nothing. Their job is to exercise the decoder's block, group and channel loops over
|
|
6
|
-
* shapes too large to author by hand, and to give the glTF fixtures something compressed to load.
|
|
7
|
-
*
|
|
8
|
-
* They are deliberately NOT the oracle for the format itself: they were written from the same
|
|
9
|
-
* reading of the specification as the decoder, so a shared misreading would pass. The specification's
|
|
10
|
-
* own worked example, and the hand-derived vectors beside it, are what prove the bitstream.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @param {number} previous
|
|
15
|
-
* @param {number} current
|
|
16
|
-
* @returns {number} the spec's `encode`, in 8-bit space
|
|
17
|
-
*/
|
|
18
|
-
function zigzag_8(previous, current) {
|
|
19
|
-
const delta = (current - previous) & 0xff;
|
|
20
|
-
|
|
21
|
-
return ((delta & 0x80) !== 0) ? (~(delta << 1)) & 0xff : (delta << 1) & 0xff;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param {number} previous
|
|
26
|
-
* @param {number} current
|
|
27
|
-
* @returns {number} the spec's `encode`, in 16-bit space
|
|
28
|
-
*/
|
|
29
|
-
function zigzag_16(previous, current) {
|
|
30
|
-
const delta = (current - previous) & 0xffff;
|
|
31
|
-
|
|
32
|
-
return ((delta & 0x8000) !== 0) ? (~(delta << 1)) & 0xffff : (delta << 1) & 0xffff;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @param {number} value
|
|
37
|
-
* @param {number} amount
|
|
38
|
-
* @returns {number}
|
|
39
|
-
*/
|
|
40
|
-
function rotate_left_32(value, amount) {
|
|
41
|
-
return (((value << amount) | (value >>> (32 - amount))) >>> 0);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {number} byte_stride
|
|
46
|
-
* @returns {number}
|
|
47
|
-
*/
|
|
48
|
-
function max_block_elements(byte_stride) {
|
|
49
|
-
return Math.min(Math.floor(8192 / byte_stride) & ~15, 256);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Every group of every data block stored raw, which is header bits `3` under version 0's table and
|
|
54
|
-
* under version 1's control mode 1.
|
|
55
|
-
*
|
|
56
|
-
* @param {number} group_count
|
|
57
|
-
* @param {number} header_value
|
|
58
|
-
* @returns {number[]}
|
|
59
|
-
*/
|
|
60
|
-
function build_group_header(group_count, header_value) {
|
|
61
|
-
const header = new Array((group_count + 3) >> 2).fill(0);
|
|
62
|
-
|
|
63
|
-
for (let g = 0; g < group_count; g++) {
|
|
64
|
-
header[g >> 2] |= header_value << ((g & 3) * 2);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return header;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Read one channel's value for element `i` out of an element array, at the width its mode implies.
|
|
72
|
-
*
|
|
73
|
-
* @param {Uint8Array} data
|
|
74
|
-
* @param {number} offset
|
|
75
|
-
* @param {number} width bytes
|
|
76
|
-
* @returns {number}
|
|
77
|
-
*/
|
|
78
|
-
function read_le(data, offset, width) {
|
|
79
|
-
let value = 0;
|
|
80
|
-
|
|
81
|
-
for (let b = 0; b < width; b++) {
|
|
82
|
-
value |= data[offset + b] << (b * 8);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return value >>> 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Build an attribute ("mode 0") stream.
|
|
90
|
-
*
|
|
91
|
-
* @param {Uint8Array} data `count * byte_stride` bytes
|
|
92
|
-
* @param {number} count
|
|
93
|
-
* @param {number} byte_stride
|
|
94
|
-
* @param {Object} [options]
|
|
95
|
-
* @param {number} [options.version] 0 or 1
|
|
96
|
-
* @param {number[]} [options.channel_modes] one mode byte per aligned four byte positions;
|
|
97
|
-
* version 1 only, defaults to all zero (byte deltas)
|
|
98
|
-
* @returns {Uint8Array}
|
|
99
|
-
*/
|
|
100
|
-
export function encode_meshopt_attributes(data, count, byte_stride, options = {}) {
|
|
101
|
-
const version = options.version ?? 0;
|
|
102
|
-
const channel_count = byte_stride >> 2;
|
|
103
|
-
const channel_modes = options.channel_modes ?? new Array(channel_count).fill(0);
|
|
104
|
-
|
|
105
|
-
const out = [0xa0 | version];
|
|
106
|
-
|
|
107
|
-
const baseline = Array.from(data.subarray(0, byte_stride));
|
|
108
|
-
|
|
109
|
-
let previous = baseline.slice();
|
|
110
|
-
let element = 0;
|
|
111
|
-
|
|
112
|
-
while (element < count) {
|
|
113
|
-
const block_elements = Math.min(count - element, max_block_elements(byte_stride));
|
|
114
|
-
const group_count = Math.ceil(block_elements / 16);
|
|
115
|
-
const aligned_count = group_count * 16;
|
|
116
|
-
|
|
117
|
-
// every byte position gets control mode 1, whose header value 3 is sixteen raw bytes
|
|
118
|
-
if (version === 1) {
|
|
119
|
-
const control = new Array(channel_count).fill(0);
|
|
120
|
-
|
|
121
|
-
for (let k = 0; k < byte_stride; k++) {
|
|
122
|
-
control[k >> 2] |= 1 << ((k & 3) * 2);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
out.push(...control);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The block's delta bytes, per byte position, exactly as the decoder will recover them.
|
|
130
|
-
* @type {number[][]}
|
|
131
|
-
*/
|
|
132
|
-
const deltas = [];
|
|
133
|
-
|
|
134
|
-
for (let k = 0; k < byte_stride; k++) {
|
|
135
|
-
deltas.push(new Array(aligned_count).fill(0));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
for (let c = 0; c < channel_count; c++) {
|
|
139
|
-
const mode_byte = version === 1 ? channel_modes[c] : 0;
|
|
140
|
-
const mode = mode_byte & 0x0f;
|
|
141
|
-
const rotation = mode_byte >> 4;
|
|
142
|
-
const k0 = c * 4;
|
|
143
|
-
|
|
144
|
-
const width = mode === 0 ? 1 : (mode === 1 ? 2 : 4);
|
|
145
|
-
|
|
146
|
-
for (let lane = 0; lane < 4 / width; lane++) {
|
|
147
|
-
const k = k0 + lane * width;
|
|
148
|
-
|
|
149
|
-
let carried = read_le(previous, k, width);
|
|
150
|
-
|
|
151
|
-
for (let i = 0; i < block_elements; i++) {
|
|
152
|
-
const value = read_le(data, (element + i) * byte_stride + k, width);
|
|
153
|
-
|
|
154
|
-
let code;
|
|
155
|
-
|
|
156
|
-
if (mode === 0) {
|
|
157
|
-
code = zigzag_8(carried, value);
|
|
158
|
-
} else if (mode === 1) {
|
|
159
|
-
code = zigzag_16(carried, value);
|
|
160
|
-
} else {
|
|
161
|
-
code = rotate_left_32((value ^ carried) >>> 0, (32 - rotation) & 31);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
for (let b = 0; b < width; b++) {
|
|
165
|
-
deltas[k + b][i] = (code >>> (b * 8)) & 0xff;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
carried = value;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const header_value = 3;
|
|
174
|
-
|
|
175
|
-
for (let k = 0; k < byte_stride; k++) {
|
|
176
|
-
out.push(...build_group_header(group_count, header_value));
|
|
177
|
-
out.push(...deltas[k]);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
previous = Array.from(
|
|
181
|
-
data.subarray((element + block_elements - 1) * byte_stride, (element + block_elements) * byte_stride)
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
element += block_elements;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const tail_size = byte_stride + (version === 1 ? channel_count : 0);
|
|
188
|
-
const tail_min = version === 1 ? 24 : 32;
|
|
189
|
-
const tail_size_pad = Math.max(tail_size, tail_min);
|
|
190
|
-
|
|
191
|
-
// the padding goes IN FRONT of the tail block, which sits flush against the end of the stream
|
|
192
|
-
for (let i = 0; i < tail_size_pad - tail_size; i++) {
|
|
193
|
-
out.push(0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
out.push(...baseline);
|
|
197
|
-
|
|
198
|
-
if (version === 1) {
|
|
199
|
-
out.push(...channel_modes);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return new Uint8Array(out);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Build an index-sequence ("mode 2") stream. Every delta is taken against baseline 0.
|
|
207
|
-
*
|
|
208
|
-
* @param {number[]} indices
|
|
209
|
-
* @returns {Uint8Array}
|
|
210
|
-
*/
|
|
211
|
-
export function encode_meshopt_index_sequence(indices) {
|
|
212
|
-
const out = [0xd1];
|
|
213
|
-
|
|
214
|
-
let last = 0;
|
|
215
|
-
|
|
216
|
-
for (const index of indices) {
|
|
217
|
-
const delta = index - last;
|
|
218
|
-
const zigzag = (delta << 1) ^ (delta >> 31);
|
|
219
|
-
|
|
220
|
-
// baseline bit 0, then the zigzag delta
|
|
221
|
-
let value = ((zigzag << 1) >>> 0);
|
|
222
|
-
|
|
223
|
-
do {
|
|
224
|
-
const lower = value & 0x7f;
|
|
225
|
-
|
|
226
|
-
value = value >>> 7;
|
|
227
|
-
|
|
228
|
-
out.push(value > 0 ? (lower | 0x80) : lower);
|
|
229
|
-
} while (value > 0);
|
|
230
|
-
|
|
231
|
-
last = index;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
out.push(0, 0, 0, 0);
|
|
235
|
-
|
|
236
|
-
return new Uint8Array(out);
|
|
237
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared inline mesh fixtures for the atlas test suites. Each builder returns a
|
|
3
|
-
* fresh {@link BinaryTopology} with face normals computed. Test-only — not
|
|
4
|
-
* imported by production code.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @param {number[]} indices
|
|
8
|
-
* @param {number[]} positions flat xyz
|
|
9
|
-
* @returns {BinaryTopology}
|
|
10
|
-
*/
|
|
11
|
-
export function atlas_make_mesh(indices: number[], positions: number[]): BinaryTopology;
|
|
12
|
-
/**
|
|
13
|
-
* Unit square in the z=0 plane, two triangles sharing the 0-2 diagonal.
|
|
14
|
-
*
|
|
15
|
-
* @returns {BinaryTopology}
|
|
16
|
-
*/
|
|
17
|
-
export function atlas_build_unit_quad(): BinaryTopology;
|
|
18
|
-
/**
|
|
19
|
-
* Two triangles sharing edge (0,1), folded to a 90 degree dihedral.
|
|
20
|
-
*
|
|
21
|
-
* @returns {BinaryTopology}
|
|
22
|
-
*/
|
|
23
|
-
export function atlas_build_folded_pair(): BinaryTopology;
|
|
24
|
-
/**
|
|
25
|
-
* The unit quad, but the two triangles use SEPARATE vertex indices at the
|
|
26
|
-
* shared diagonal (coincident positions, distinct ids). Before welding the two
|
|
27
|
-
* triangles are two islands; after welding they share the diagonal edge.
|
|
28
|
-
*
|
|
29
|
-
* @returns {BinaryTopology}
|
|
30
|
-
*/
|
|
31
|
-
export function atlas_build_split_quad(): BinaryTopology;
|
|
32
|
-
/**
|
|
33
|
-
* An open ribbon of `segments` quads bent around an arc of `total_angle`
|
|
34
|
-
* radians, so face normals fan out radially. Drives curvature-based chart
|
|
35
|
-
* splitting. Connected, single island, boundary on all four sides.
|
|
36
|
-
*
|
|
37
|
-
* @param {number} segments
|
|
38
|
-
* @param {number} total_angle radians swept across the ribbon
|
|
39
|
-
* @returns {BinaryTopology}
|
|
40
|
-
*/
|
|
41
|
-
export function atlas_build_curved_ribbon(segments: number, total_angle: number): BinaryTopology;
|
|
42
|
-
/**
|
|
43
|
-
* Flat n×n grid of quads in the z=0 plane (2·n·n coplanar triangles). All faces
|
|
44
|
-
* share one normal, so they collapse to a single planar region — the canonical
|
|
45
|
-
* region-atomic case.
|
|
46
|
-
*
|
|
47
|
-
* @param {number} n cells per side
|
|
48
|
-
* @returns {BinaryTopology}
|
|
49
|
-
*/
|
|
50
|
-
export function atlas_build_grid_plane(n: number): BinaryTopology;
|
|
51
|
-
/**
|
|
52
|
-
* A good quad plus three deliberately degenerate triangles (each its own
|
|
53
|
-
* island): a collinear zero-area triangle, a coincident-vertex "needle" (two
|
|
54
|
-
* vertices at the same position), and a near-collinear sliver. Real exported /
|
|
55
|
-
* scanned meshes contain these; the pipeline must stay finite and not crash.
|
|
56
|
-
* Use with `weld: false` so the needle's coincident vertices stay distinct.
|
|
57
|
-
*
|
|
58
|
-
* @returns {BinaryTopology}
|
|
59
|
-
*/
|
|
60
|
-
export function atlas_build_degenerate_mix(): BinaryTopology;
|
|
61
|
-
/**
|
|
62
|
-
* Unit UV sphere with `rings` latitude bands and `sectors` longitude segments,
|
|
63
|
-
* shared vertices (pole fans + modulo longitude wrap), consistent winding. A
|
|
64
|
-
* smooth closed surface for testing curvature-driven segmentation.
|
|
65
|
-
*
|
|
66
|
-
* @param {number} rings latitude bands (>= 2)
|
|
67
|
-
* @param {number} sectors longitude segments (>= 3)
|
|
68
|
-
* @returns {BinaryTopology}
|
|
69
|
-
*/
|
|
70
|
-
export function atlas_build_uv_sphere(rings: number, sectors: number): BinaryTopology;
|
|
71
|
-
/**
|
|
72
|
-
* Regular octahedron: a closed surface of 8 triangles, outward winding.
|
|
73
|
-
*
|
|
74
|
-
* @returns {BinaryTopology}
|
|
75
|
-
*/
|
|
76
|
-
export function atlas_build_octahedron(): BinaryTopology;
|
|
77
|
-
/**
|
|
78
|
-
* Axis-aligned unit cube, 12 triangles, consistent outward winding.
|
|
79
|
-
*
|
|
80
|
-
* @returns {BinaryTopology}
|
|
81
|
-
*/
|
|
82
|
-
export function atlas_build_unit_cube(): BinaryTopology;
|
|
83
|
-
import { BinaryTopology } from "../topology/struct/binary/BinaryTopology.js";
|
|
84
|
-
//# sourceMappingURL=atlas_test_fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atlas_test_fixtures.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/atlas/atlas_test_fixtures.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AACH,yCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,cAAc,CAO1B;AAED;;;;GAIG;AACH,yCAFa,cAAc,CAY1B;AAED;;;;GAIG;AACH,2CAFa,cAAc,CAY1B;AAED;;;;;;GAMG;AACH,0CAFa,cAAc,CAc1B;AAED;;;;;;;;GAQG;AACH,oDAJW,MAAM,eACN,MAAM,GACJ,cAAc,CAsB1B;AAED;;;;;;;GAOG;AACH,0CAHW,MAAM,GACJ,cAAc,CAuB1B;AAED;;;;;;;;GAQG;AACH,8CAFa,cAAc,CA0B1B;AAED;;;;;;;;GAQG;AACH,6CAJW,MAAM,WACN,MAAM,GACJ,cAAc,CAkC1B;AAED;;;;GAIG;AACH,0CAFa,cAAc,CAiB1B;AAED;;;;GAIG;AACH,yCAFa,cAAc,CAuB1B;+BAzQ8B,6CAA6C"}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { BinaryTopology } from "../topology/struct/binary/BinaryTopology.js";
|
|
2
|
-
import { bt_mesh_compute_face_normals } from "../topology/struct/binary/io/bt_mesh_compute_face_normals.js";
|
|
3
|
-
import { bt_mesh_from_indexed_geometry } from "../topology/struct/binary/io/bt_mesh_from_indexed_geometry.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Shared inline mesh fixtures for the atlas test suites. Each builder returns a
|
|
7
|
-
* fresh {@link BinaryTopology} with face normals computed. Test-only — not
|
|
8
|
-
* imported by production code.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param {number[]} indices
|
|
13
|
-
* @param {number[]} positions flat xyz
|
|
14
|
-
* @returns {BinaryTopology}
|
|
15
|
-
*/
|
|
16
|
-
export function atlas_make_mesh(indices, positions) {
|
|
17
|
-
const mesh = new BinaryTopology();
|
|
18
|
-
bt_mesh_from_indexed_geometry(mesh, indices, positions);
|
|
19
|
-
bt_mesh_compute_face_normals(mesh);
|
|
20
|
-
return mesh;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Unit square in the z=0 plane, two triangles sharing the 0-2 diagonal.
|
|
25
|
-
*
|
|
26
|
-
* @returns {BinaryTopology}
|
|
27
|
-
*/
|
|
28
|
-
export function atlas_build_unit_quad() {
|
|
29
|
-
return atlas_make_mesh(
|
|
30
|
-
[0, 1, 2, 0, 2, 3],
|
|
31
|
-
[
|
|
32
|
-
0, 0, 0,
|
|
33
|
-
1, 0, 0,
|
|
34
|
-
1, 1, 0,
|
|
35
|
-
0, 1, 0,
|
|
36
|
-
]
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Two triangles sharing edge (0,1), folded to a 90 degree dihedral.
|
|
42
|
-
*
|
|
43
|
-
* @returns {BinaryTopology}
|
|
44
|
-
*/
|
|
45
|
-
export function atlas_build_folded_pair() {
|
|
46
|
-
return atlas_make_mesh(
|
|
47
|
-
[0, 1, 2, 0, 3, 1],
|
|
48
|
-
[
|
|
49
|
-
0, 0, 0,
|
|
50
|
-
1, 0, 0,
|
|
51
|
-
0, 1, 0,
|
|
52
|
-
0, 0, 1,
|
|
53
|
-
]
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The unit quad, but the two triangles use SEPARATE vertex indices at the
|
|
59
|
-
* shared diagonal (coincident positions, distinct ids). Before welding the two
|
|
60
|
-
* triangles are two islands; after welding they share the diagonal edge.
|
|
61
|
-
*
|
|
62
|
-
* @returns {BinaryTopology}
|
|
63
|
-
*/
|
|
64
|
-
export function atlas_build_split_quad() {
|
|
65
|
-
return atlas_make_mesh(
|
|
66
|
-
[0, 1, 2, 3, 4, 5],
|
|
67
|
-
[
|
|
68
|
-
0, 0, 0,
|
|
69
|
-
1, 0, 0,
|
|
70
|
-
1, 1, 0,
|
|
71
|
-
0, 0, 0, // duplicate of vertex 0
|
|
72
|
-
1, 1, 0, // duplicate of vertex 2
|
|
73
|
-
0, 1, 0,
|
|
74
|
-
]
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* An open ribbon of `segments` quads bent around an arc of `total_angle`
|
|
80
|
-
* radians, so face normals fan out radially. Drives curvature-based chart
|
|
81
|
-
* splitting. Connected, single island, boundary on all four sides.
|
|
82
|
-
*
|
|
83
|
-
* @param {number} segments
|
|
84
|
-
* @param {number} total_angle radians swept across the ribbon
|
|
85
|
-
* @returns {BinaryTopology}
|
|
86
|
-
*/
|
|
87
|
-
export function atlas_build_curved_ribbon(segments, total_angle) {
|
|
88
|
-
const positions = [];
|
|
89
|
-
const N = segments;
|
|
90
|
-
// bottom ring at z=0 (indices 0..N), top ring at z=1 (indices N+1..2N+1)
|
|
91
|
-
for (let j = 0; j <= N; j++) {
|
|
92
|
-
const a = (j / N) * total_angle;
|
|
93
|
-
positions.push(Math.cos(a), Math.sin(a), 0);
|
|
94
|
-
}
|
|
95
|
-
for (let j = 0; j <= N; j++) {
|
|
96
|
-
const a = (j / N) * total_angle;
|
|
97
|
-
positions.push(Math.cos(a), Math.sin(a), 1);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const top = N + 1;
|
|
101
|
-
const indices = [];
|
|
102
|
-
for (let j = 0; j < N; j++) {
|
|
103
|
-
indices.push(j, j + 1, top + j + 1);
|
|
104
|
-
indices.push(j, top + j + 1, top + j);
|
|
105
|
-
}
|
|
106
|
-
return atlas_make_mesh(indices, positions);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Flat n×n grid of quads in the z=0 plane (2·n·n coplanar triangles). All faces
|
|
111
|
-
* share one normal, so they collapse to a single planar region — the canonical
|
|
112
|
-
* region-atomic case.
|
|
113
|
-
*
|
|
114
|
-
* @param {number} n cells per side
|
|
115
|
-
* @returns {BinaryTopology}
|
|
116
|
-
*/
|
|
117
|
-
export function atlas_build_grid_plane(n) {
|
|
118
|
-
const positions = [];
|
|
119
|
-
for (let j = 0; j <= n; j++) {
|
|
120
|
-
for (let i = 0; i <= n; i++) {
|
|
121
|
-
positions.push(i / n, j / n, 0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @param {number} i column index
|
|
126
|
-
* @param {number} j row index
|
|
127
|
-
* @returns {number} flat vertex id in the (n+1)×(n+1) grid
|
|
128
|
-
*/
|
|
129
|
-
const idx = (i, j) => j * (n + 1) + i;
|
|
130
|
-
const indices = [];
|
|
131
|
-
for (let j = 0; j < n; j++) {
|
|
132
|
-
for (let i = 0; i < n; i++) {
|
|
133
|
-
const a = idx(i, j), b = idx(i + 1, j), c = idx(i + 1, j + 1), d = idx(i, j + 1);
|
|
134
|
-
indices.push(a, b, c, a, c, d);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return atlas_make_mesh(indices, positions);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* A good quad plus three deliberately degenerate triangles (each its own
|
|
142
|
-
* island): a collinear zero-area triangle, a coincident-vertex "needle" (two
|
|
143
|
-
* vertices at the same position), and a near-collinear sliver. Real exported /
|
|
144
|
-
* scanned meshes contain these; the pipeline must stay finite and not crash.
|
|
145
|
-
* Use with `weld: false` so the needle's coincident vertices stay distinct.
|
|
146
|
-
*
|
|
147
|
-
* @returns {BinaryTopology}
|
|
148
|
-
*/
|
|
149
|
-
export function atlas_build_degenerate_mix() {
|
|
150
|
-
return atlas_make_mesh(
|
|
151
|
-
[
|
|
152
|
-
0, 1, 2, 0, 2, 3, // good unit quad
|
|
153
|
-
4, 5, 6, // collinear -> exactly zero area
|
|
154
|
-
7, 8, 9, // needle: vertices 7 and 8 coincide -> zero area
|
|
155
|
-
10, 11, 12, // near-collinear -> tiny-area sliver
|
|
156
|
-
],
|
|
157
|
-
[
|
|
158
|
-
0, 0, 0, // 0
|
|
159
|
-
1, 0, 0, // 1
|
|
160
|
-
1, 1, 0, // 2
|
|
161
|
-
0, 1, 0, // 3
|
|
162
|
-
2, 0, 0, // 4
|
|
163
|
-
3, 0, 0, // 5 (4,5,6 collinear on y=0)
|
|
164
|
-
4, 0, 0, // 6
|
|
165
|
-
2, 2, 0, // 7
|
|
166
|
-
2, 2, 0, // 8 coincident with 7
|
|
167
|
-
3, 2, 0, // 9
|
|
168
|
-
2, 3, 0, // 10
|
|
169
|
-
4, 3, 0, // 11
|
|
170
|
-
3, 3.0001, 0, // 12 just off the 10-11 line -> sliver
|
|
171
|
-
]
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Unit UV sphere with `rings` latitude bands and `sectors` longitude segments,
|
|
177
|
-
* shared vertices (pole fans + modulo longitude wrap), consistent winding. A
|
|
178
|
-
* smooth closed surface for testing curvature-driven segmentation.
|
|
179
|
-
*
|
|
180
|
-
* @param {number} rings latitude bands (>= 2)
|
|
181
|
-
* @param {number} sectors longitude segments (>= 3)
|
|
182
|
-
* @returns {BinaryTopology}
|
|
183
|
-
*/
|
|
184
|
-
export function atlas_build_uv_sphere(rings, sectors) {
|
|
185
|
-
const positions = [];
|
|
186
|
-
positions.push(0, 1, 0); // 0: north pole (latitude band 0)
|
|
187
|
-
positions.push(0, -1, 0); // 1: south pole (latitude band `rings`)
|
|
188
|
-
for (let i = 1; i < rings; i++) {
|
|
189
|
-
const phi = (i / rings) * Math.PI;
|
|
190
|
-
const y = Math.cos(phi);
|
|
191
|
-
const r = Math.sin(phi);
|
|
192
|
-
for (let s = 0; s < sectors; s++) {
|
|
193
|
-
const theta = (s / sectors) * 2 * Math.PI;
|
|
194
|
-
positions.push(r * Math.cos(theta), y, r * Math.sin(theta));
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const vid = (i, s) => {
|
|
199
|
-
if (i === 0) return 0;
|
|
200
|
-
if (i === rings) return 1;
|
|
201
|
-
return 2 + (i - 1) * sectors + (s % sectors);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const indices = [];
|
|
205
|
-
const tri = (a, b, c) => {
|
|
206
|
-
if (a !== b && b !== c && a !== c) indices.push(a, b, c);
|
|
207
|
-
};
|
|
208
|
-
for (let i = 0; i < rings; i++) {
|
|
209
|
-
for (let s = 0; s < sectors; s++) {
|
|
210
|
-
const v00 = vid(i, s), v01 = vid(i, s + 1), v10 = vid(i + 1, s), v11 = vid(i + 1, s + 1);
|
|
211
|
-
tri(v00, v10, v11);
|
|
212
|
-
tri(v00, v11, v01);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return atlas_make_mesh(indices, positions);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Regular octahedron: a closed surface of 8 triangles, outward winding.
|
|
220
|
-
*
|
|
221
|
-
* @returns {BinaryTopology}
|
|
222
|
-
*/
|
|
223
|
-
export function atlas_build_octahedron() {
|
|
224
|
-
return atlas_make_mesh(
|
|
225
|
-
[
|
|
226
|
-
4, 0, 2, 4, 2, 1, 4, 1, 3, 4, 3, 0, // top (+z apex)
|
|
227
|
-
5, 2, 0, 5, 1, 2, 5, 3, 1, 5, 0, 3, // bottom (-z apex)
|
|
228
|
-
],
|
|
229
|
-
[
|
|
230
|
-
1, 0, 0,
|
|
231
|
-
-1, 0, 0,
|
|
232
|
-
0, 1, 0,
|
|
233
|
-
0, -1, 0,
|
|
234
|
-
0, 0, 1,
|
|
235
|
-
0, 0, -1,
|
|
236
|
-
]
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Axis-aligned unit cube, 12 triangles, consistent outward winding.
|
|
242
|
-
*
|
|
243
|
-
* @returns {BinaryTopology}
|
|
244
|
-
*/
|
|
245
|
-
export function atlas_build_unit_cube() {
|
|
246
|
-
return atlas_make_mesh(
|
|
247
|
-
[
|
|
248
|
-
0, 1, 5, 0, 5, 4, // front (-y)
|
|
249
|
-
1, 2, 6, 1, 6, 5, // right (+x)
|
|
250
|
-
2, 3, 7, 2, 7, 6, // back (+y)
|
|
251
|
-
3, 0, 4, 3, 4, 7, // left (-x)
|
|
252
|
-
3, 2, 1, 3, 1, 0, // bottom (-z)
|
|
253
|
-
4, 5, 6, 4, 6, 7, // top (+z)
|
|
254
|
-
],
|
|
255
|
-
[
|
|
256
|
-
0, 0, 0,
|
|
257
|
-
1, 0, 0,
|
|
258
|
-
1, 1, 0,
|
|
259
|
-
0, 1, 0,
|
|
260
|
-
0, 0, 1,
|
|
261
|
-
1, 0, 1,
|
|
262
|
-
1, 1, 1,
|
|
263
|
-
0, 1, 1,
|
|
264
|
-
]
|
|
265
|
-
);
|
|
266
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @returns {ArrayBuffer}
|
|
3
|
-
*/
|
|
4
|
-
export function build_triangle_bin(): ArrayBuffer;
|
|
5
|
-
/**
|
|
6
|
-
* @param {string|undefined} buffer_uri `undefined` for a .glb, whose buffer is the binary chunk
|
|
7
|
-
* @returns {object}
|
|
8
|
-
*/
|
|
9
|
-
export function build_triangle_gltf_json(buffer_uri: string | undefined): object;
|
|
10
|
-
/**
|
|
11
|
-
* The same model with a base-colour texture on it, so that a test can watch what an image costs.
|
|
12
|
-
*
|
|
13
|
-
* The texture names its image the way the game's own models do — a `source` index into `images`,
|
|
14
|
-
* whose entry carries a relative `uri` — because that is the shape {@link gltf_used_image_indices}
|
|
15
|
-
* decides against a DDS sibling with, and the one whose bytes have to come from somewhere.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} buffer_uri
|
|
18
|
-
* @param {string} image_uri
|
|
19
|
-
* @returns {object}
|
|
20
|
-
*/
|
|
21
|
-
export function build_textured_triangle_gltf_json(buffer_uri: string, image_uri: string): object;
|
|
22
|
-
/**
|
|
23
|
-
* The same model as a .glb — the JSON chunk followed by the binary one.
|
|
24
|
-
*
|
|
25
|
-
* @returns {ArrayBuffer}
|
|
26
|
-
*/
|
|
27
|
-
export function build_triangle_glb(): ArrayBuffer;
|
|
28
|
-
/**
|
|
29
|
-
* The compressed streams, laid out back to back.
|
|
30
|
-
*
|
|
31
|
-
* Positions, normals and texture coordinates go through the attribute codec; the indices are a
|
|
32
|
-
* hand-written triangle stream, because writing a triangle encoder to test a triangle decoder with
|
|
33
|
-
* would prove nothing. `0xf0` reads entry 0 of the lookup table, which is `0x00` - three fresh
|
|
34
|
-
* vertices, which is exactly (0, 1, 2).
|
|
35
|
-
*
|
|
36
|
-
* At `codec_version` 1 the attribute streams carry a channel mode each - a rotated exclusive-or for
|
|
37
|
-
* the positions, plain byte deltas for the normals, 16-bit deltas for the texture coordinates - and
|
|
38
|
-
* with `colour` there is a `COLOR`-filtered stream too. Either makes a file that only
|
|
39
|
-
* `KHR_meshopt_compression` defines, and that the vendor extension refuses.
|
|
40
|
-
*
|
|
41
|
-
* @param {Object} [options]
|
|
42
|
-
* @param {number} [options.codec_version] 0 or 1
|
|
43
|
-
* @param {boolean} [options.colour] append a `COLOR_0` stream carrying the `COLOR` filter
|
|
44
|
-
* @returns {{buffer: ArrayBuffer, ranges: {byteOffset:number, byteLength:number}[]}}
|
|
45
|
-
*/
|
|
46
|
-
export function build_meshopt_triangle_bin({ codec_version, colour }?: {
|
|
47
|
-
codec_version?: number;
|
|
48
|
-
colour?: boolean;
|
|
49
|
-
}): {
|
|
50
|
-
buffer: ArrayBuffer;
|
|
51
|
-
ranges: {
|
|
52
|
-
byteOffset: number;
|
|
53
|
-
byteLength: number;
|
|
54
|
-
}[];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* @param {string} extension_name `EXT_meshopt_compression` or `KHR_meshopt_compression`
|
|
58
|
-
* @param {string|undefined} buffer_uri `undefined` for a .glb, whose compressed data is the binary chunk
|
|
59
|
-
* @param {Object} [options] see {@link build_meshopt_triangle_bin}
|
|
60
|
-
* @param {number} [options.codec_version]
|
|
61
|
-
* @param {boolean} [options.colour]
|
|
62
|
-
* @returns {object}
|
|
63
|
-
*/
|
|
64
|
-
export function build_meshopt_triangle_gltf_json(extension_name: string, buffer_uri: string | undefined, options?: {
|
|
65
|
-
codec_version?: number;
|
|
66
|
-
colour?: boolean;
|
|
67
|
-
}): object;
|
|
68
|
-
/**
|
|
69
|
-
* The compressed model as a .glb: the JSON chunk, then the compressed data as the binary one.
|
|
70
|
-
*
|
|
71
|
-
* @param {string} extension_name
|
|
72
|
-
* @param {Object} [options] see {@link build_meshopt_triangle_bin}
|
|
73
|
-
* @returns {ArrayBuffer}
|
|
74
|
-
*/
|
|
75
|
-
export function build_meshopt_triangle_glb(extension_name: string, options?: any): ArrayBuffer;
|
|
76
|
-
export const GLTF_FIXTURE_NODE_NAME: "unit_root";
|
|
77
|
-
export const GLTF_FIXTURE_MESH_NAME: "unit_body";
|
|
78
|
-
/**
|
|
79
|
-
* Byte length of what {@link build_triangle_bin} produces — three positions, three normals, three
|
|
80
|
-
* texture coordinates and three indices, laid out back to back.
|
|
81
|
-
* @type {number}
|
|
82
|
-
*/
|
|
83
|
-
export const GLTF_FIXTURE_BIN_BYTE_LENGTH: number;
|
|
84
|
-
/**
|
|
85
|
-
* Byte length of the placeholder the compressed views point at. It has to be big enough to hold
|
|
86
|
-
* every uncompressed view referencing it, which is the same 102 bytes {@link build_triangle_bin}
|
|
87
|
-
* lays out.
|
|
88
|
-
* @type {number}
|
|
89
|
-
*/
|
|
90
|
-
export const GLTF_FIXTURE_FALLBACK_BYTE_LENGTH: number;
|
|
91
|
-
/**
|
|
92
|
-
* What those decode to: R = Y + Co - Cg, G = Y + Cg, B = Y - Co - Cg, with alpha widened by the bit
|
|
93
|
-
* its marker cost it.
|
|
94
|
-
* @type {number[]}
|
|
95
|
-
*/
|
|
96
|
-
export const GLTF_FIXTURE_COLOURS: number[];
|
|
97
|
-
//# sourceMappingURL=gltf_test_fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gltf_test_fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/gltf_test_fixtures.js"],"names":[],"mappings":"AAqBA;;GAEG;AACH,sCAFa,WAAW,CAWvB;AAED;;;GAGG;AACH,qDAHW,MAAM,GAAC,SAAS,GACd,MAAM,CA+BlB;AAED;;;;;;;;;;GAUG;AACH,8DAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;GAIG;AACH,sCAFa,WAAW,CAiCvB;AAsCD;;;;;;;;;;;;;;;;;GAiBG;AACH;IAJ4B,aAAa,GAA9B,MAAM;IACY,MAAM,GAAxB,OAAO;;YACI,WAAW;;oBAAsB,MAAM;oBAAa,MAAM;;EA2C/E;AAED;;;;;;;GAOG;AACH,iEAPW,MAAM,cACN,MAAM,GAAC,SAAS;IAEC,aAAa,GAA9B,MAAM;IACY,MAAM,GAAxB,OAAO;IACL,MAAM,CA8ElB;AAED;;;;;;GAMG;AACH,2DAJW,MAAM,kBAEJ,WAAW,CAkCvB;AA3VD,iDAAkD;AAClD,iDAAkD;AAElD;;;;GAIG;AACH,2CAFU,MAAM,CAEgC;AA2HhD;;;;;GAKG;AACH,gDAFU,MAAM,CAE8D;AAa9E;;;;GAIG;AACH,mCAFU,MAAM,EAAE,CAMhB"}
|