@woosh/meep-engine 2.93.3 → 2.94.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.
Files changed (103) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +295 -232
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +295 -232
  5. package/package.json +1 -1
  6. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  7. package/src/core/bvh2/bvh3/BVH.js +4 -2
  8. package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts.map +1 -1
  9. package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +2 -1
  10. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  11. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +12 -1
  12. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  13. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +11 -1
  14. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts +14 -0
  15. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts.map +1 -0
  16. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.js +146 -0
  17. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts +16 -0
  18. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -0
  19. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +90 -0
  20. package/src/core/color/Color.d.ts.map +1 -1
  21. package/src/core/color/Color.js +17 -7
  22. package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -1
  23. package/src/core/geom/2d/bvh/BVH2D.js +24 -29
  24. package/src/core/geom/2d/bvh/BVH2D.spec.js +10 -9
  25. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts +2 -0
  26. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts.map +1 -0
  27. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.js +89 -0
  28. package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
  29. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  30. package/src/core/geom/3d/aabb/AABB3.js +8 -1
  31. package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
  32. package/src/core/geom/3d/aabb/aabb3_array_combine.js +5 -0
  33. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +2 -0
  34. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.d.ts.map +1 -1
  35. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +9 -1
  36. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts +16 -0
  37. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts.map +1 -0
  38. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js +55 -0
  39. package/src/core/math/build_gaussian_kernel_1d.d.ts +8 -0
  40. package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -0
  41. package/src/core/math/build_gaussian_kernel_1d.js +26 -0
  42. package/src/core/math/build_gaussian_kernel_2d.d.ts +10 -0
  43. package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -0
  44. package/src/core/math/build_gaussian_kernel_2d.js +55 -0
  45. package/src/core/math/nextOdd.d.ts +8 -0
  46. package/src/core/math/nextOdd.d.ts.map +1 -0
  47. package/src/core/math/nextOdd.js +15 -0
  48. package/src/core/math/nextOdd.spec.d.ts +2 -0
  49. package/src/core/math/nextOdd.spec.d.ts.map +1 -0
  50. package/src/core/math/nextOdd.spec.js +9 -0
  51. package/src/engine/animation/curve/prototypeGLTF.js +4 -1
  52. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts +2 -0
  53. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts.map +1 -1
  54. package/src/engine/graphics/ecs/light/binding/LightBinding.js +16 -0
  55. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts +13 -2
  56. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts.map +1 -1
  57. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +37 -4
  58. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
  59. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +12 -8
  60. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
  61. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts +0 -9
  62. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +1 -1
  63. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +100 -129
  64. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
  65. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -4
  66. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +11 -4
  67. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
  68. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +2 -2
  69. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  70. package/src/engine/graphics/texture/sampler/Sampler2D.js +6 -4
  71. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts.map +1 -1
  72. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +1 -2
  73. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts +2 -2
  74. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts.map +1 -1
  75. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +3 -3
  76. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  77. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +5 -31
  78. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts +3 -6
  79. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts.map +1 -1
  80. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.js +8 -27
  81. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts +4 -0
  82. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts.map +1 -1
  83. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js +12 -0
  84. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts +29 -0
  85. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -0
  86. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +102 -0
  87. package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
  88. package/src/engine/graphics/texture/virtual/prototype.js +221 -79
  89. package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
  90. package/src/generation/filtering/numeric/CellFilterCache.js +7 -7
  91. package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts.map +1 -1
  92. package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +9 -6
  93. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts +1 -13
  94. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
  95. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +39 -111
  96. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  97. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +6 -5
  98. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts +1 -1
  99. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts.map +1 -1
  100. package/src/generation/grid/generation/util/buildDistanceMapToObjective.js +5 -12
  101. package/src/core/math/makeNextOdd.d.ts +0 -8
  102. package/src/core/math/makeNextOdd.d.ts.map +0 -1
  103. package/src/core/math/makeNextOdd.js +0 -15
@@ -1,12 +1,12 @@
1
- import { LightBinding } from "../LightBinding.js";
2
- import { threeEnsureLightObject } from "./threeEnsureLightObject.js";
3
- import { LightType } from "../../LightType.js";
4
- import { applyRotation } from "./applyRotation.js";
5
- import { threeUpdateTransform } from "../../../../util/threeUpdateTransform.js";
6
- import { ShadowMap } from "../../shadow/ShadowMap.js";
7
- import { CameraView } from "../../../../render/view/CameraView.js";
8
1
  import { DoubleSide, Mesh, MeshDepthMaterial, RGBADepthPacking, Scene } from "three";
