@woosh/meep-engine 2.35.16 → 2.36.1

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 (101) hide show
  1. package/core/binary/BinaryBuffer.js +42 -17
  2. package/core/bvh2/BinaryNode.js +1 -1
  3. package/core/bvh2/aabb3/AABB3.js +2 -2
  4. package/core/bvh2/aabb3/aabb3_array_combine.js +20 -0
  5. package/core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js +20 -0
  6. package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +1 -0
  7. package/core/bvh2/aabb3/aabb3_array_intersects_ray_array.js +14 -0
  8. package/core/bvh2/{aabb3_combined_surface_area.js → aabb3/aabb3_combined_surface_area.js} +3 -3
  9. package/core/bvh2/aabb3/aabb3_intersects_frustum_array.js +1 -19
  10. package/core/bvh2/bvh3/BVHNodeProxy.js +53 -0
  11. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +848 -0
  12. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +142 -0
  13. package/core/bvh2/bvh3/bvh_query_leaves_generic.js +79 -0
  14. package/core/bvh2/bvh3/bvh_query_leaves_ray.js +95 -0
  15. package/core/bvh2/bvh3/query/BVHQuery.js +11 -0
  16. package/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +36 -0
  17. package/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +36 -0
  18. package/core/collection/array/copyArray.js +2 -2
  19. package/core/collection/table/RowFirstTable.js +25 -7
  20. package/core/collection/table/RowFirstTableSpec.js +4 -4
  21. package/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +1 -1
  22. package/{engine/graphics/util → core/geom/3d/aabb}/computeBoundingBoxFromVertexData.js +1 -1
  23. package/core/geom/3d/compose_matrix4_array.js +53 -0
  24. package/{engine/graphics/util → core/geom/3d}/decompose_matrix_4_array.js +0 -0
  25. package/core/geom/AABB2.d.ts +2 -0
  26. package/core/geom/Vector1.js +2 -3
  27. package/core/geom/Vector3.js +5 -1
  28. package/core/process/undo/ActionProcessor.js +31 -3
  29. package/core/process/undo/ActionProcessor.spec.js +1 -1
  30. package/engine/animation/curve/AnimationCurve.js +40 -1
  31. package/engine/animation/curve/Keyframe.js +19 -0
  32. package/engine/animation/curve/compression/animation_curve_to_float_array.js +35 -0
  33. package/engine/animation/curve/compression/downsample_float_array.js +50 -0
  34. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +147 -0
  35. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.spec.js +47 -0
  36. package/engine/animation/curve/compression/prototypeCurveCompression.js +154 -0
  37. package/engine/animation/curve/draw/build_curve_editor.js +316 -0
  38. package/engine/animation/curve/draw/build_plot_entity_from_array.js +47 -0
  39. package/engine/animation/curve/draw/build_tangent_editor.js +115 -0
  40. package/engine/animation/curve/draw/draw_grid.js +27 -0
  41. package/engine/animation/curve/draw/draw_label.js +17 -0
  42. package/engine/animation/curve/draw/plot_array.js +76 -0
  43. package/engine/animation/curve/draw/plot_data.js +49 -0
  44. package/engine/asset/loaders/GLTFAssetLoader.js +3 -0
  45. package/engine/asset/loaders/gltf/GLTFAssetTransformMikkTSpaceTangents.js +27 -0
  46. package/engine/ecs/EntityComponentDataset.js +7 -4
  47. package/engine/ecs/foliage/InstancedFoliage.js +1 -1
  48. package/engine/ecs/foliage/ViewState.js +1 -1
  49. package/engine/ecs/parent/EntityNode.d.ts +7 -3
  50. package/engine/ecs/parent/EntityNode.js +21 -0
  51. package/engine/ecs/parent/entity_node_compute_bounding_box.js +41 -0
  52. package/engine/ecs/transform/Transform.js +2 -2
  53. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +5 -0
  54. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +46 -12
  55. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +81 -95
  56. package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +16 -5
  57. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +2 -0
  58. package/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -0
  59. package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +3 -4
  60. package/engine/graphics/ecs/path/PathDisplaySystem.js +2 -1
  61. package/engine/graphics/ecs/path/testPathDisplaySystem.js +8 -8
  62. package/engine/graphics/ecs/path/tube/CapType.d.ts +5 -0
  63. package/engine/graphics/ecs/path/tube/CapType.js +9 -0
  64. package/engine/graphics/ecs/path/tube/TubePathStyle.d.ts +2 -0
  65. package/engine/graphics/ecs/path/tube/TubePathStyle.js +10 -1
  66. package/engine/graphics/ecs/path/tube/build/GeometryOutput.js +90 -0
  67. package/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +3 -2
  68. package/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +1 -1
  69. package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -2
  70. package/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +353 -91
  71. package/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +390 -0
  72. package/engine/graphics/geometry/MikkT/MikkTSpace.js +2210 -0
  73. package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +22 -0
  74. package/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
  75. package/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
  76. package/engine/graphics/{compute_geometry_polycount.js → geometry/compute_geometry_polycount.js} +0 -0
  77. package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +34 -3
  78. package/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
  79. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
  80. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +24 -0
  81. package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +42 -19
  82. package/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
  83. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -4
  84. package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +10 -0
  85. package/engine/graphics/micron/prototypeVirtualGeometry.js +5 -3
  86. package/engine/graphics/micron/render/refinement/ActivePatchList.js +2 -2
  87. package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +2 -2
  88. package/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -6
  89. package/engine/graphics/render/forward_plus/LightManager.js +3 -1
  90. package/engine/graphics/util/composeMatrix4.js +1 -53
  91. package/engine/graphics/util/composeMatrix4RotationScale.js +1 -1
  92. package/engine/intelligence/behavior/ecs/BehaviorComponent.js +1 -1
  93. package/engine/intelligence/blackboard/AbstractBlackboard.js +9 -0
  94. package/engine/notify/Notification.js +1 -1
  95. package/engine/ui/DraggableAspect.js +4 -1
  96. package/engine/ui/notification/ViewEmitter.js +7 -1
  97. package/engine/ui/notification/notificationGenerator.js +1 -1
  98. package/engine/ui/scene/SceneGUIContext.js +11 -130
  99. package/engine/ui/scene/initializeNotifications.js +141 -0
  100. package/package.json +1 -1
  101. package/view/elements/notify/NotificationView.js +1 -2
