@woosh/meep-engine 2.108.0 → 2.108.3
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +650 -308
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +650 -308
- package/editor/tools/paint/TerrainHeightPaintTool.js +5 -5
- package/package.json +1 -1
- package/src/core/binary/float_to_uint8.d.ts +7 -0
- package/src/core/binary/float_to_uint8.d.ts.map +1 -0
- package/src/core/binary/{float2uint8.js → float_to_uint8.js} +1 -1
- package/src/core/binary/uint8_to_float.d.ts +7 -0
- package/src/core/binary/uint8_to_float.d.ts.map +1 -0
- package/src/core/binary/{uint82float.js → uint8_to_float.js} +1 -1
- package/src/core/binary/uint8_to_float.spec.d.ts +2 -0
- package/src/core/binary/uint8_to_float.spec.d.ts.map +1 -0
- package/src/core/binary/uint8_to_float.spec.js +7 -0
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts +6 -0
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +15 -3
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +25 -14
- package/src/core/codegen/codeToBlob.d.ts +8 -0
- package/src/core/codegen/codeToBlob.d.ts.map +1 -0
- package/src/core/codegen/codeToBlob.js +36 -0
- package/src/core/codegen/codeToURL.d.ts +8 -0
- package/src/core/codegen/codeToURL.d.ts.map +1 -0
- package/src/core/codegen/codeToURL.js +22 -0
- package/src/core/collection/array/arrayQuickSort.d.ts +0 -9
- package/src/core/collection/array/arrayQuickSort.d.ts.map +1 -1
- package/src/core/collection/array/arrayQuickSort.js +0 -73
- package/src/core/collection/array/array_quick_sort_by_comparator.d.ts +10 -0
- package/src/core/collection/array/array_quick_sort_by_comparator.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_comparator.js +75 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +8 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.js +78 -0
- package/src/core/collection/array/array_shuffle.d.ts +8 -0
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -0
- package/src/core/collection/array/array_shuffle.js +22 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts +2 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts.map +1 -0
- package/src/core/collection/array/{randomizeArrayElementOrder.spec.js → array_shuffle.spec.js} +4 -4
- package/src/core/collection/array/iterator/ArrayIteratorRandom.js +2 -2
- package/src/core/collection/array/randomMultipleFromArray.js +2 -2
- package/src/core/color/Color.js +9 -9
- package/src/core/color/hsv/hsv2rgb.js +4 -4
- package/src/core/color/rgb2uint24.js +4 -4
- package/src/core/color/sRGB/linear_to_sRGB.d.ts +1 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
- package/src/core/color/sRGB/linear_to_sRGB.js +4 -4
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +15 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.js +48 -0
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +4 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +2 -7
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +3 -3
- package/src/core/geom/3d/aabb3_compute_from_triangle.d.ts +11 -0
- package/src/core/geom/3d/aabb3_compute_from_triangle.d.ts.map +1 -0
- package/src/core/geom/3d/aabb3_compute_from_triangle.js +43 -0
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +14 -14
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.js +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +5 -5
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.js +17 -0
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +6 -3
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +56 -18
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.js +11 -4
- package/src/core/geom/3d/tetrahedra/{GetDepthForTetrahedronProbe.glsl → triangle/GetDepthForTetrahedronProbe.glsl} +17 -10
- package/src/core/geom/3d/tetrahedra/triangle/prototype.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/triangle/prototype.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +128 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts +13 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +120 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts +3 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js +106 -0
- package/src/core/geom/Vector3.js +3 -3
- package/src/core/geom/random/randomPointInSphere.d.ts +1 -1
- package/src/core/geom/random/randomPointInSphere.js +2 -2
- package/src/core/geom/random/randomPointOnSphere.d.ts +3 -3
- package/src/core/geom/random/randomPointOnSphere.d.ts.map +1 -1
- package/src/core/geom/random/randomPointOnSphere.js +5 -9
- package/src/core/math/factorial.d.ts +7 -0
- package/src/core/math/factorial.d.ts.map +1 -0
- package/src/core/math/factorial.js +15 -0
- package/src/core/math/factorial.spec.d.ts +2 -0
- package/src/core/math/factorial.spec.d.ts.map +1 -0
- package/src/core/math/factorial.spec.js +9 -0
- package/src/core/model/DebouncedObservedBoolean.d.ts +1 -1
- package/src/core/model/DebouncedObservedBoolean.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeDescription.d.ts +6 -4
- package/src/core/process/task/util/randomCountTask.js +3 -3
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +5 -35
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +7 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.js +17 -10
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +3 -0
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +8 -1
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +4 -4
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +4 -0
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js +3 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +7 -7
- package/src/engine/graphics/filter/sampler2d_flipY_in_place.d.ts +8 -0
- package/src/engine/graphics/filter/sampler2d_flipY_in_place.d.ts.map +1 -0
- package/src/engine/graphics/filter/{FlipArrayInPlace.js → sampler2d_flipY_in_place.js} +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.d.ts.map +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.js +5 -27
- package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +3 -3
- package/src/engine/graphics/render/Lines.d.ts.map +1 -1
- package/src/engine/graphics/render/Lines.js +10 -2
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -6
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +24 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +293 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.js +71 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.js +256 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.js +4 -4
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +12 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -5
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts +2 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -6
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +8 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +3 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +9 -4
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +3 -3
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js +18 -8
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +14 -6
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.js +20 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.js +31 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.js +21 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.js +2 -3
- package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +4 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +116 -19
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/AttributeDataTexture.js +8 -2
- package/src/engine/graphics/texture/computeThreeTextureFormat.js +2 -1
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.d.ts +7 -0
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.d.ts.map +1 -0
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.js +13 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.d.ts +9 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.d.ts.map +1 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.js +31 -0
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -4
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +47 -19
- package/src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.js +5 -33
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.d.ts +11 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.js +41 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts +0 -4
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.js +19 -30
- package/src/engine/network/convertPathToURL.d.ts +3 -1
- package/src/engine/network/convertPathToURL.d.ts.map +1 -1
- package/src/engine/network/convertPathToURL.js +68 -51
- package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
- package/src/engine/physics/fluid/SliceVisualiser.js +4 -4
- package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
- package/src/generation/filtering/numeric/CellFilterCache.js +1 -0
- package/src/core/binary/float2uint8.d.ts +0 -7
- package/src/core/binary/float2uint8.d.ts.map +0 -1
- package/src/core/binary/uint82float.d.ts +0 -7
- package/src/core/binary/uint82float.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.d.ts +0 -2
- package/src/core/binary/uint82float.spec.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.js +0 -7
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts +0 -8
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts.map +0 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +0 -24
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts +0 -2
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts.map +0 -1
- package/src/engine/graphics/filter/FlipArrayInPlace.d.ts +0 -8
- package/src/engine/graphics/filter/FlipArrayInPlace.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts +0 -3
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export class LightProbeVolume {
|
|
2
|
+
get version(): number;
|
|
2
3
|
__positions: any[];
|
|
3
4
|
__mesh: TetrahedralMesh;
|
|
4
5
|
__probe_data: any[];
|
|
@@ -53,10 +54,11 @@ export class LightProbeVolume {
|
|
|
53
54
|
visualize_mesh({ ecd, color, opacity }: EntityComponentDataset): void;
|
|
54
55
|
/**
|
|
55
56
|
*
|
|
56
|
-
* @returns {TaskGroup}
|
|
57
57
|
* @param {EntityComponentDataset} ecd
|
|
58
|
+
* @returns {TaskGroup}
|
|
58
59
|
*/
|
|
59
60
|
build(ecd: EntityComponentDataset): TaskGroup;
|
|
61
|
+
#private;
|
|
60
62
|
}
|
|
61
63
|
import { TetrahedralMesh } from "../../../../core/geom/3d/tetrahedra/TetrahedralMesh.js";
|
|
62
64
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"AAkJA;IAGI,sBAEC;IAGG,mBAAqB;IAErB,wBAAmC;IAEnC,oBAAsB;IAEtB,iBAAiB;IAGrB,cAQC;IAED;;;OAGG;IACH,4BAEC;IAED,oBAEC;IAED,uBAEC;IAMD,uBAEC;IAND,oBAEC;IAMD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAIhB;IAED;;OAEG;IACH,mBAaC;IAGD;;;;OAIG;IACH,mCAHa,SAAS,CA8CrB;IAED;;;;;OAKG;IACH,sEAWC;IAED;;;;;OAKG;IACH,sEAkBC;IAED;;;;OAIG;IACH,oCAFa,SAAS,CAKrB;;CACJ;gCArV+B,wDAAwD;sBAClE,4CAA4C"}
|
|
@@ -42,6 +42,7 @@ class Baker {
|
|
|
42
42
|
this.__min_bounce_count = 3;
|
|
43
43
|
this.__max_bounce_count = 100;
|
|
44
44
|
|
|
45
|
+
// this._ren = new WebGLCubeProbeRenderer();
|
|
45
46
|
this._ren = new PathTracerProbeRenderer();
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -144,6 +145,12 @@ class Baker {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
export class LightProbeVolume {
|
|
148
|
+
#version = 0;
|
|
149
|
+
|
|
150
|
+
get version() {
|
|
151
|
+
return this.#version;
|
|
152
|
+
}
|
|
153
|
+
|
|
147
154
|
constructor() {
|
|
148
155
|
this.__positions = [];
|
|
149
156
|
|
|
@@ -160,6 +167,8 @@ export class LightProbeVolume {
|
|
|
160
167
|
this.__mesh.clear();
|
|
161
168
|
|
|
162
169
|
this.__length = 0;
|
|
170
|
+
|
|
171
|
+
this.#version++;
|
|
163
172
|
}
|
|
164
173
|
|
|
165
174
|
/**
|
|
@@ -273,6 +282,8 @@ export class LightProbeVolume {
|
|
|
273
282
|
|
|
274
283
|
const tFinish = actionTask(() => {
|
|
275
284
|
baker.finish();
|
|
285
|
+
|
|
286
|
+
this.#version++;
|
|
276
287
|
});
|
|
277
288
|
|
|
278
289
|
tFinish.addDependency(tBake);
|
|
@@ -330,8 +341,8 @@ export class LightProbeVolume {
|
|
|
330
341
|
|
|
331
342
|
/**
|
|
332
343
|
*
|
|
333
|
-
* @returns {TaskGroup}
|
|
334
344
|
* @param {EntityComponentDataset} ecd
|
|
345
|
+
* @returns {TaskGroup}
|
|
335
346
|
*/
|
|
336
347
|
build(ecd) {
|
|
337
348
|
this.build_mesh();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAuBA;IACI,mBAA0B;IAC1B,qBAAmB;IACnB,qBAAyB;IAEzB,uBAA6B;IAE7B,iFA2CC;IASD,4BAsCC;CACJ;8BA3G6B,oBAAoB;2BADvB,8BAA8B;gCADzB,mCAAmC"}
|
|
@@ -18,9 +18,12 @@ const __shared_buffer = new ArrayBuffer((27 + 9) * 8);
|
|
|
18
18
|
const sh_basis = new Float64Array(__shared_buffer, 0, 9);
|
|
19
19
|
const coefficients = new Float64Array(__shared_buffer, 9 * 8, 27);
|
|
20
20
|
|
|
21
|
+
const ray = new Float32Array(6);
|
|
22
|
+
const sampled_irradiance = new Float32Array(3);
|
|
23
|
+
|
|
21
24
|
export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
22
25
|
tracer = new PathTracer();
|
|
23
|
-
sample_count =
|
|
26
|
+
sample_count = 256;
|
|
24
27
|
random = seededRandom(0);
|
|
25
28
|
|
|
26
29
|
scene = new PathTracedScene()
|
|
@@ -29,13 +32,9 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
29
32
|
|
|
30
33
|
const tracer = this.tracer;
|
|
31
34
|
|
|
32
|
-
const ray = [];
|
|
33
|
-
|
|
34
|
-
const direct_light = [];
|
|
35
35
|
|
|
36
36
|
array_copy(position, position_offset, ray, 0, 3);
|
|
37
37
|
|
|
38
|
-
const sampled_irradiance = [];
|
|
39
38
|
|
|
40
39
|
coefficients.fill(0);
|
|
41
40
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
+
* @param {LightProbeVolume} volume
|
|
3
4
|
* @param {Engine} engine
|
|
4
5
|
* @param {EntityComponentDataset} ecd
|
|
5
6
|
* @param {AABB3} bounds
|
|
6
7
|
* @param {number} [density]
|
|
7
8
|
* @returns {Promise<LightProbeVolume>}
|
|
8
9
|
*/
|
|
9
|
-
export function build_probes_for_scene({ engine, ecd, bounds, density }:
|
|
10
|
+
export function build_probes_for_scene({ volume, engine, ecd, bounds, density }: LightProbeVolume): Promise<LightProbeVolume>;
|
|
10
11
|
import { LightProbeVolume } from "./LightProbeVolume.js";
|
|
11
12
|
//# sourceMappingURL=build_probes_for_scene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH,iFAPW,gBAAgB,GAKd,QAAQ,gBAAgB,CAAC,CA6GrC;iCAtHgC,uBAAuB"}
|
|
@@ -10,6 +10,7 @@ import { LightProbeVolume } from "./LightProbeVolume.js";
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
|
+
* @param {LightProbeVolume} volume
|
|
13
14
|
* @param {Engine} engine
|
|
14
15
|
* @param {EntityComponentDataset} ecd
|
|
15
16
|
* @param {AABB3} bounds
|
|
@@ -18,6 +19,7 @@ import { LightProbeVolume } from "./LightProbeVolume.js";
|
|
|
18
19
|
*/
|
|
19
20
|
export async function build_probes_for_scene(
|
|
20
21
|
{
|
|
22
|
+
volume = new LightProbeVolume(),
|
|
21
23
|
engine,
|
|
22
24
|
ecd,
|
|
23
25
|
bounds,
|
|
@@ -25,8 +27,6 @@ export async function build_probes_for_scene(
|
|
|
25
27
|
}
|
|
26
28
|
) {
|
|
27
29
|
|
|
28
|
-
const lpv = new LightProbeVolume();
|
|
29
|
-
|
|
30
30
|
// lpv.add_point(10, 5, 10);
|
|
31
31
|
|
|
32
32
|
// const desired_density = 8000;
|
|
@@ -58,7 +58,7 @@ export async function build_probes_for_scene(
|
|
|
58
58
|
// }
|
|
59
59
|
|
|
60
60
|
make_justified_point_grid(model_bounds, probe_grid_spacing, (x, y, z) => {
|
|
61
|
-
|
|
61
|
+
volume.add_point(x, y, z);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
// lpv.add_point(10, 1, -10);
|
|
@@ -68,7 +68,7 @@ export async function build_probes_for_scene(
|
|
|
68
68
|
//
|
|
69
69
|
// console.profile('lpv build');
|
|
70
70
|
//
|
|
71
|
-
const task =
|
|
71
|
+
const task = volume.build(ecd);
|
|
72
72
|
// console.profileEnd('lpv build');
|
|
73
73
|
|
|
74
74
|
const progress = makeSimpleTaskProgressView({
|
|
@@ -119,9 +119,9 @@ export async function build_probes_for_scene(
|
|
|
119
119
|
// 0.2137442, -0.0547578, -0.3061700], 0);
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
console.log(
|
|
122
|
+
console.log(volume);
|
|
123
123
|
|
|
124
124
|
await task.promise();
|
|
125
125
|
|
|
126
|
-
return
|
|
126
|
+
return volume;
|
|
127
127
|
}
|
|
@@ -8,5 +8,13 @@ export function probe_volume_to_textures(lpv: LightProbeVolume): {
|
|
|
8
8
|
probe_positions: AttributeDataTexture;
|
|
9
9
|
probe_values: AttributeDataTexture;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {AttributeDataTexture} target
|
|
14
|
+
* @param {number[]} points
|
|
15
|
+
* @param {number} point_count
|
|
16
|
+
* @param {number} dimensions
|
|
17
|
+
*/
|
|
18
|
+
export function vector_buffer_to_attribute_texture(target: AttributeDataTexture, points: number[], point_count: number, dimensions?: number): void;
|
|
11
19
|
import { AttributeDataTexture } from "../../texture/AttributeDataTexture.js";
|
|
12
20
|
//# sourceMappingURL=probe_volume_to_textures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe_volume_to_textures.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/probe_volume_to_textures.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH;;;;;EAuDC;
|
|
1
|
+
{"version":3,"file":"probe_volume_to_textures.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/probe_volume_to_textures.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH;;;;;EAuDC;AAED;;;;;;GAMG;AACH,2DALW,oBAAoB,UACpB,MAAM,EAAE,eACR,MAAM,eACN,MAAM,QAiBhB;qCAtFoC,uCAAuC"}
|
|
@@ -72,7 +72,7 @@ export function probe_volume_to_textures(lpv) {
|
|
|
72
72
|
* @param {number} point_count
|
|
73
73
|
* @param {number} dimensions
|
|
74
74
|
*/
|
|
75
|
-
function vector_buffer_to_attribute_texture(
|
|
75
|
+
export function vector_buffer_to_attribute_texture(
|
|
76
76
|
target,
|
|
77
77
|
points,
|
|
78
78
|
point_count,
|
|
@@ -83,7 +83,8 @@ function vector_buffer_to_attribute_texture(
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
target.resize(point_count);
|
|
86
|
-
target.build();
|
|
87
86
|
|
|
88
87
|
array_copy(points, 0, target.data, 0, point_count * dimensions);
|
|
88
|
+
|
|
89
|
+
target.texture.needsUpdate = true;
|
|
89
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracedScene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracedScene.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathTracedScene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracedScene.js"],"names":[],"mappings":"AAuBA;IAGI;;;OAGG;IACH,eAFU,GAAG,CAEa;IAE1B;;;OAGG;IACH,QAFU,IAAI,MAAM,EAAE,cAAc,CAAC,CAElB;IAEnB;;;OAGG;IACH,UAFU,aAAa,EAAE,CAEX;IAEd;;;OAGG;IACH,WAFU,IAAI,MAAM,cAAc,EAAE,kBAAkB,CAAC,CAEjC;IAEtB;;;OAGG;IACH,UAFU,IAAI,MAAM,YAAY,CAEX;IAGrB;;;;OAIG;IACH,6BAA6C;IAE7C,iBAGC;IAED,uBAqCC;IAED;;;;OAIG;IACH,uBAHW,MAAM,cAAc,GACnB,kBAAkB,CAmB7B;IAED;;;OAGG;IACH,gBAFW,aAAa,QAMvB;IAED;;;;;OAKG;IACH,aAJW,MAAM,cAAc,YACpB,MAAM,QAAQ,aACd,OAAK,MAAM,EAAE,QA6CvB;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,OACR,MAAM,EAAE,QAyBlB;IAED;;;;;;;OAOG;IACH,WANW,MAAM,EAAE,OACR,MAAM,EAAE,gBACR,MAAM,gBACN,MAAM,GACL,MAAM,CAwCjB;IAED;;;;;;OAMG;IACH,uBALW,MAAM,EAAE,cACR,MAAM,aACN,MAAM,EAAE,oBACR,MAAM,QAIhB;IAED;;;;;;;OAOG;IACH,mBANW,MAAM,EAAE,cACR,MAAM,OACN,MAAM,EAAE,eACR,MAAM,GACJ,OAAO,CAmEnB;CACJ;oBAnWmB,mCAAmC;+BAcxB,qBAAqB;8BALtB,kDAAkD;mCAG7C,yBAAyB"}
|
|
@@ -7,6 +7,7 @@ import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matri
|
|
|
7
7
|
import { ray3_array_compose } from "../../../../core/geom/3d/ray/ray3_array_compose.js";
|
|
8
8
|
import { v3_dot } from "../../../../core/geom/vec3/v3_dot.js";
|
|
9
9
|
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
10
|
+
import { compute_geometry_polycount } from "../../geometry/compute_geometry_polycount.js";
|
|
10
11
|
import { AbstractLight } from "../../render/forward_plus/model/AbstractLight.js";
|
|
11
12
|
import { convertTexture2Sampler2D } from "../../texture/sampler/convertTexture2Sampler2D.js";
|
|
12
13
|
import { ensureGeometryBoundingBox } from "../../util/ensureGeometryBoundingBox.js";
|
|
@@ -67,6 +68,7 @@ export class PathTracedScene {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
async build() {
|
|
71
|
+
|
|
70
72
|
for (const [id, mesh] of this.meshes) {
|
|
71
73
|
const material = mesh.material;
|
|
72
74
|
|
|
@@ -116,13 +118,16 @@ export class PathTracedScene {
|
|
|
116
118
|
return cached;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
const
|
|
121
|
+
const bvh = new GeometryBVHBatched();
|
|
120
122
|
|
|
121
|
-
|
|
123
|
+
const label = `bvh build ${compute_geometry_polycount(geo)}`;
|
|
124
|
+
console.time(label);
|
|
125
|
+
bvh.build(geo);
|
|
126
|
+
console.timeEnd(label);
|
|
122
127
|
|
|
123
|
-
this.geo_cache.set(geo,
|
|
128
|
+
this.geo_cache.set(geo, bvh);
|
|
124
129
|
|
|
125
|
-
return
|
|
130
|
+
return bvh;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export class PathTracer {
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @param {number[]} out
|
|
5
|
-
* @param {number[]} ray
|
|
4
|
+
* @param {number[]|Float32Array} out
|
|
5
|
+
* @param {number[]|Float32Array} ray
|
|
6
6
|
* @param {number} max_distance
|
|
7
7
|
* @param {number} min_bounce
|
|
8
8
|
* @param {number} max_bounce
|
|
9
9
|
* @param {function} random
|
|
10
10
|
* @param {PathTracedScene} scene
|
|
11
11
|
*/
|
|
12
|
-
path_trace(out: number[], ray: number[], max_distance: number, min_bounce: number, max_bounce: number, random: Function, scene: PathTracedScene): void;
|
|
12
|
+
path_trace(out: number[] | Float32Array, ray: number[] | Float32Array, max_distance: number, min_bounce: number, max_bounce: number, random: Function, scene: PathTracedScene): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=PathTracer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracer.js"],"names":[],"mappings":"AA2BA;IAGI;;;;;;;;;OASG;IACH,gBARW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"PathTracer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracer.js"],"names":[],"mappings":"AA2BA;IAGI;;;;;;;;;OASG;IACH,gBARW,MAAM,EAAE,GAAC,YAAY,OACrB,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,cACN,MAAM,cACN,MAAM,kDAgFhB;CACJ"}
|
|
@@ -30,8 +30,8 @@ export class PathTracer {
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
|
-
* @param {number[]} out
|
|
34
|
-
* @param {number[]} ray
|
|
33
|
+
* @param {number[]|Float32Array} out
|
|
34
|
+
* @param {number[]|Float32Array} ray
|
|
35
35
|
* @param {number} max_distance
|
|
36
36
|
* @param {number} min_bounce
|
|
37
37
|
* @param {number} max_bounce
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {number[]|ArrayLike<number>} positions
|
|
7
7
|
* @param {number} index_offset
|
|
8
8
|
* @param {number} index_count
|
|
9
|
-
* @param {number}
|
|
9
|
+
* @param {number} dimension_count
|
|
10
10
|
*/
|
|
11
|
-
export function compute_triangle_group_aabb3(output: number[] | Float32Array, output_offset: number, indices: number[] | ArrayLike<number>, positions: number[] | ArrayLike<number>, index_offset: number, index_count: number,
|
|
11
|
+
export function compute_triangle_group_aabb3(output: number[] | Float32Array, output_offset: number, indices: number[] | ArrayLike<number>, positions: number[] | ArrayLike<number>, index_offset: number, index_count: number, dimension_count: number): void;
|
|
12
12
|
//# sourceMappingURL=compute_triangle_group_aabb3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_triangle_group_aabb3.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,qDARW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,WACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,aAC1B,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,gBAC1B,MAAM,eACN,MAAM,
|
|
1
|
+
{"version":3,"file":"compute_triangle_group_aabb3.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,qDARW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,WACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,aAC1B,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,gBAC1B,MAAM,eACN,MAAM,mBACN,MAAM,QAkChB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { min2 } from "../../../../core/math/min2.js";
|
|
2
1
|
import { max2 } from "../../../../core/math/max2.js";
|
|
2
|
+
import { min2 } from "../../../../core/math/min2.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Compute AABB for a group of triangles based on index-buffer
|
|
@@ -9,27 +9,37 @@ import { max2 } from "../../../../core/math/max2.js";
|
|
|
9
9
|
* @param {number[]|ArrayLike<number>} positions
|
|
10
10
|
* @param {number} index_offset
|
|
11
11
|
* @param {number} index_count
|
|
12
|
-
* @param {number}
|
|
12
|
+
* @param {number} dimension_count
|
|
13
13
|
*/
|
|
14
|
-
export function compute_triangle_group_aabb3(
|
|
14
|
+
export function compute_triangle_group_aabb3(
|
|
15
|
+
output,
|
|
16
|
+
output_offset,
|
|
17
|
+
indices,
|
|
18
|
+
positions,
|
|
19
|
+
index_offset,
|
|
20
|
+
index_count,
|
|
21
|
+
dimension_count
|
|
22
|
+
) {
|
|
15
23
|
|
|
16
24
|
let i = 0;
|
|
17
|
-
for (; i <
|
|
25
|
+
for (; i < dimension_count; i++) {
|
|
26
|
+
// min bound
|
|
18
27
|
output[output_offset + i] = Infinity;
|
|
19
|
-
|
|
28
|
+
// max bound
|
|
29
|
+
output[output_offset + i + dimension_count] = -Infinity;
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
for (i = 0; i < index_count; i++) {
|
|
23
33
|
for (let j = 0; j < 3; j++) {
|
|
24
34
|
const index = indices[index_offset + i * 3 + j];
|
|
25
35
|
|
|
26
|
-
const i3 = index *
|
|
36
|
+
const i3 = index * dimension_count;
|
|
27
37
|
|
|
28
|
-
for (let k = 0; k <
|
|
38
|
+
for (let k = 0; k < dimension_count; k++) {
|
|
29
39
|
const v = positions[i3 + k];
|
|
30
40
|
|
|
31
41
|
output[output_offset + k] = min2(output[output_offset + k], v);
|
|
32
|
-
output[output_offset + k +
|
|
42
|
+
output[output_offset + k + dimension_count] = max2(output[output_offset + k + dimension_count], v);
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
}
|
|
@@ -11,9 +11,10 @@ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
|
11
11
|
import { PLYLoader } from "three/examples/jsm/loaders/PLYLoader.js";
|
|
12
12
|
|
|
13
13
|
import '../../../../../../../../css/game.scss';
|
|
14
|
-
import {
|
|
14
|
+
import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
|
|
15
15
|
import { Color } from "../../../../core/color/Color.js";
|
|
16
16
|
import { kelvin_to_rgb } from "../../../../core/color/kelvin/kelvin_to_rgb.js";
|
|
17
|
+
import { linear_to_sRGB } from "../../../../core/color/sRGB/linear_to_sRGB.js";
|
|
17
18
|
|
|
18
19
|
import { noop } from "../../../../core/function/noop.js";
|
|
19
20
|
import { ray3_array_compose } from "../../../../core/geom/3d/ray/ray3_array_compose.js";
|
|
@@ -72,7 +73,7 @@ vCanvas.css({
|
|
|
72
73
|
* How many rays to use per-pixel
|
|
73
74
|
* @type {number}
|
|
74
75
|
*/
|
|
75
|
-
const PIXEL_SAMPLE_COUNT =
|
|
76
|
+
const PIXEL_SAMPLE_COUNT = 64;
|
|
76
77
|
|
|
77
78
|
const scene = new PathTracedScene();
|
|
78
79
|
const pt = new PathTracer();
|
|
@@ -428,7 +429,8 @@ function* render(target, pt, camera, scene, progress = { current: 0, total: 0 })
|
|
|
428
429
|
|
|
429
430
|
const pixel_address = ((max_y - y) * width + x) * 4;
|
|
430
431
|
|
|
431
|
-
|
|
432
|
+
const output_data = target.data;
|
|
433
|
+
output_data[pixel_address + 3] = 255;
|
|
432
434
|
|
|
433
435
|
for (let i = 0; i < pixel_sample_count; i++) {
|
|
434
436
|
|
|
@@ -454,9 +456,15 @@ function* render(target, pt, camera, scene, progress = { current: 0, total: 0 })
|
|
|
454
456
|
sample_count++;
|
|
455
457
|
}
|
|
456
458
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
459
|
+
pixel_accummulation[0] /= pixel_sample_count
|
|
460
|
+
pixel_accummulation[1] /= pixel_sample_count
|
|
461
|
+
pixel_accummulation[2] /= pixel_sample_count
|
|
462
|
+
|
|
463
|
+
linear_to_sRGB(pixel_accummulation, 0, pixel_accummulation, 0);
|
|
464
|
+
|
|
465
|
+
output_data[pixel_address] = float_to_uint8(pixel_accummulation[0]);
|
|
466
|
+
output_data[pixel_address + 1] = float_to_uint8(pixel_accummulation[1]);
|
|
467
|
+
output_data[pixel_address + 2] = float_to_uint8(pixel_accummulation[2]);
|
|
460
468
|
|
|
461
469
|
|
|
462
470
|
progress.current++;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number} result_stride
|
|
6
|
+
* @param {number} num_samples
|
|
7
|
+
* @param {function():number} random
|
|
8
|
+
*/
|
|
9
|
+
export function generate_stratified_samples(result: number[], result_offset: number, result_stride: number, num_samples: number, random: () => number): void;
|
|
10
|
+
//# sourceMappingURL=generate_stratified_samples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_stratified_samples.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,oDANW,MAAM,EAAE,iBACR,MAAM,iBACN,MAAM,eACN,MAAM,gBACK,MAAM,QAW3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { make_stratified_sample } from "./make_stratified_sample.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {number} result_stride
|
|
8
|
+
* @param {number} num_samples
|
|
9
|
+
* @param {function():number} random
|
|
10
|
+
*/
|
|
11
|
+
export function generate_stratified_samples(result, result_offset, result_stride, num_samples, random) {
|
|
12
|
+
|
|
13
|
+
const delta = 1 / num_samples;
|
|
14
|
+
|
|
15
|
+
for (let i = 0; i < num_samples; ++i) {
|
|
16
|
+
|
|
17
|
+
result[result_offset + i * result_stride] = make_stratified_sample(i, delta, random);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on https://github.com/TheRealMJP/DXRPathTracer/blob/e01b893c76ad629fa6e715d35b98901f5195d000/SampleFramework12/v1.02/Graphics/Sampling.cpp#L440
|
|
3
|
+
* @param {number[]} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number} num_samples_x
|
|
6
|
+
* @param {number} num_samples_y
|
|
7
|
+
* @param {function():number} random
|
|
8
|
+
*/
|
|
9
|
+
export function generate_stratified_samples_2d(result: number[], result_offset: number, num_samples_x: number, num_samples_y: number, random: () => number): number;
|
|
10
|
+
//# sourceMappingURL=generate_stratified_samples_2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_stratified_samples_2d.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,uDANW,MAAM,EAAE,iBACR,MAAM,iBACN,MAAM,iBACN,MAAM,gBACK,MAAM,UAqB3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { make_stratified_sample } from "./make_stratified_sample.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Based on https://github.com/TheRealMJP/DXRPathTracer/blob/e01b893c76ad629fa6e715d35b98901f5195d000/SampleFramework12/v1.02/Graphics/Sampling.cpp#L440
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {number} num_samples_x
|
|
8
|
+
* @param {number} num_samples_y
|
|
9
|
+
* @param {function():number} random
|
|
10
|
+
*/
|
|
11
|
+
export function generate_stratified_samples_2d(result, result_offset, num_samples_x, num_samples_y, random) {
|
|
12
|
+
|
|
13
|
+
const delta_x = 1 / num_samples_x;
|
|
14
|
+
const delta_y = 1 / num_samples_y;
|
|
15
|
+
|
|
16
|
+
let sample_index = 0;
|
|
17
|
+
for (let y = 0; y < num_samples_y; y++) {
|
|
18
|
+
for (let x = 0; x < num_samples_x; x++) {
|
|
19
|
+
|
|
20
|
+
const address = result_offset + sample_index * 2;
|
|
21
|
+
|
|
22
|
+
result[address] = make_stratified_sample(x, delta_x, random);
|
|
23
|
+
result[address + 1] = make_stratified_sample(y, delta_y, random);
|
|
24
|
+
|
|
25
|
+
++sample_index;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return sample_index;
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} index
|
|
4
|
+
* @param {number} delta
|
|
5
|
+
* @param {function} random
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
export function make_stratified_sample(index: number, delta: number, random: Function): number;
|
|
9
|
+
//# sourceMappingURL=make_stratified_sample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_stratified_sample.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,8CALW,MAAM,SACN,MAAM,qBAEL,MAAM,CAWjB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clamp } from "../../../../../core/math/clamp.js";
|
|
2
|
+
|
|
3
|
+
const ONE_MINUS_EPSILON = 0.999999;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {number} index
|
|
8
|
+
* @param {number} delta
|
|
9
|
+
* @param {function} random
|
|
10
|
+
* @return {number}
|
|
11
|
+
*/
|
|
12
|
+
export function make_stratified_sample(index, delta, random) {
|
|
13
|
+
|
|
14
|
+
let sample = index + random();
|
|
15
|
+
|
|
16
|
+
sample *= delta;
|
|
17
|
+
|
|
18
|
+
sample = clamp(sample, 0, ONE_MINUS_EPSILON);
|
|
19
|
+
|
|
20
|
+
return sample;
|
|
21
|
+
}
|
|
@@ -64,7 +64,7 @@ export function sample_material(
|
|
|
64
64
|
|
|
65
65
|
const material = mesh.material;
|
|
66
66
|
|
|
67
|
-
if (material.isMeshStandardMaterial) {
|
|
67
|
+
if (material.isMeshStandardMaterial || material.isMeshBasicMaterial) {
|
|
68
68
|
const material_color = material.color;
|
|
69
69
|
|
|
70
70
|
out[0] *= material_color.r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample_texture.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/sample_texture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sample_texture.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/sample_texture.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,oCANW,MAAM,EAAE,GAAC,YAAY,2CAGrB,MAAM,KACN,MAAM,QAoChB"}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
sRGBEncoding,
|
|
8
8
|
UnsignedByteType
|
|
9
9
|
} from "three";
|
|
10
|
-
import { linear_to_sRGB } from "../../../../../core/color/sRGB/linear_to_sRGB.js";
|
|
11
10
|
import { vec3_uint8_to_float } from "../vec3_uint8_to_float.js";
|
|
12
11
|
import { apply_texture_clamping_to_coordinate } from "./apply_texture_clamping_to_coordinate.js";
|
|
13
12
|
|
|
@@ -50,7 +49,7 @@ export function sample_texture(out, sampler, texture, u, v) {
|
|
|
50
49
|
if (texture_encoding === LinearEncoding) {
|
|
51
50
|
// nothing
|
|
52
51
|
} else if (texture_encoding === sRGBEncoding) {
|
|
53
|
-
// convert value to
|
|
54
|
-
|
|
52
|
+
// convert value to linear space
|
|
53
|
+
// sRGB_to_linear(out, 0, out, 0);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uint8_to_float } from "../../../../core/binary/uint8_to_float.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ import { uint82float } from "../../../../core/binary/uint82float.js";
|
|
|
6
6
|
* @param {number[]} input
|
|
7
7
|
*/
|
|
8
8
|
export function vec3_uint8_to_float(out, input) {
|
|
9
|
-
out[0] =
|
|
10
|
-
out[1] =
|
|
11
|
-
out[2] =
|
|
9
|
+
out[0] = uint8_to_float(input[0]);
|
|
10
|
+
out[1] = uint8_to_float(input[1]);
|
|
11
|
+
out[2] = uint8_to_float(input[2]);
|
|
12
12
|
}
|