9
2
  import { ThreeBypassRenderer } from "../../../../render/utils/ThreeBypassRenderer.js";
3
+ import { CameraView } from "../../../../render/view/CameraView.js";
4
+ import { threeUpdateTransform } from "../../../../util/threeUpdateTransform.js";
5
+ import { LightType } from "../../LightType.js";
6
+ import { ShadowMap } from "../../shadow/ShadowMap.js";
7
+ import { LightBinding } from "../LightBinding.js";
8
+ import { applyRotation } from "./applyRotation.js";
9
+ import { threeEnsureLightObject } from "./threeEnsureLightObject.js";
10
10
 
11
11
  const shadow_scene = new Scene();
12
12
  shadow_scene.autoUpdate = false;
@@ -147,7 +147,7 @@ export class ThreeLightBinding extends LightBinding {
147
147
  }
148
148
 
149
149
  __apply_distance(v) {
150
- this.__three_getLight().distance = this.__c_light.distance.getValue();
150
+ this.__three_getLight().distance = this.scaled_distance;
151
151
  }
152
152
 
153
153
  __apply_angle() {
@@ -314,6 +314,10 @@ export class ThreeLightBinding extends LightBinding {
314
314
  applyRotation(this.__c_light, this.__c_transform.rotation);
315
315
  }
316
316
 
317
+ __apply_scale() {
318
+ this.__three_getLight().distance = this.scaled_distance;
319
+ }
320
+
317
321
  applySettings(settings) {
318
322
  const light = this.__three_getLight();
319
323
 
@@ -1070,7 +1070,7 @@ function create_volume({
1070
1070
  *
1071
1071
  * @param {Vector3} position
1072
1072
  * @param {ParameterLookupTable} lut
1073
- * @return {{position: Vector1}}
1073
+ * @return {{position: Vector1, entity:Entity}}
1074
1074
  */
1075
1075
  function make_symbol_view({
1076
1076
  position,
@@ -34,15 +34,6 @@ export class GeometryBVHBatched {
34
34
  * @param {THREE.BufferGeometry} geometry
35
35
  */
36
36
  build(geometry: THREE.BufferGeometry): void;
37
- /**
38
- *
39
- * @param {number[]} output
40
- * @param {number} face_index
41
- * @param {number} t
42
- * @param {number} u
43
- * @param {number} v
44
- */
45
- construct_ray_hit(output: number[], face_index: number, t: number, u: number, v: number): void;
46
37
  /**
47
38
  *
48
39
  * @param {number[]} output
@@ -1 +1 @@
1
- {"version":3,"file":"GeometryBVHBatched.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js"],"names":[],"mappings":"AAwBA;IAEQ;;;;OAIG;IACH,cAAsB;IAEtB;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,6BAAgC;IAGhC;;;;OAIG;IACH,yBAAyB;IAG7B;;;OAGG;IACH,gBAFW,MAAM,cAAc,QAwB9B;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,EAAE,cACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAuDhB;IAED;;;;;;;OAOG;IACH,gBANW,MAAM,EAAE,OACR,MAAM,EAAE,gBACR,MAAM,gBACN,MAAM,GACJ,MAAM,CA4GlB;CACJ"}
1
+ {"version":3,"file":"GeometryBVHBatched.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js"],"names":[],"mappings":"AA4FA;IAEQ;;;;OAIG;IACH,cAAsB;IAEtB;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,6BAAgC;IAGhC;;;;OAIG;IACH,yBAAyB;IAG7B;;;OAGG;IACH,gBAFW,MAAM,cAAc,QAyB9B;IAGD;;;;;;;OAOG;IACH,gBANW,MAAM,EAAE,OACR,MAAM,EAAE,gBACR,MAAM,gBACN,MAAM,GACJ,MAAM,CAwElB;CACJ"}
@@ -1,26 +1,94 @@
1
1
  import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
2
2
  import { ebvh_build_for_geometry_morton } from "../../../../core/bvh2/bvh3/ebvh_build_for_geometry_morton.js";
3
- import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
4
- import {
5
- aabb3_signed_distance_sqr_to_point
6
- } from "../../../../core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js";
3
+ import { bvh_query_user_data_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_ray.js";
4
+
7
5
  import {
8
- computeTriangleRayIntersectionBarycentric
9
- } from "../../../../core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js";
6
+ computeTriangleRayIntersectionBarycentricGeometry
7
+ } from "../../../../core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js";
10
8
 
11
9
  /**
12
10
  *
13
11
  * @type {number[]}
14
12
  */
15
- const leaf_buffer = [];
13
+ const scratch_uint32_array = [];
16
14
  /**
17
15
  *
18
16
  * @type {number[]}
19
17
  */
20
18
  const v3_scratch_0 = [];
21
19
 
22
- const temp_aabb3 = new Float32Array(6);
23
-
20
+ /**
21
+ *
22
+ * @param {number[]} output
23
+ * @param {number[]} indices
24
+ * @param {number[]} positions
25
+ * @param {number} face_index
26
+ * @param {number} t
27
+ * @param {number} u
28
+ * @param {number} v
29
+ */
30
+ function construct_ray_hit(
31
+ output,
32
+ indices, positions,
33
+ face_index,
34
+ t, u, v
35
+ ) {
36
+
37
+ const index_offset = face_index * 3;
38
+
39
+ const a = indices[index_offset];
40
+ const b = indices[index_offset + 1];
41
+ const c = indices[index_offset + 2];
42
+
43
+ const a_address = a * 3;
44
+ const b_address = b * 3;
45
+ const c_address = c * 3;
46
+
47
+ const ax = positions[a_address];
48
+ const ay = positions[a_address + 1];
49
+ const az = positions[a_address + 2];
50
+
51
+ const bx = positions[b_address];
52
+ const by = positions[b_address + 1];
53
+ const bz = positions[b_address + 2];
54
+
55
+ const cx = positions[c_address];
56
+ const cy = positions[c_address + 1];
57
+ const cz = positions[c_address + 2];
58
+
59
+ // normal
60
+
61
+ // edge1 = a - b
62
+ const edge1_x = bx - ax;
63
+ const edge1_y = by - ay;
64
+ const edge1_z = bz - az;
65
+
66
+ // edge2 = c - a
67
+ const edge2_x = cx - ax;
68
+ const edge2_y = cy - ay;
69
+ const edge2_z = cz - az;
70
+
71
+ // compute position of intersection point
72
+ output[0] = ax + edge1_x * u + edge2_x * v;
73
+ output[1] = ay + edge1_y * u + edge2_y * v;
74
+ output[2] = az + edge1_z * u + edge2_z * v;
75
+
76
+ // Compute triangle normal
77
+
78
+ // normal = edge1 x edge2
79
+ const normal_x = edge1_y * edge2_z - edge1_z * edge2_y;
80
+ const normal_y = edge1_z * edge2_x - edge1_x * edge2_z;
81
+ const normal_z = edge1_x * edge2_y - edge1_y * edge2_x
82
+
83
+ output[3] = normal_x;
84
+ output[4] = normal_y;
85
+ output[5] = normal_z;
86
+
87
+ output[6] = t;
88
+ output[7] = u;
89
+ output[8] = v;
90
+ output[9] = face_index;
91
+ }
24
92
 
25
93
  export class GeometryBVHBatched {
26
94
  constructor() {
@@ -86,71 +154,10 @@ export class GeometryBVHBatched {
86
154
  //
87
155
  // ebvh_build_for_geometry_incremental(bvh, index_array, array_positions, 1);
88
156
 
157
+ // remove any extra unused space
89
158
  bvh.trim();
90
159
  }
91
160
 
92
- /**
93
- *
94
- * @param {number[]} output
95
- * @param {number} face_index
96
- * @param {number} t
97
- * @param {number} u
98
- * @param {number} v
99
- */
100
- construct_ray_hit(output, face_index, t, u, v) {
101
- const indices = this.__geometry_index;
102
- const positions = this.__geometry_positions;
103
-
104
- const index_offset = face_index * 3;
105
-
106
- const a = indices[index_offset];
107
- const b = indices[index_offset + 1];
108
- const c = indices[index_offset + 2];
109
-
110
- const a_address = a * 3;
111
- const b_address = b * 3;
112
- const c_address = c * 3;
113
-
114
- const ax = positions[a_address];
115
- const ay = positions[a_address + 1];
116
- const az = positions[a_address + 2];
117
-
118
- const bx = positions[b_address];
119
- const by = positions[b_address + 1];
120
- const bz = positions[b_address + 2];
121
-
122
- const cx = positions[c_address];
123
- const cy = positions[c_address + 1];
124
- const cz = positions[c_address + 2];
125
-
126
- // normal
127
-
128
- // edge1 = a - b
129
- const edge1_x = bx - ax;
130
- const edge1_y = by - ay;
131
- const edge1_z = bz - az;
132
-
133
- // edge2 = c - a
134
- const edge2_x = cx - ax;
135
- const edge2_y = cy - ay;
136
- const edge2_z = cz - az;
137
-
138
- // Compute triangle normal
139
-
140
- // normal = edge1 x edge2
141
- const normal_x = edge1_y * edge2_z - edge1_z * edge2_y;
142
- const normal_y = edge1_z * edge2_x - edge1_x * edge2_z;
143
- const normal_z = edge1_x * edge2_y - edge1_y * edge2_x
144
-
145
- output[3] = normal_x;
146
- output[4] = normal_y;
147
- output[5] = normal_z;
148
-
149
- output[6] = t;
150
- output[7] = u;
151
- output[8] = v;
152
- output[9] = face_index;
153
- }
154
161
 
155
162
  /**
156
163
  *
@@ -176,77 +183,44 @@ export class GeometryBVHBatched {
176
183
  const bvh = this.__bvh;
177
184
 
178
185
  // TODO we can unify BVH traversal with ray checks to reduce number of checks
179
- const count = bvh_query_leaves_ray(
186
+ const count = bvh_query_user_data_ray(
180
187
  bvh, bvh.root,
181
- leaf_buffer, 0,
188
+ scratch_uint32_array, 0,
182
189
  origin_x, origin_y, origin_z,
183
190
  direction_x, direction_y, direction_z
184
191
  );
185
192
 
193
+ if (count === 0) {
194
+ // no bvh hit, early exit
195
+ return -1;
196
+ }
197
+
186
198
  let best_t = max_distance;
187
199
 
188
200
  let best_index = -1;
189
201
  let best_u = 0;
190
202
  let best_v = 0;
191
203
 
204
+ // check triangles found via BVH
192
205
  for (let i = 0; i < count; i++) {
193
- const node_id = leaf_buffer[i];
194
-
195
-
196
- if (best_t < max_distance) {
197
- // early bail-out
198
-
199
- bvh.node_get_aabb(node_id, temp_aabb3);
200
-
201
- const distance = aabb3_signed_distance_sqr_to_point(
202
- temp_aabb3[0], temp_aabb3[1], temp_aabb3[2],
203
- temp_aabb3[3], temp_aabb3[4], temp_aabb3[5],
204
- ray[0], ray[1], ray[2]
205
- );
206
-
207
- if (distance > best_t * best_t) {
208
- // whole AABB is too far
209
- continue;
210
- }
211
- }
212
-
213
- const triangle_index = bvh.node_get_user_data(node_id);
206
+ const triangle_index = scratch_uint32_array[i];
214
207
 
215
- const index_offset = triangle_index * 3;
216
-
217
- const a = indices[index_offset];
218
- const b = indices[index_offset + 1];
219
- const c = indices[index_offset + 2];
220
-
221
-
222
- const a_address = a * 3;
223
- const b_address = b * 3;
224
- const c_address = c * 3;
225
-
226
-
227
- const ax = positions[a_address];
228
- const ay = positions[a_address + 1];
229
- const az = positions[a_address + 2];
230
-
231
- const bx = positions[b_address];
232
- const by = positions[b_address + 1];
233
- const bz = positions[b_address + 2];
234
-
235
- const cx = positions[c_address];
236
- const cy = positions[c_address + 1];
237
- const cz = positions[c_address + 2];
238
-
239
- const intersection_found = computeTriangleRayIntersectionBarycentric(
208
+ const intersection_found = computeTriangleRayIntersectionBarycentricGeometry(
240
209
  v3_scratch_0,
241
210
  origin_x, origin_y, origin_z,
242
211
  direction_x, direction_y, direction_z,
243
- ax, ay, az,
244
- bx, by, bz,
245
- cx, cy, cz
212
+ indices, triangle_index,
213
+ positions
246
214
  );
247
215
 
248
- if (intersection_found && v3_scratch_0[0] < best_t && v3_scratch_0[0] > min_distance) {
249
- best_t = v3_scratch_0[0];
216
+ if (!intersection_found) {
217
+ continue;
218
+ }
219
+
220
+ const t = v3_scratch_0[0];
221
+
222
+ if (t < best_t && t > min_distance) {
223
+ best_t = t;
250
224
 
251
225
  best_index = triangle_index;
252
226
  best_u = v3_scratch_0[1];
@@ -256,14 +230,11 @@ export class GeometryBVHBatched {
256
230
  }
257
231
 
258
232
  if (best_t === max_distance) {
233
+ // no hit
259
234
  return -1;
260
235
  }
261
236
 
262
- output[0] = origin_x + direction_x * best_t;
263
- output[1] = origin_y + direction_y * best_t;
264
- output[2] = origin_z + direction_z * best_t;
265
-
266
- this.construct_ray_hit(output, best_index, best_t, best_u, best_v);
237
+ construct_ray_hit(output, indices, positions, best_index, best_t, best_u, best_v);
267
238
 
268
239
  return best_t;
269
240
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PathTracer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracer.js"],"names":[],"mappings":";AAgEA;IAGQ;;;OAGG;IACH,eAFU,GAAG,CAEiB;IAE9B;;;OAGG;IACH,QAFU,IAAI,MAAM,EAAE,cAAc,CAAC,CAEd;IAEvB;;;OAGG;IACH,UAFU,eAAe,CAEP;IAElB;;;OAGG;IACH,WAFU,IAAI,MAAM,cAAc,EAAE,kBAAkB,CAAC,CAE7B;IAE1B;;;OAGG;IACH,UAFU,IAAI,MAAM,YAAY,CAEP;IAEzB;;;;OAIG;IACH,6BAA8C;IAGlD;;;;OAIG;IACH,uBAHW,MAAM,cAAc,GACnB,kBAAkB,CAgB7B;IAED,iBAGC;IAED,uBAoCC;IAED;;;OAGG;IACH,qCAEC;IAED;;;;;OAKG;IACH,aAJW,MAAM,cAAc,YACpB,MAAM,QAAQ,aACd,IAAI,GAAC,MAAM,EAAE,QA6CvB;IAED;;;;;;OAMG;IACH,oBALW,MAAM,EAAE,uBAER,MAAM,KACN,MAAM,QA+ChB;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,OACR,MAAM,EAAE,QAiFlB;IAED;;;;;;;OAOG;IACH,WANW,MAAM,EAAE,OACR,MAAM,EAAE,gBACR,MAAM,gBACN,MAAM,GACL,MAAM,CAyCjB;IAED;;;;;;OAMG;IACH,uBALW,MAAM,EAAE,cACR,MAAM,aACN,MAAM,EAAE,oBACR,MAAM,QAIhB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,EAAE,cACR,MAAM,OACN,MAAM,EAAE,eACR,MAAM,WAgEhB;IAED,gGAyDC;CACJ;oBAniBmB,mCAAmC;+BAexB,qBAAqB;mCAHjB,yBAAyB;qBAtBjC,WAAW"}
1
+ {"version":3,"file":"PathTracer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/PathTracer.js"],"names":[],"mappings":";AAgEA;IAGQ;;;OAGG;IACH,eAFU,GAAG,CAEiB;IAE9B;;;OAGG;IACH,QAFU,IAAI,MAAM,EAAE,cAAc,CAAC,CAEd;IAEvB;;;OAGG;IACH,UAFU,eAAe,CAEP;IAElB;;;OAGG;IACH,WAFU,IAAI,MAAM,cAAc,EAAE,kBAAkB,CAAC,CAE7B;IAE1B;;;OAGG;IACH,UAFU,IAAI,MAAM,YAAY,CAEP;IAEzB;;;;OAIG;IACH,6BAA8C;IAGlD;;;;OAIG;IACH,uBAHW,MAAM,cAAc,GACnB,kBAAkB,CAgB7B;IAED,iBAGC;IAED,uBAoCC;IAED;;;OAGG;IACH,qCAEC;IAED;;;;;OAKG;IACH,aAJW,MAAM,cAAc,YACpB,MAAM,QAAQ,aACd,IAAI,GAAC,MAAM,EAAE,QA6CvB;IAED;;;;;;OAMG;IACH,oBALW,MAAM,EAAE,uBAER,MAAM,KACN,MAAM,QA+ChB;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,OACR,MAAM,EAAE,QAmFlB;IAED;;;;;;;OAOG;IACH,WANW,MAAM,EAAE,OACR,MAAM,EAAE,gBACR,MAAM,gBACN,MAAM,GACL,MAAM,CAyCjB;IAED;;;;;;OAMG;IACH,uBALW,MAAM,EAAE,cACR,MAAM,aACN,MAAM,EAAE,oBACR,MAAM,QAIhB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,EAAE,cACR,MAAM,OACN,MAAM,EAAE,eACR,MAAM,WAgEhB;IAED,gGAyDC;CACJ;oBAriBmB,mCAAmC;+BAexB,qBAAqB;mCAHjB,yBAAyB;qBAtBjC,WAAW"}
@@ -261,7 +261,7 @@ export class PathTracer {
261
261
  case LinearFilter:
262
262
  case LinearMipmapLinearFilter:
263
263
 
264
- sampler.sampleBicubicUV(_u, _v, out);
264
+ sampler.sampleBilinearUV(_u, _v, out);
265
265
  break;
266
266
  }
267
267
 
@@ -348,9 +348,11 @@ export class PathTracer {
348
348
  const material = mesh.material;
349
349
 
350
350
  if (material.isMeshStandardMaterial) {
351
- out[0] *= material.color.r;
352
- out[1] *= material.color.g;
353
- out[2] *= material.color.b;
351
+ const material_color = material.color;
352
+
353
+ out[0] *= material_color.r;
354
+ out[1] *= material_color.g;
355
+ out[2] *= material_color.b;
354
356
 
355
357
  const diffuse_map = material.map;
356
358
 
@@ -67,6 +67,12 @@ vCanvas.css({
67
67
  overflow: "visible"
68
68
  });
69
69
 
70
+ /**
71
+ * How many rays to use per-pixel
72
+ * @type {number}
73
+ */
74
+ const PIXEL_SAMPLE_COUNT = 256;
75
+
70
76
  const pt = new PathTracer();
71
77
 
72
78
  const gltfLoader = new GLTFLoader();
@@ -380,6 +386,7 @@ async function prepare_scene_rtiow(pt, camera) {
380
386
 
381
387
  }
382
388
 
389
+
383
390
  /**
384
391
  *
385
392
  * @param {Sampler2D} target
@@ -415,7 +422,7 @@ function* render(target, pt, camera, progress = { current: 0, total: 0 }) {
415
422
  const pixel_scale_x = 1 / (width - 1);
416
423
  const pixel_scale_y = 1 / (height - 1);
417
424
 
418
- const pixel_sample_count = 4;
425
+ const pixel_sample_count = PIXEL_SAMPLE_COUNT;
419
426
 
420
427
  progress.total = width * height;
421
428
 
@@ -523,11 +530,11 @@ async function start_renderer(camera) {
523
530
 
524
531
  // await prepare_scene_lucy(pt, camera);
525
532
  // await prepare_scene_rtiow(pt, camera);
526
- await prepare_scene_sphere_01(pt, camera);
527
- // await prepare_scene_gltf(pt, camera, path);
533
+ // await prepare_scene_sphere_01(pt, camera);
534
+ await prepare_scene_gltf(pt, camera, path);
528
535
 
529
536
  pt.build();
530
- pt.optimize();
537
+ // pt.optimize();
531
538
 
532
539
  const pixelRatio = 1;
533
540
 
@@ -7,8 +7,8 @@
7
7
  * @param {number} c vertex index 0
8
8
  * @param {number[]} attribute_array
9
9
  * @param {number} dimensions
10
- * @param {number} u
11
- * @param {number} v
10
+ * @param {number} u Barycentric coordinate
11
+ * @param {number} v Barycentric coordinate
12
12
  */
13
13
  export function sample_triangle_attribute(out: number[], out_offset: number, a: number, b: number, c: number, attribute_array: number[], dimensions: number, u: number, v: number): void;
14
14
  //# sourceMappingURL=sample_triangle_attribute.d.ts.map
@@ -7,8 +7,8 @@
7
7
  * @param {number} c vertex index 0
8
8
  * @param {number[]} attribute_array
9
9
  * @param {number} dimensions
10
- * @param {number} u
11
- * @param {number} v
10
+ * @param {number} u Barycentric coordinate
11
+ * @param {number} v Barycentric coordinate
12
12
  */
13
13
  export function sample_triangle_attribute(
14
14
  out, out_offset,
@@ -1 +1 @@
1
- {"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH;IAg8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,qDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAziCD;;;;;;;OAOG;IACH,mBANW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,aACzI,MAAM,UACN,MA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sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH;IAk8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,qDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IA3iCD;;;;;;;OAOG;IACH,mBANW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,aACzI,MAAM,UACN,MAAM,WACN,MAAM,EAmDhB;IA7BG;;;OAGG;IACH,cAAkB;IAElB;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iBAAwB;IAExB;;;OAGG;IACH,MAFU,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,CAEjH;IAEhB;;;OAGG;IACH,SAFU,MAAM,CAEA;IAGpB;;;;;;;OAOG;IACH,OALW,MAAM,KACN,MAAM,UACN,qCAA+B,GAC7B,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAQlB;IAED;;;;;;OAMG;IACH,6BALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;OAOG;IACH,2B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;;;;;;;OAOG;IACH,oEA8BC;IAED;;;;OAIG;IACH,2BAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,iEAFW,aAAc,QAqCxB;IAED;;;;;;OAMG;IACH,gBALW,MAAM,KACN,MAAM,WACN,MAAM,SACN,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAYlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAYjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
@@ -11,9 +11,9 @@ import {
11
11
  import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
12
12
  import { typedArrayToDataType } from "../../../../core/collection/array/typed/typedArrayToDataType.js";
13
13
  import { clamp } from "../../../../core/math/clamp.js";
14
+ import { lerp } from "../../../../core/math/lerp.js";
14
15
  import { max2 } from "../../../../core/math/max2.js";
15
16
  import { min2 } from "../../../../core/math/min2.js";
16
- import { mix } from "../../../../core/math/mix.js";
17
17
  import { interpolate_bicubic } from "../../../../core/math/spline/interpolate_bicubic.js";
18
18
  import { computeStridedIntegerArrayHash } from "../../../../core/primitives/array/computeStridedIntegerArrayHash.js";
19
19
  import { typedArrayConstructorByInstance } from "./typedArrayConstructorByInstance.js";
@@ -235,6 +235,7 @@ export class Sampler2D {
235
235
  }
236
236
 
237
237
  /**
238
+ * TODO there is an oversaturation bug in here somewhere, prefer to use linear sampling for now instead
238
239
  * Bicubic-filtered sampling
239
240
  * @param {number} x
240
241
  * @param {number} y
@@ -430,6 +431,7 @@ export class Sampler2D {
430
431
  const q0 = data[i0];
431
432
 
432
433
  if (x0 === x1 && y0 === y1) {
434
+ // exactly sampled in the center of the pixel, no interpolation required
433
435
  return q0;
434
436
  }
435
437
 
@@ -451,10 +453,10 @@ export class Sampler2D {
451
453
  const p1 = data[j1];
452
454
 
453
455
  // perform Bi-Linear interpolation
454
- const s0 = mix(q0, q1, xd);
455
- const s1 = mix(p0, p1, xd);
456
+ const s0 = lerp(q0, q1, xd);
457
+ const s1 = lerp(p0, p1, xd);
456
458
 
457
- return mix(s0, s1, yd);
459
+ return lerp(s0, s1, yd);
458
460
  }
459
461
 
460
462
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"convertSampler2D2DataURL.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,8DAFa,MAAM,CAelB"}
1
+ {"version":3,"file":"convertSampler2D2DataURL.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,8DAFa,MAAM,CAclB"}
@@ -12,8 +12,7 @@ export function convertSampler2D2DataURL(sampler) {
12
12
 
13
13
  const canvasElement = document.createElement('canvas');
14
14
 
15
- var ctx = canvasElement.getContext("2d");
16
-
15
+ const ctx = canvasElement.getContext("2d");
17
16
 
18
17
  const { scale, offset } = sampler2d_compute_texel_value_conversion_scale_to_uint8(sampler);
19
18
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @param {Sampler2D} sampler
4
- * @param {string} [name]
4
+ * @param {string} [file_name] what should the file be named?
5
5
  */
6
- export function downloadSampler2DAsPNG(sampler: Sampler2D, name?: string): void;
6
+ export function downloadSampler2DAsPNG(sampler: Sampler2D, file_name?: string): void;
7
7
  //# sourceMappingURL=downloadSamplerAsPNG.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"downloadSamplerAsPNG.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,kEAFW,MAAM,QAQhB"}
1
+ {"version":3,"file":"downloadSamplerAsPNG.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,uEAFW,MAAM,QAQhB"}
@@ -4,12 +4,12 @@ import { convertSampler2D2DataURL } from "./convertSampler2D2DataURL.js";
4
4
  /**
5
5
  *
6
6
  * @param {Sampler2D} sampler
7
- * @param {string} [name]
7
+ * @param {string} [file_name] what should the file be named?
8
8
  */
9
- export function downloadSampler2DAsPNG(sampler, name = 'image') {
9
+ export function downloadSampler2DAsPNG(sampler, file_name = 'image') {
10
10
 
11
11
  const dataURL = convertSampler2D2DataURL(sampler);
12
12
 
13
- downloadUrlAsFile(dataURL, `${name}.png`);
13
+ downloadUrlAsFile(dataURL, `${file_name}.png`);
14
14
 
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"AAiCA;;;;;;GAMG;AACH,gDALW,SAAS,SACT,SAAS,QACT,MAAM,YACN,MAAM,QAqFhB;0BAxHyB,iBAAiB"}
1
+ {"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,gDALW,SAAS,SACT,SAAS,QACT,MAAM,YACN,MAAM,QAoFhB;0BA9FyB,iBAAiB"}
@@ -1,36 +1,11 @@
1
- import { gaussian } from "../../../../../core/math/gaussian.js";
2
- import { makeNextOdd } from "../../../../../core/math/makeNextOdd.js";
1
+ import { build_gaussian_kernel_1d } from "../../../../../core/math/build_gaussian_kernel_1d.js";
3
2
  import { max2 } from "../../../../../core/math/max2.js";
3
+ import { nextOdd } from "../../../../../core/math/nextOdd.js";
4
4
  import { Sampler2D } from "../Sampler2D.js";
5
5
 
6
6
 
7
7
  let temp_data = new Float64Array(1);
8
8
 
9
- /**
10
- *
11
- * @param {number} sample_count
12
- * @param {number} sigma
13
- * @param {Float32Array} kernel
14
- */
15
- function build_kernel(sample_count, sigma, kernel) {
16
-
17
- const half_width = (sample_count - 1) * 0.5;
18
-
19
- let kernel_power_sum = 0;
20
- for (let i = 0; i < sample_count; i++) {
21
- const local = i - half_width;
22
-
23
- const power = gaussian(sigma, local);
24
- kernel[i] = power;
25
- kernel_power_sum += power;
26
- }
27
-
28
- // normalize kernel
29
- for (let i = 0; i < sample_count; i++) {
30
- kernel[i] /= kernel_power_sum;
31
- }
32
- }
33
-
34
9
  /**
35
10
  *
36
11
  * @param {Sampler2D} output
@@ -41,11 +16,11 @@ function build_kernel(sample_count, sigma, kernel) {
41
16
  export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
42
17
 
43
18
  const sigma = size * 3;
44
- const sample_count = max2(3, makeNextOdd(Math.round(size * quality)));
19
+ const sample_count = max2(3, nextOdd(Math.round(size * quality)));
45
20
 
46
21
  const kernel = new Float32Array(sample_count);
47
22
 
48
- build_kernel(sample_count, sigma, kernel);
23
+ build_gaussian_kernel_1d(kernel, sample_count, sigma);
49
24
 
50
25
  const width = input.width;
51
26
  const height = input.height;
@@ -53,6 +28,7 @@ export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
53
28
 
54
29
  const total_value_count = width * height * channel_count;
55
30
  if (temp_data.length < total_value_count) {
31
+ // our static temp buffer is too small, let's make it larger
56
32
  temp_data = new Float64Array(total_value_count);
57
33
  }
58
34
 
@@ -93,8 +69,6 @@ export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
93
69
  source = target;
94
70
  target = output;
95
71
 
96
- // typed_array_copy(source.data, target.data);
97
-
98
72
  // vertical pass
99
73
  for (let y = 0; y < height; y++) {
100
74
  for (let x = 0; x < width; x++) {
@@ -1,10 +1,7 @@
1
1
  export class VirtualTextureMaterial extends ShaderMaterial {
2
- /**
3
- *
4
- * @param {VirtualTexturePage} page
5
- * @param {VirtualTextureMemoryMapping} mapping
6
- */
7
- constructor({ page, mapping }: VirtualTexturePage);
2
+ constructor({ uniforms }: {
3
+ uniforms: any;
4
+ });
8
5
  }
9
6
  import { ShaderMaterial } from "three";
10
7
  //# sourceMappingURL=VirtualTextureMaterial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualTextureMaterial.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMaterial.js"],"names":[],"mappings":"AAEA;IACI;;;;OAIG;IACH,mDAuLC;CACJ;+BAhMmD,OAAO"}
1
+ {"version":3,"file":"VirtualTextureMaterial.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMaterial.js"],"names":[],"mappings":"AAEA;IACI;;OAyKC;CACJ;+BA7K0C,OAAO"}