@woosh/meep-engine 2.43.17 → 2.43.19

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 (68) hide show
  1. package/core/assert.js +3 -1
  2. package/core/bvh2/aabb3/aabb3_intersects_ray.js +14 -9
  3. package/core/bvh2/aabb3/aabb3_intersects_ray_branchless.js +52 -0
  4. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.d.ts +2 -0
  5. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +162 -10
  6. package/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +34 -0
  7. package/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +175 -0
  8. package/core/bvh2/bvh3/ebvh_sort_for_traversal_depth_first.js +122 -0
  9. package/core/bvh2/bvh3/{bvh_collect_user_data.js → query/bvh_collect_user_data.js} +1 -1
  10. package/core/bvh2/bvh3/{bvh_query_leaves_generic.js → query/bvh_query_leaves_generic.js} +1 -1
  11. package/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +97 -0
  12. package/core/bvh2/bvh3/{bvh_query_user_data_generic.js → query/bvh_query_user_data_generic.js} +1 -1
  13. package/core/bvh2/bvh3/{bvh_query_user_data_nearest_to_point.js → query/bvh_query_user_data_nearest_to_point.js} +3 -3
  14. package/core/bvh2/bvh3/{bvh_query_user_data_nearest_to_point.spec.js → query/bvh_query_user_data_nearest_to_point.spec.js} +1 -1
  15. package/core/bvh2/bvh3/{bvh_query_user_data_overlaps_frustum.js → query/bvh_query_user_data_overlaps_frustum.js} +2 -2
  16. package/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +1 -1
  17. package/core/collection/array/arrayQuickSort.js +1 -1
  18. package/core/collection/array/typed/typed_array_copy.js +2 -2
  19. package/core/geom/3d/aabb/compute_aabb_from_points.js +4 -3
  20. package/core/geom/3d/compute_triangle_normal.js +76 -0
  21. package/core/geom/3d/topology/samples/sampleFloodFill.js +1 -1
  22. package/core/geom/3d/topology/simplify/compute_face_normal_change_dot_product.js +1 -1
  23. package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +1 -1
  24. package/core/geom/3d/topology/struct/TopoTriangle.js +1 -57
  25. package/core/geom/3d/topology/tm_face_normal.js +1 -1
  26. package/core/geom/3d/topology/tm_vertex_compute_normal.js +1 -1
  27. package/core/geom/3d/triangle/computeTriangleRayIntersection.js +195 -27
  28. package/core/geom/Vector3.js +12 -12
  29. package/core/math/physics/brdf/D_GGX.js +13 -0
  30. package/editor/tools/v2/prototypeTransformControls.js +14 -2
  31. package/engine/ecs/parent/EntityNode.js +80 -7
  32. package/engine/ecs/parent/EntityNodeFlags.js +8 -0
  33. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +2 -2
  34. package/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +9 -1
  35. package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +1 -1
  36. package/engine/graphics/geometry/AttributeSpec.js +18 -3
  37. package/engine/graphics/geometry/VertexDataSpec.js +53 -3
  38. package/engine/graphics/micron/format/VirtualGeometry.js +7 -0
  39. package/engine/graphics/micron/render/VirtualGeometryBuilder.js +1 -1
  40. package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +5 -2
  41. package/engine/graphics/particles/particular/engine/parameter/sample/RGBA_LUT_HEATMAP_IR.js +11 -0
  42. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -9
  43. package/engine/graphics/render/forward_plus/model/DirectionalLight.js +40 -0
  44. package/engine/graphics/sh3/README.md +1 -0
  45. package/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +265 -0
  46. package/engine/graphics/sh3/path_tracer/PathTracedMesh.js +85 -0
  47. package/engine/graphics/sh3/path_tracer/PathTracer.js +534 -0
  48. package/engine/graphics/sh3/path_tracer/apply_texture_clamping_to_coordinate.js +22 -0
  49. package/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js +36 -0
  50. package/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +55 -0
  51. package/engine/graphics/sh3/path_tracer/make_one_vector3.js +7 -0
  52. package/engine/graphics/sh3/path_tracer/make_sky_hosek.js +44 -0
  53. package/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +17 -0
  54. package/engine/graphics/sh3/path_tracer/make_zero_vector3.js +7 -0
  55. package/engine/graphics/sh3/path_tracer/prototypePathTracer.js +631 -0
  56. package/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +39 -0
  57. package/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +42 -0
  58. package/engine/graphics/sh3/path_tracer/ray_reflect.js +27 -0
  59. package/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +35 -0
  60. package/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +12 -0
  61. package/engine/graphics/sh3/sky/hosek/README.md +4 -0
  62. package/engine/graphics/sh3/sky/hosek/prototype_hosek.js +71 -0
  63. package/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +4171 -0
  64. package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +2 -0
  65. package/package.json +1 -1
  66. package/view/elements/progress/SmoothProgressBar.js +1 -1
  67. package/view/task/TaskProgressView.js +6 -8
  68. package/core/bvh2/bvh3/bvh_query_leaves_ray.js +0 -95
@@ -51,6 +51,8 @@ export function convertTexture2Sampler2D(texture, width, height, flipY = true) {
51
51
 
52
52
  }
53
53
 
54
+ // TODO add special case for DataTexture
55
+
54
56
  const renderer = WebGLRendererPool.global.get({});
