@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,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Unit sphere sampling
|
|
3
3
|
* @see based on python code suggested here: https://stackoverflow.com/questions/5408276/sampling-uniformly-distributed-random-points-inside-a-spherical-volume
|
|
4
4
|
* @param {function} random
|
|
5
|
-
* @param {number[]} result
|
|
5
|
+
* @param {number[]|Float32Array} result
|
|
6
6
|
* @param {number} result_offset
|
|
7
7
|
*/
|
|
8
8
|
export function randomPointOnSphere(random, result, result_offset) {
|
|
@@ -14,14 +14,10 @@ export function randomPointOnSphere(random, result, result_offset) {
|
|
|
14
14
|
|
|
15
15
|
const sinTheta = Math.sin(theta);
|
|
16
16
|
|
|
17
|
-
const r = 0.5;
|
|
18
|
-
|
|
19
17
|
//compute coordinates
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const y = rst * Math.sin(phi);
|
|
24
|
-
const z = r * cosTheta;
|
|
18
|
+
const x = sinTheta * Math.cos(phi);
|
|
19
|
+
const y = sinTheta * Math.sin(phi);
|
|
20
|
+
const z = cosTheta;
|
|
25
21
|
|
|
26
22
|
//write the result
|
|
27
23
|
result[result_offset] = x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factorial.d.ts","sourceRoot":"","sources":["../../../../src/core/math/factorial.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,6BAHW,MAAM,GACL,MAAM,CAWjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factorial.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/math/factorial.spec.js"],"names":[],"mappings":""}
|
|
@@ -17,7 +17,7 @@ export class DebouncedObservedBoolean extends ObservedBoolean {
|
|
|
17
17
|
constructor(source: ObservedBoolean, time: number, mode?: DebouncedObservedBooleanMode | number);
|
|
18
18
|
__source: ObservedBoolean;
|
|
19
19
|
time: number;
|
|
20
|
-
__timeout: NodeJS.
|
|
20
|
+
__timeout: NodeJS.Timer;
|
|
21
21
|
mode: number;
|
|
22
22
|
link(): void;
|
|
23
23
|
unlink(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebouncedObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/DebouncedObservedBoolean.js"],"names":[],"mappings":"2CAYU,MAAM;;;;;;AAQhB;;GAEG;AACH;IACI;;;;;OAKG;IACH,oBAJW,eAAe,QACf,MAAM,SACN,4BAA4B,GAAC,MAAM,EAY7C;IAPG,0BAAsB;IAEtB,aAAgB;IAEhB,
|
|
1
|
+
{"version":3,"file":"DebouncedObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/DebouncedObservedBoolean.js"],"names":[],"mappings":"2CAYU,MAAM;;;;;;AAQhB;;GAEG;AACH;IACI;;;;;OAKG;IACH,oBAJW,eAAe,QACf,MAAM,SACN,4BAA4B,GAAC,MAAM,EAY7C;IAPG,0BAAsB;IAEtB,aAAgB;IAEhB,wBAAqB;IAErB,aAAgB;IAGpB,aAGC;IAED,eAGC;IAGD;;;OAGG;IACH,uBAKC;IAED;;OAEG;IACH,0BAOC;IAED;;;OAGG;IACH,OAFW,OAAO,QAYjB;IANO,aAAgB;IAQxB;;;;;OAKG;IACH,6BAYC;IAED,gBAEC;CAEJ;4BAhH2B,sBAAsB"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {Port} from "./Port";
|
|
2
1
|
import {DataType} from "../DataType";
|
|
2
|
+
import {Port} from "./Port";
|
|
3
3
|
import {PortDirection} from "./PortDirection";
|
|
4
4
|
|
|
5
5
|
export class NodeDescription {
|
|
6
6
|
|
|
7
|
-
readonly inPorts:Port[]
|
|
8
|
-
readonly outPorts:Port[]
|
|
7
|
+
readonly inPorts: Port[]
|
|
8
|
+
readonly outPorts: Port[]
|
|
9
9
|
|
|
10
10
|
getPorts(): Port[]
|
|
11
11
|
|
|
12
|
-
createPort(type: DataType, name:string,direction:PortDirection): number
|
|
12
|
+
createPort(type: DataType, name: string, direction: PortDirection): number
|
|
13
|
+
|
|
14
|
+
toJSON(): any
|
|
13
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { array_shuffle } from "../../../collection/array/array_shuffle.js";
|
|
1
2
|
import { seededRandom } from "../../../math/random/seededRandom.js";
|
|
2
|
-
import { TaskSignal } from "../TaskSignal.js";
|
|
3
3
|
import Task from "../Task.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TaskSignal } from "../TaskSignal.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -49,7 +49,7 @@ export function randomCountTask(seed, initial, limit, callback) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
//shuffle
|
|
52
|
-
|
|
52
|
+
array_shuffle(random, sequence);
|
|
53
53
|
},
|
|
54
54
|
cycleFunction: cycle,
|
|
55
55
|
computeProgress: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerBuilder.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"WorkerBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerBuilder.js"],"names":[],"mappings":";AAQA;IAEI,eAAa;IACb,YAAa;IACb,iBAAe;IACf,sBAA6B;IAE7B;;;OAGG;IACH,cAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,WAAS,MAAM,QAIzB;IAED;;;;;OAKG;IACH,6CAKC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,SAFa,WAAW,CAyGvB;CACJ;wBAjKuB,8BAA8B;wBAC9B,kBAAkB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { convertPathToURL } from "../../../engine/network/convertPathToURL.js";
|
|
2
|
+
import { codeToURL } from "../../codegen/codeToURL.js";
|
|
2
3
|
import LineBuilder from "../../codegen/LineBuilder.js";
|
|
3
4
|
import WorkerProxy from "./WorkerProxy.js";
|
|
4
5
|
|
|
5
6
|
const RxMatchFunctionName = /(function\s*)([a-zA-Z0-9_]+)?(\s*\([^\]]*\)\s*\{.*)/g;
|
|
6
7
|
|
|
8
|
+
|
|
7
9
|
class WorkerBuilder {
|
|
8
10
|
|
|
9
11
|
imports = [];
|
|
@@ -46,9 +48,9 @@ class WorkerBuilder {
|
|
|
46
48
|
* @param {string} path
|
|
47
49
|
*/
|
|
48
50
|
importScript(path) {
|
|
49
|
-
|
|
51
|
+
const qualified_path = convertPathToURL(path);
|
|
50
52
|
|
|
51
|
-
this.imports.push(
|
|
53
|
+
this.imports.push(qualified_path);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -58,7 +60,7 @@ class WorkerBuilder {
|
|
|
58
60
|
build() {
|
|
59
61
|
const codeLines = [];
|
|
60
62
|
|
|
61
|
-
codeLines.push('var globalScope =
|
|
63
|
+
codeLines.push('var globalScope = globalThis;');
|
|
62
64
|
|
|
63
65
|
//handle imports
|
|
64
66
|
this.imports.forEach(function (url) {
|
|
@@ -161,36 +163,4 @@ class WorkerBuilder {
|
|
|
161
163
|
}
|
|
162
164
|
};
|
|
163
165
|
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param {string} code
|
|
167
|
-
* @return {string}
|
|
168
|
-
*/
|
|
169
|
-
function codeToURL(code) {
|
|
170
|
-
const js_mime = 'application/javascript';
|
|
171
|
-
|
|
172
|
-
let blob;
|
|
173
|
-
|
|
174
|
-
if (typeof window === 'object') {
|
|
175
|
-
if (typeof window.Blob !== "undefined") {
|
|
176
|
-
blob = new Blob([code], {type: js_mime});
|
|
177
|
-
} else {
|
|
178
|
-
// Backwards-compatibility
|
|
179
|
-
const BlobBuilder = window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
|
|
180
|
-
if (BlobBuilder !== undefined) {
|
|
181
|
-
blob = new BlobBuilder();
|
|
182
|
-
blob.append(code);
|
|
183
|
-
blob = blob.getBlob();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (blob !== undefined && URL.createObjectURL !== undefined) {
|
|
189
|
-
return URL.createObjectURL(blob);
|
|
190
|
-
} else {
|
|
191
|
-
// build data URL in a slowest way possible
|
|
192
|
-
return `data:${js_mime},${encodeURIComponent(code)}`;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
166
|
export default WorkerBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"AA6DA;IAmBI;;;OAGG;IACH,6BAFW,MAAM,QAYhB;IAkED;;;;;;;;;;;;;OAaG;IACH;QAZyB,MAAM,EAApB,MAAM;QACyB,GAAG;QAClB,MAAM,GAAtB,OAAO;QACQ,QAAQ,GAAvB,MAAM;QACS,KAAK,GAApB,MAAM;QACS,GAAG,GAAlB,MAAM;QACU,QAAQ,GAAxB,OAAO;QACQ,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACJ,MAAM,CA+DlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oQAnBW,MAAM,iBAmFhB;IAGD;;;;;;;;;;OAUG;IACH;QATyB,MAAM,EAApB,MAAM;QACyB,GAAG;QACnB,mBAAmB,GAAlC,MAAM;QACU,UAAU,GAA1B,OAAO;QACO,GAAG,GAAjB,KAAK;QACU,YAAY,GAA3B,MAAM;QACQ,OAAO,GAArB,KAAK;QACU,gBAAgB,GAA/B,MAAM;sBAqDhB;IAED;;;;;;;OAOG;IACH;QAN0B,YAAY,GAA3B,MAAM;QACQ,MAAM,EAApB,MAAM;QACS,WAAW,GAA1B,MAAM;QACyB,GAAG;QAChC,MAAM,CA2ClB;IAGD;;;;;;;;;;;OAWG;IACH,mGAVW,MAAM,GAQJ,OAAO,CAuDnB;IA3bG;;;OAGG;IACH,QAFU,MAAM,CAEiC;IAMjD;;;OAGG;IACH,YAFU,eAAQ,IAAI,CAET;IAmBjB;;;;OAIG;IACH,8DAJmB,mBAAmB,UAAQ,MAAM,WAEvC,QAAQ,MAAM,CAAC,CA2D3B;CA6VJ;;IAID;;;OAGG;IACH,uCAMC;;mBA1fkB,aAAa;oCACI,0BAA0B;oBAX1C,yBAAyB;mBAK1B,iBAAiB;sBATd,wBAAwB;oBAW1B,8BAA8B"}
|
|
@@ -53,6 +53,12 @@ function setLocale(engine) {
|
|
|
53
53
|
return engine.localization.loadLocale(locale);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Equal to ~ 5500 K light color
|
|
58
|
+
* @type {Readonly<Color>}
|
|
59
|
+
*/
|
|
60
|
+
const DEFAULT_SUNLIGHT_COLOR = Object.freeze(new Color(1, 0.93, 0.87));
|
|
61
|
+
|
|
56
62
|
export class EngineHarness {
|
|
57
63
|
constructor() {
|
|
58
64
|
/**
|
|
@@ -333,7 +339,7 @@ export class EngineHarness {
|
|
|
333
339
|
ecd = engine.entityManager.dataset,
|
|
334
340
|
shadowmapResolution = 1024,
|
|
335
341
|
castShadow = true,
|
|
336
|
-
sun =
|
|
342
|
+
sun = DEFAULT_SUNLIGHT_COLOR,
|
|
337
343
|
sunIntensity = 0.9,
|
|
338
344
|
sunDirection = new Vector3(0.1, -1, 0.1),
|
|
339
345
|
ambient = Color.white,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayBufferLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/ArrayBufferLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArrayBufferLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/ArrayBufferLoader.js"],"names":[],"mappings":"AAyFA;IACI;;;OAGG;IACH,iCAFW,MAAM,GAAC,KAAK,GAAC,MAAM,EAa7B;IANG;;;;OAIG;IACH,yBAAsC;IAG1C;;;oDA0DC;CACJ;4BAlK2B,kBAAkB;qBAJzB,gCAAgC;sBAC/B,aAAa"}
|
|
@@ -13,20 +13,19 @@ import { AssetLoader } from "./AssetLoader.js";
|
|
|
13
13
|
function observeResponseProgress(input, progress) {
|
|
14
14
|
let response = input
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
if (typeof ReadableStream === 'undefined' || response.body.getReader === undefined) {
|
|
16
|
+
// Workaround: Checking if response.body === undefined for Alipay browser
|
|
17
|
+
if (typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined) {
|
|
18
18
|
|
|
19
19
|
return response;
|
|
20
20
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const reader = response.body.getReader();
|
|
23
|
+
// Nginx needs X-File-Size check
|
|
24
|
+
// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
|
|
25
|
+
const contentLength = response.headers.get('Content-Length') || response.headers.get('X-File-Size');
|
|
27
26
|
|
|
28
|
-
const contentLength = response.headers.get('Content-Length');
|
|
29
27
|
const total = contentLength ? parseInt(contentLength) : 0;
|
|
28
|
+
|
|
30
29
|
let loaded = 0;
|
|
31
30
|
|
|
32
31
|
// periodically read data into the new stream tracking while download progress
|
|
@@ -34,6 +33,11 @@ function observeResponseProgress(input, progress) {
|
|
|
34
33
|
type: "bytes",
|
|
35
34
|
start(controller) {
|
|
36
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @type {ReadableStreamDefaultReader<Uint8Array>}
|
|
38
|
+
*/
|
|
39
|
+
const reader = response.body.getReader();
|
|
40
|
+
|
|
37
41
|
pump();
|
|
38
42
|
|
|
39
43
|
function pump() {
|
|
@@ -51,6 +55,7 @@ function observeResponseProgress(input, progress) {
|
|
|
51
55
|
progress(loaded, total);
|
|
52
56
|
|
|
53
57
|
controller.enqueue(value);
|
|
58
|
+
|
|
54
59
|
pump();
|
|
55
60
|
|
|
56
61
|
});
|
|
@@ -123,16 +128,18 @@ export class ArrayBufferLoader extends AssetLoader {
|
|
|
123
128
|
|
|
124
129
|
let response = await fetch(request);
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
const response_status = response.status;
|
|
132
|
+
|
|
133
|
+
if (response_status !== 200 && response_status !== 0) {
|
|
127
134
|
|
|
128
|
-
throw Error(`fetch for "${response.url}" responded with ${
|
|
135
|
+
throw Error(`fetch for "${response.url}" responded with ${response_status}: ${response.statusText}`);
|
|
129
136
|
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
// Some browsers return HTTP Status 0 when using non-http protocol
|
|
133
140
|
// e.g. 'file://' or 'data://'. Handle as success.
|
|
134
141
|
|
|
135
|
-
if (
|
|
142
|
+
if (response_status === 0) {
|
|
136
143
|
|
|
137
144
|
console.warn('HTTP Status 0 received.');
|
|
138
145
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextureAttachmensByMaterialType.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"TextureAttachmensByMaterialType.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,mDA8FE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACtC,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GACpC,OAAO,CA8DnB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
|
|
2
1
|
import { fastArrayEquals } from "../../../../core/collection/array/fastArrayEquals.js";
|
|
2
|
+
import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
|
|
3
|
+
import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
|
|
3
4
|
|
|
4
5
|
//
|
|
5
6
|
|
|
@@ -120,6 +121,12 @@ export function textureImagesEqual(a, b) {
|
|
|
120
121
|
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
if (isTypedArray(a.data) && isTypedArray(b.data)) {
|
|
125
|
+
if (!textureMipmapEqual(a, b)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
// assume equivalent
|
|
124
131
|
return true;
|
|
125
132
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, NearestFilter } from "three";
|
|
2
2
|
import { assert } from "../../../../core/assert.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
|
|
4
|
+
import { uint8_to_float } from "../../../../core/binary/uint8_to_float.js";
|
|
5
5
|
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
6
6
|
import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
|
|
7
7
|
import Vector1 from "../../../../core/geom/Vector1.js";
|
|
@@ -203,7 +203,7 @@ export class TerrainOverlay {
|
|
|
203
203
|
for (let i = 0; i < 4; i++) {
|
|
204
204
|
const v = this.sampler.readChannel(x, y, i);
|
|
205
205
|
|
|
206
|
-
result[i] =
|
|
206
|
+
result[i] = uint8_to_float(v);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -250,7 +250,7 @@ export class TerrainOverlay {
|
|
|
250
250
|
paintPoint(x, y, vec4) {
|
|
251
251
|
for (let i = 0; i < 4; i++) {
|
|
252
252
|
|
|
253
|
-
this.sampler.writeChannel(x, y, i,
|
|
253
|
+
this.sampler.writeChannel(x, y, i, float_to_uint8(vec4[i]));
|
|
254
254
|
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopDownCameraController.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TopDownCameraController.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,iDALW,MAAM,kBACN,MAAM,SACN,uBAAuB,UACvB,uBAAuB,QAejC;;AAiED;IAmJI,iDAMC;IAxJD,0BAeC;IAdG,gBAA2B;IAE3B,cAAc;IACd,YAAY;IACZ,aAAa;IAEb,iBAAiB;IACjB,oBAAoB;IACpB,oBAAsB;IAQ1B;;;;;OAKG;IACH,yBAJW,OAAO,UACP,OAAO,OACP,OAAO,QAsBjB;IAED;;;;OAIG;IACH,cAHW,uBAAuB,GACrB,OAAO,CAWnB;IAED;;;OAGG;IACH,YAFW,uBAAuB,QAYjC;IAED;;;OAGG;IACH,SAFa,uBAAuB,CAQnC;IAED;;;;;OAKG;IACH,QAJW,uBAAuB,KACvB,uBAAuB,KACvB,MAAM,QAahB;IAED;;;;;;;;MAYC;IAED;;;;;;;;aAsBC;CASJ;;;;;;oBAzPmB,qCAAqC;AAuEzD;;;;;;;;;GASG;AACH,gEANW,OAAO,kBACP,MAAM,OACN,MAAM,UACN,OAAO,eACP,OAAO,QAajB"}
|
|
@@ -4,6 +4,7 @@ import { eulerAnglesFromMatrix } from "../../../../../core/geom/3d/eulerAnglesFr
|
|
|
4
4
|
import { normalize_angle_rad } from "../../../../../core/geom/normalize_angle_rad.js";
|
|
5
5
|
import Vector3 from '../../../../../core/geom/Vector3.js';
|
|
6
6
|
import { lerp } from "../../../../../core/math/lerp.js";
|
|
7
|
+
import { max2 } from "../../../../../core/math/max2.js";
|
|
7
8
|
|
|
8
9
|
const m4 = new Matrix4();
|
|
9
10
|
const angles = [];
|
|
@@ -136,6 +137,9 @@ class TopDownCameraController {
|
|
|
136
137
|
|
|
137
138
|
this.distance = eye.distanceTo(target);
|
|
138
139
|
|
|
140
|
+
// ensure we can maintain this distance
|
|
141
|
+
this.distanceMax = max2(this.distance, this.distanceMax);
|
|
142
|
+
|
|
139
143
|
this.target.copy(target);
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractRenderAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AbstractRenderAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js"],"names":[],"mappings":"AA4BA;IAGQ;;;;OAIG;IACH,0BAHU,MAAM,CAGO;IAEvB;;;;OAIG;IACH,qBAHU,MAAM,QAAQ,EAAE,CAGP;IAGvB;;OAEG;IACH,yBAEC;IAED;;;;;;OAMG;IACH,gBALW,MAAM,cAAc,YACpB,MAAM,QAAQ,kBACd,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,iCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,yBAFa,IAAI,CAIhB;IAGD;;;;OAIG;IACH,sBAHW,MAAM,aAAa,0BAK7B;IAED,kBAEC;IAED,cAEC;IAED;;;;OAIG;IACH,YAFY,SAAS,CAIpB;IAED;;OAEG;IACH,iEAEC;IAED;;OAEG;IACH,2BAEC;IAED,gBAEC;IAGL;;;OAGG;IACH,wCAFU,OAAO,CAE4C;CAN5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpriteSystemPE.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/SpriteSystemPE.js"],"names":[],"mappings":"AA6HA;IACI,cAKC;IADG,mDAAuC;CAE9C;
|
|
1
|
+
{"version":3,"file":"SpriteSystemPE.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/SpriteSystemPE.js"],"names":[],"mappings":"AA6HA;IACI,cAKC;IADG,mDAAuC;CAE9C;sCAjIqC,8CAA8C;0BAE1D,qCAAqC;uBAQxC,aAAa"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ParticleLayer } from "../../particles/particular/engine/emitter/ParticleLayer.js";
|
|
3
|
-
import Entity from "../../../ecs/Entity.js";
|
|
4
|
-
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
1
|
+
import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
|
|
5
2
|
import { SerializationMetadata } from "../../../ecs/components/SerializationMetadata.js";
|
|
3
|
+
import Entity from "../../../ecs/Entity.js";
|
|
6
4
|
import { AbstractContextSystem } from "../../../ecs/system/AbstractContextSystem.js";
|
|
7
5
|
import { SystemEntityContext } from "../../../ecs/system/SystemEntityContext.js";
|
|
8
|
-
import {
|
|
6
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
9
7
|
import {
|
|
10
8
|
PARTICLE_ATTRIBUTE_COLOR,
|
|
11
9
|
PARTICLE_ATTRIBUTE_POSITION
|
|
12
10
|
} from "../../particles/particular/engine/emitter/PARTICLE_ATTRIBUTES.js";
|
|
11
|
+
import { ParticleEmitter } from "../../particles/particular/engine/emitter/ParticleEmitter.js";
|
|
13
12
|
import { ParticleEmitterFlag } from "../../particles/particular/engine/emitter/ParticleEmitterFlag.js";
|
|
14
|
-
import {
|
|
13
|
+
import { ParticleLayer } from "../../particles/particular/engine/emitter/ParticleLayer.js";
|
|
14
|
+
import { Sprite } from "./Sprite.js";
|
|
15
15
|
|
|
16
16
|
class Context extends SystemEntityContext {
|
|
17
17
|
constructor() {
|
|
@@ -92,7 +92,7 @@ class Context extends SystemEntityContext {
|
|
|
92
92
|
|
|
93
93
|
emitter.particles?.writeAttributeVector4(
|
|
94
94
|
0, PARTICLE_ATTRIBUTE_COLOR,
|
|
95
|
-
|
|
95
|
+
float_to_uint8(sprite.color.r), float_to_uint8(sprite.color.g), float_to_uint8(sprite.color.b), float_to_uint8(sprite.opacity.getValue())
|
|
96
96
|
);
|
|
97
97
|
|
|
98
98
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Uint8Array} input
|
|
3
|
+
* @param {number} width
|
|
4
|
+
* @param {number} height
|
|
5
|
+
* @param {number} channel_count
|
|
6
|
+
*/
|
|
7
|
+
export function sampler2d_flipY_in_place(input: Uint8Array, width: number, height: number, channel_count?: number): void;
|
|
8
|
+
//# sourceMappingURL=sampler2d_flipY_in_place.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_flipY_in_place.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/filter/sampler2d_flipY_in_place.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,gDALW,UAAU,SACV,MAAM,UACN,MAAM,kBACN,MAAM,QAyBhB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {number} height
|
|
5
5
|
* @param {number} channel_count
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function sampler2d_flipY_in_place(input, width, height, channel_count = 4) {
|
|
8
8
|
const row_size = width * channel_count;
|
|
9
9
|
let t, x0, x1;
|
|
10
10
|
let i = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bvh32_set_leaf_from_triangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bvh32_set_leaf_from_triangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,mFANW,MAAM,YACN,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,WACN,MAAM,WACN,MAAM,QAQhB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { min3 } from "../../../../../core/math/min3.js";
|
|
1
|
+
import { aabb3_compute_from_triangle } from "../../../../../core/geom/3d/aabb3_compute_from_triangle.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
*
|
|
@@ -11,31 +10,10 @@ import { min3 } from "../../../../../core/math/min3.js";
|
|
|
11
10
|
* @param {number} c_index
|
|
12
11
|
*/
|
|
13
12
|
export function bvh32_set_leaf_from_triangle(bvh, triangle_index, vertices, a_index, b_index, c_index) {
|
|
14
|
-
const a = a_index * 3;
|
|
15
|
-
const b = b_index * 3;
|
|
16
|
-
const c = c_index * 3;
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const aZ = vertices[a + 2];
|
|
14
|
+
const address = bvh.getLeafAddress(triangle_index);
|
|
15
|
+
aabb3_compute_from_triangle(bvh.__data_float32, address, vertices, a_index, b_index, c_index);
|
|
16
|
+
bvh.__data_uint32[address + 6] = triangle_index;
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
const bY = vertices[b + 1];
|
|
25
|
-
const bZ = vertices[b + 2];
|
|
18
|
+
}
|
|
26
19
|
|
|
27
|
-
const cX = vertices[c];
|
|
28
|
-
const cY = vertices[c + 1];
|
|
29
|
-
const cZ = vertices[c + 2];
|
|
30
|
-
|
|
31
|
-
// compute bounds of the triangle
|
|
32
|
-
const x0 = min3(aX, bX, cX);
|
|
33
|
-
const y0 = min3(aY, bY, cY);
|
|
34
|
-
const z0 = min3(aZ, bZ, cZ);
|
|
35
|
-
|
|
36
|
-
const x1 = max3(aX, bX, cX);
|
|
37
|
-
const y1 = max3(aY, bY, cY);
|
|
38
|
-
const z1 = max3(aZ, bZ, cZ);
|
|
39
|
-
|
|
40
|
-
bvh.setLeafData(triangle_index, triangle_index, x0, y0, z0, x1, y1, z1)
|
|
41
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { float_to_uint8 } from "../../../../../core/binary/float_to_uint8.js";
|
|
2
2
|
import { clamp01 } from "../../../../../core/math/clamp01.js";
|
|
3
3
|
import { makeOnePixelTexture } from "../../../texture/makeOnePixelTexture.js";
|
|
4
4
|
|
|
@@ -38,12 +38,12 @@ export function prepare_bake_material({
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
if (texture_metalness === null) {
|
|
41
|
-
const m =
|
|
41
|
+
const m = float_to_uint8(clamp01(source_material.metalness));
|
|
42
42
|
texture_metalness = makeOnePixelTexture([m, m, m, 255], cleanup_signal);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (texture_roughness === null) {
|
|
46
|
-
const r =
|
|
46
|
+
const r = float_to_uint8(clamp01(source_material.roughness));
|
|
47
47
|
|
|
48
48
|
texture_roughness = makeOnePixelTexture([r, r, r, 255], cleanup_signal);
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/render/Lines.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/render/Lines.js"],"names":[],"mappings":"AA+BA;IAGQ,cAAc;IACd,iBAAkB;IAElB;;;OAGG;IACH,UAFU,cAAc,GAAC,IAAI,CAEe;IAE5C,sDAAoE;IASxE;;;OAGG;IACH,YAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,mBAFW,MAAM,QAWhB;IAED;;;;;OAKG;IACH,kDA2BC;IAED,cAUC;IAED,gBAGC;CACJ;+BA/H8B,kCAAkC;kCAFC,OAAO;6BAAP,OAAO"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { DynamicDrawUsage, LineBasicMaterial, LineSegments } from "three";
|
|
2
|
-
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
3
|
-
import { BufferGeometry } from "three/src/core/BufferGeometry.js";
|
|
4
2
|
import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
|
|
3
|
+
import { BufferGeometry } from "three/src/core/BufferGeometry.js";
|
|
4
|
+
import { assert } from "../../../core/assert.js";
|
|
5
|
+
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {number} capacity
|
|
10
|
+
* @return {BufferGeometry}
|
|
11
|
+
*/
|
|
6
12
|
function buildGeometry(capacity) {
|
|
13
|
+
assert.isNonNegativeInteger(capacity, 'capacity');
|
|
14
|
+
|
|
7
15
|
const geometry = new BufferGeometry();
|
|
8
16
|
|
|
9
17
|
geometry.dynamic = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SH3VisualisationMaterial.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/SH3VisualisationMaterial.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SH3VisualisationMaterial.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/SH3VisualisationMaterial.js"],"names":[],"mappings":"AA0DA;IAEI,cAoBC;CAEJ;+BAlFuC,OAAO"}
|
|
@@ -24,17 +24,20 @@ vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
|
|
|
24
24
|
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
25
25
|
// normal is assumed to have unit length
|
|
26
26
|
float x = normal.x, y = normal.y, z = normal.z;
|
|
27
|
+
|
|
27
28
|
// band 0
|
|
28
29
|
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
30
|
+
|
|
29
31
|
// band 1
|
|
30
|
-
result
|
|
32
|
+
result -= shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
31
33
|
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
32
|
-
result
|
|
34
|
+
result -= shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
35
|
+
|
|
33
36
|
// band 2
|
|
34
37
|
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
35
|
-
result
|
|
38
|
+
result -= shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
36
39
|
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
37
|
-
result
|
|
40
|
+
result -= shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
38
41
|
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
39
42
|
|
|
40
43
|
return result;
|
|
@@ -46,9 +49,9 @@ varying vec3 vNormal;
|
|
|
46
49
|
|
|
47
50
|
void main() {
|
|
48
51
|
vec3 normal = normalize( vNormal );
|
|
49
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
52
|
+
vec3 worldNormal = normalize(inverseTransformDirection( normal, viewMatrix ));
|
|
50
53
|
vec3 irradiance = shGetIrradianceAt( worldNormal, sh );
|
|
51
|
-
vec3 outgoingLight =
|
|
54
|
+
vec3 outgoingLight = 1.0 * irradiance * intensity;
|
|
52
55
|
gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );
|
|
53
56
|
}
|
|
54
57
|
`;
|