@@ -359,14 +359,14 @@ function main(engine) {
359
359
 
360
360
  const pathDisplay = new PathDisplay();
361
361
  pathDisplay.specs.push(
362
- PathDisplaySpec.from(
363
- PathDisplayType.Ribbon,
364
- trailPathStyle
365
- ),
366
- PathDisplaySpec.from(
367
- PathDisplayType.Entity,
368
- sample_style_entity()
369
- ),
362
+ // PathDisplaySpec.from(
363
+ // PathDisplayType.Ribbon,
364
+ // trailPathStyle
365
+ // ),
366
+ // PathDisplaySpec.from(
367
+ // PathDisplayType.Entity,
368
+ // sample_style_entity()
369
+ // ),
370
370
  PathDisplaySpec.from(
371
371
  PathDisplayType.Tube,
372
372
  sample_style_tube()
@@ -0,0 +1,5 @@
1
+ export enum CapType {
2
+ None,
3
+ Flat,
4
+ Round
5
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @readonly
3
+ * @enum {number}
4
+ */
5
+ export const CapType = {
6
+ None: 0,
7
+ Flat: 1,
8
+ Round: 2
9
+ };
@@ -2,6 +2,7 @@ import {Color} from "../../../../../core/color/Color";
2
2
  import {TubeMaterialType} from "./TubeMaterialType";
3
3
  import {StandardMaterialDefinition} from "./StandardMaterialDefinition";
4
4
  import {MatcapMaterialDefinition} from "./MatcapMaterialDefinition";
5
+ import {CapType} from "./CapType";
5
6
 
6
7
  export class TubePathStyle {
7
8
  public color: Color
@@ -14,4 +15,5 @@ export class TubePathStyle {
14
15
  public cast_shadow: boolean
15
16
  public receive_shadow: boolean
16
17
  public path_mask: number[]
18
+ public cap_type: CapType
17
19
  }
@@ -2,6 +2,7 @@ import { Color } from "../../../../../core/color/Color.js";
2
2
  import { TubeMaterialType } from "./TubeMaterialType.js";
3
3
  import { assert } from "../../../../../core/assert.js";
4
4
  import { MatcapMaterialDefinition } from "./MatcapMaterialDefinition.js";
5
+ import { CapType } from "./CapType.js";
5
6
 
6
7
  const DEFAULT_COLOR = Object.freeze({ r: 1, g: 1, b: 1 });
7
8
 
@@ -71,6 +72,11 @@ export class TubePathStyle {
71
72
  * @type {number[]}
72
73
  */
73
74
  this.path_mask = [0, 1];
75
+
76
+ /**
77
+ * @type {CapType}
78
+ */
79
+ this.cap_type = CapType.Flat;
74
80
  }
75
81
 
76
82
  static fromJSON(j) {
@@ -91,7 +97,8 @@ export class TubePathStyle {
91
97
  radial_resolution = 16,
92
98
  cast_shadow = false,
93
99
  receive_shadow = false,
94
- path_mask = [0, 1]
100
+ path_mask = [0, 1],
101
+ cap_type = CapType.None
95
102
  }) {
96
103
  assert.enum(material_type, TubeMaterialType, 'material_type');
97
104
  assert.isNumber(opacity, 'opacity');
@@ -106,6 +113,7 @@ export class TubePathStyle {
106
113
 
107
114
  assert.greaterThanOrEqual(path_mask.length, 2, 'path_mask length bust be at least 2');
108
115
  assert.ok(path_mask.length % 2 === 0, 'path_mask length bust be multiple of 2');
116
+ assert.enum(cap_type, CapType, 'cap_type');
109
117
 
110
118
  if (typeof color === 'string') {
111
119
  this.color.parse(color);
@@ -123,6 +131,7 @@ export class TubePathStyle {
123
131
  this.receive_shadow = receive_shadow;
124
132
 
125
133
  this.path_mask = path_mask;
134
+ this.cap_type = cap_type;
126
135
 
127
136
  switch (material_type) {
128
137
  case TubeMaterialType.Matcap:
@@ -0,0 +1,90 @@
1
+ import { UintArrayForCount } from "../../../../../../core/collection/array/typed/uint_array_for_count.js";
2
+ import { BufferAttribute, BufferGeometry } from "three";
3
+
4
+ /**
5
+ * Helper class, allowing us to treat geometry build process as a stream without having to create intermediate arrays and performing unnecessary copying
6
+ */
7
+ export class GeometryOutput {
8
+ constructor() {
9
+ /**
10
+ *
11
+ * @type {number}
12
+ */
13
+ this.cursor_vertices = 0;
14
+
15
+ /**
16
+ *
17
+ * @type {number}
18
+ */
19
+ this.cursor_indices = 0;
20
+
21
+ /**
22
+ *
23
+ * @type {Float32Array|number[]|null}
24
+ * @private
25
+ */
26
+ this.__vertex_positions = null;
27
+ /**
28
+ *
29
+ * @type {Float32Array|number[]|null}
30
+ * @private
31
+ */
32
+ this.__vertex_normals = null;
33
+ /**
34
+ *
35
+ * @type {Float32Array|number[]|null}
36
+ * @private
37
+ */
38
+ this.__vertex_uvs = null;
39
+ /**
40
+ *
41
+ * @type {Uint8Array|Uint16Array|Uint32Array|number[]|null}
42
+ * @private
43
+ */
44
+ this.__indices = null;
45
+ }
46
+
47
+ get positions() {
48
+ return this.__vertex_positions;
49
+ }
50
+
51
+ get normals() {
52
+ return this.__vertex_normals;
53
+ }
54
+
55
+ get uvs() {
56
+ return this.__vertex_uvs;
57
+ }
58
+
59
+ get indices() {
60
+ return this.__indices;
61
+ }
62
+
63
+ /**
64
+ *
65
+ * @param {number} vertex_count
66
+ * @param {number} polygon_count
67
+ */
68
+ allocate(vertex_count, polygon_count) {
69
+ this.__vertex_positions = new Float32Array(vertex_count * 3);
70
+ this.__vertex_normals = new Float32Array(vertex_count * 3);
71
+ this.__vertex_uvs = new Float32Array(vertex_count * 2);
72
+
73
+ const INDEX_BUFFER_CLASS = UintArrayForCount(vertex_count);
74
+ this.__indices = new INDEX_BUFFER_CLASS(polygon_count * 3);
75
+ }
76
+
77
+ /**
78
+ * @returns {THREE.BufferGeometry}
79
+ */
80
+ build() {
81
+ const geometry = new BufferGeometry();
82
+
83
+ geometry.setIndex(new BufferAttribute(this.__indices, 1));
84
+ geometry.setAttribute('position', new BufferAttribute(this.__vertex_positions, 3));
85
+ geometry.setAttribute('normal', new BufferAttribute(this.__vertex_normals, 3));
86
+ geometry.setAttribute('uv', new BufferAttribute(this.__vertex_uvs, 2));
87
+
88
+ return geometry;
89
+ }
90
+ }
@@ -36,6 +36,7 @@ export function build_geometry_catmullrom(path, style, segment_start, segment_en
36
36
 
37
37
  const max_i = segment_end * (total_points - 1);
38
38
  for (i = Math.ceil(segment_start * total_points + 0.0001); i < max_i; i++) {
39
+ // TODO initial i value can potentially result in sample being produced before the "segment start"
39
40
  const t = i / (total_points - 1);
40
41
 
41
42
  path.sample_catmull_rom(point, path_length * t);
@@ -45,7 +46,7 @@ export function build_geometry_catmullrom(path, style, segment_start, segment_en
45
46
  added_points++
46
47
  }
47
48
 
48
- if (((i - 1) / (total_points - 1)) - segment_end > 0.0001) {
49
+ if (segment_end - ((i - 1) / (total_points - 1)) > 0.0001) {
49
50
  // end
50
51
 
51
52
  path.sample_catmull_rom(point, segment_end * path_length);
@@ -57,5 +58,5 @@ export function build_geometry_catmullrom(path, style, segment_start, segment_en
57
58
 
58
59
  const frames = computeFrenetFrames(points_f32, false);
59
60
 
60
- return makeTubeGeometry(points_f32, frames.normals, frames.binormals, style.width, style.radial_resolution, false);
61
+ return makeTubeGeometry(points_f32, frames.normals, frames.binormals, style.width, style.radial_resolution, false, style.cap_type);
61
62
  }
@@ -52,5 +52,5 @@ export function build_geometry_linear(path, style, segment_start, segment_end) {
52
52
 
53
53
  const frames = computeFrenetFrames(points, false);
54
54
 
55
- return makeTubeGeometry(points, frames.normals, frames.binormals, style.width, style.radial_resolution, false);
55
+ return makeTubeGeometry(points, frames.normals, frames.binormals, style.width, style.radial_resolution, false, style.cap_type);
56
56
  }
@@ -1,5 +1,4 @@
1
- import { Vector3 } from "three";
2
- import { Matrix4 } from "three/src/math/Matrix4.js";
1
+ import { Matrix4, Vector3 } from "three";
3
2
  import { max2 } from "../../../../../../core/math/max2.js";
4
3
  import { min2 } from "../../../../../../core/math/min2.js";
5
4
  import { clamp } from "../../../../../../core/math/clamp.js";