55
57
 
56
58
  const ctx = renderer.getContext();
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.43.17",
8
+ "version": "2.43.19",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -19,7 +19,7 @@ function makeTextAbsolute(value, max, process) {
19
19
  class ProgressBarView extends View {
20
20
  /**
21
21
  *
22
- * @param {number[]|BoundedValue} model
22
+ * @param {number[]|BoundedValue} [model]
23
23
  * @param classList
24
24
  * @param displayLabel
25
25
  * @param displayLabelType
@@ -23,9 +23,7 @@ class TaskProgressView extends View {
23
23
  * @constructor
24
24
  */
25
25
  constructor({ task, localization }) {
26
- super(task, localization);
27
-
28
- const self = this;
26
+ super();
29
27
 
30
28
  function makeNameId() {
31
29
  const taskName = typeof task.name === "string" ? task.name : "unknown";
@@ -41,14 +39,14 @@ class TaskProgressView extends View {
41
39
 
42
40
  const progressBar = new SmoothProgressBar();
43
41
 
44
- function processFailure() {
42
+ const processFailure = () => {
45
43
  //find failed subtasks/dependencies
46
44
  if (task.children !== undefined) {
47
45
  const failedChildren = task.children.filter(function (t) {
48
46
  return t.state.getValue() === TaskState.FAILED;
49
47
  });
50
- failedChildren.forEach(function (t) {
51
- self.addChild(new LabelView("Failed subtask: " + t.name));
48
+ failedChildren.forEach((t) => {
49
+ this.addChild(new LabelView("Failed subtask: " + t.name));
52
50
  });
53
51
  }
54
52
 
@@ -122,7 +120,7 @@ class TaskProgressView extends View {
122
120
 
123
121
  clock.start();
124
122
 
125
- function update() {
123
+ const update = () => {
126
124
  const computedProgressValue = task.computeProgress();
127
125
 
128
126
  const taskProgress = Number.isNaN(computedProgressValue) ? 0 : computedProgressValue;
@@ -139,7 +137,7 @@ class TaskProgressView extends View {
139
137
 
140
138
  const state = task.state.getValue();
141
139
 
142
- if (state !== TaskState.FAILED && state !== TaskState.SUCCEEDED && self.isLinked) {
140
+ if (state !== TaskState.FAILED && state !== TaskState.SUCCEEDED && this.isLinked) {
143
141
  requestAnimationFrame(update);
144
142
  }
145
143
  }
@@ -1,95 +0,0 @@
1
- import { aabb3_intersects_ray } from "../aabb3/aabb3_intersects_ray.js";
2
- import { NULL_NODE } from "./ExplicitBinaryBoundingVolumeHierarchy.js";
3
-
4
- /**
5
- *
6
- * @type {number[]}
7
- */
8
- const traversal_stack = [];
9
-
10
- /**
11
- *
12
- * @type {number[]}
13
- */
14
- const scratch_aabb = [];
15
-
16
- /**
17
- *
18
- * @type {number}
19
- */
20
- let traversal_cursor = 0;
21
-
22
-
23
- /**
24
- *
25
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
26
- * @param {number[]} result
27
- * @param {number} result_offset
28
- * @param {number} origin_x
29
- * @param {number} origin_y
30
- * @param {number} origin_z
31
- * @param {number} direction_x
32
- * @param {number} direction_y
33
- * @param {number} direction_z
34
- * @returns {number}
35
- */
36
- export function bvh_query_leaves_ray(
37
- bvh,
38
- result, result_offset,
39
- origin_x, origin_y, origin_z,
40
- direction_x, direction_y, direction_z
41
- ) {
42
- const stack_frame_address = traversal_cursor;
43
-
44
- const root = bvh.root;
45
-
46
- if (root === NULL_NODE) {
47
- return 0;
48
- }
49
-
50
- traversal_stack[traversal_cursor++] = root;
51
-
52
- let result_cursor = result_offset;
53
-
54
- while (traversal_cursor > stack_frame_address) {
55
- traversal_cursor--;
56
-
57
- /**
58
- *
59
- * @type {number}
60
- */
61
- const node = traversal_stack[traversal_cursor];
62
-
63
- bvh.node_get_aabb(node, scratch_aabb);
64
-
65
- // test node against the ray
66
- const intersects = aabb3_intersects_ray(
67
- scratch_aabb[0], scratch_aabb[1], scratch_aabb[2],
68
- scratch_aabb[3], scratch_aabb[4], scratch_aabb[5],
69
- origin_x, origin_y, origin_z,
70
- direction_x, direction_y, direction_z
71
- );
72
-
73
- if (!intersects) {
74
- continue;
75
- }
76
-
77
- const node_is_leaf = bvh.node_is_leaf(node);
78
-
79
- if (!node_is_leaf) {
80
-
81
- traversal_stack[traversal_cursor++] = bvh.node_get_child1(node);
82
- traversal_stack[traversal_cursor++] = bvh.node_get_child2(node);
83
-
84
- } else {
85
- // leaf node
86
-
87
- result[result_cursor++] = node;
88
- }
89
- }
90
-
91
- // drop stack frame
92
- traversal_cursor = stack_frame_address;
93
-
94
- return result_cursor - result_offset;
95
- }