@woosh/meep-engine 2.35.17 → 2.36.2

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 (91) 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/highlight/HighlightDefinition.d.ts +10 -0
  54. package/engine/graphics/ecs/highlight/HighlightDefinition.js +18 -8
  55. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +5 -0
  56. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +46 -12
  57. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +81 -95
  58. package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +16 -5
  59. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +2 -0
  60. package/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -0
  61. package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +1 -1
  62. package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -2
  63. package/engine/graphics/geometry/MikkT/MikkTSpace.js +2210 -0
  64. package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +22 -0
  65. package/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
  66. package/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
  67. package/engine/graphics/{compute_geometry_polycount.js → geometry/compute_geometry_polycount.js} +0 -0
  68. package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +34 -3
  69. package/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
  70. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
  71. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +24 -0
  72. package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +42 -19
  73. package/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
  74. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -4
  75. package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +10 -0
  76. package/engine/graphics/micron/prototypeVirtualGeometry.js +5 -3
  77. package/engine/graphics/micron/render/refinement/ActivePatchList.js +2 -2
  78. package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +2 -2
  79. package/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -6
  80. package/engine/graphics/render/forward_plus/LightManager.js +3 -1
  81. package/engine/graphics/util/composeMatrix4.js +1 -53
  82. package/engine/graphics/util/composeMatrix4RotationScale.js +1 -1
  83. package/engine/intelligence/blackboard/AbstractBlackboard.js +9 -0
  84. package/engine/notify/Notification.js +1 -1
  85. package/engine/ui/DraggableAspect.js +4 -1
  86. package/engine/ui/notification/ViewEmitter.js +7 -1
  87. package/engine/ui/notification/notificationGenerator.js +1 -1
  88. package/engine/ui/scene/SceneGUIContext.js +11 -130
  89. package/engine/ui/scene/initializeNotifications.js +141 -0
  90. package/package.json +1 -1
  91. package/view/elements/notify/NotificationView.js +1 -2
@@ -0,0 +1,22 @@
1
+ import { genTangSpace, SMikkTSpaceContext } from "./MikkTSpace.js";
2
+
3
+ test('empty geometry', () => {
4
+ const ctx = new SMikkTSpaceContext();
5
+
6
+ expect(() => {
7
+ genTangSpace(ctx);
8
+ }).not.toThrow();
9
+
10
+ });
11
+
12
+ test('single triangle', () => {
13
+ const ctx = new SMikkTSpaceContext();
14
+
15
+ ctx.geometry_buffer_index = [0, 1, 2];
16
+ ctx.geometry_buffer_vertex_position = [1, 2, 3, 4, 5, 6, 7, 8, 9];
17
+ ctx.geometry_buffer_vertex_normal = [0, 1, 0, 0, 1, 0, 0, 1, 0];
18
+ ctx.geometry_buffer_vertex_uv = [0, 0, 0, 0, 0, 0];
19
+
20
+ genTangSpace(ctx);
21
+
22
+ });
@@ -0,0 +1,34 @@
1
+ import { buffer_geometry_generate_tangents } from "./buffer_geometry_generate_tangents.js";
2
+
3
+ /**
4
+ *
5
+ * @param {THREE.BufferGeometry} geo
6
+ */
7
+ export function buffer_geometry_ensure_tangents(geo) {
8
+ if (geo.getAttribute('tangent') !== undefined) {
9
+ // already got tangents
10
+ return;
11
+ }
12
+
13
+ if (geo.getIndex() === null) {
14
+ // non-indexed, unsupported
15
+ return;
16
+ }
17
+
18
+ if (geo.getAttribute('normal') === undefined) {
19
+ // no normals
20
+ return;
21
+ }
22
+
23
+ if (geo.getAttribute('uv') === undefined) {
24
+ // UVs are required by the algorithm
25
+ return;
26
+ }
27
+
28
+ if (geo.getAttribute('position') === undefined) {
29
+ // positions are required as well
30
+ return;
31
+ }
32
+
33
+ buffer_geometry_generate_tangents(geo);
34
+ }
@@ -0,0 +1,28 @@
1
+ import { BufferAttribute } from "three";
2
+ import { genTangSpace, SMikkTSpaceContext } from "./MikkTSpace.js";
3
+
4
+ /**
5
+ * only works with indexed geometries
6
+ * @param {THREE.BufferGeometry} geo
7
+ */
8
+ export function buffer_geometry_generate_tangents(geo) {
9
+
10
+ const attribute_position = geo.getAttribute('position');
11
+
12
+ if (geo.getAttribute('tangent') === undefined) {
13
+ geo.setAttribute('tangent', new BufferAttribute(new Float32Array(attribute_position.count * 4), 4, false));
14
+ }
15
+
16
+ const attribute_tangent = geo.getAttribute('tangent');
17
+
18
+
19
+ const ctx = new SMikkTSpaceContext();
20
+
21
+ ctx.geometry_buffer_index = geo.getIndex().array;
22
+ ctx.geometry_buffer_vertex_position = attribute_position.array;
23
+ ctx.geometry_buffer_vertex_normal = geo.getAttribute('normal').array;
24
+ ctx.geometry_buffer_vertex_uv = geo.getAttribute('uv').array;
25
+ ctx.geometry_buffer_vertex_tangent = attribute_tangent.array;
26
+
27
+ genTangSpace(ctx);
28
+ }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  BufferGeometry,
3
+ DynamicDrawUsage,
3
4
  InstancedBufferAttribute,
4
5
  InstancedBufferGeometry,
5
6
  MeshDepthMaterial,
6
- RGBADepthPacking,
7
- StreamDrawUsage
7
+ RGBADepthPacking
8
8
  } from 'three';
9
9
  import ThreeFactory from "../../three/ThreeFactory.js";
10
10
  import { StaticMaterialCache } from "../../../asset/loaders/material/StaticMaterialCache.js";
@@ -77,6 +77,13 @@ export class InstancedMeshGroup {
77
77
  */
78
78
  this.__attributeTransformArray = null;
79
79
 
80
+ /**
81
+ *
82
+ * @type {Usage}
83
+ * @private
84
+ */
85
+ this.__instanceUsage = DynamicDrawUsage;
86
+
80
87
  /**
81
88
  *
82
89
  * @type {Material}
@@ -90,6 +97,30 @@ export class InstancedMeshGroup {
90
97
  this.mesh = ThreeFactory.createMesh();
91
98
  }
92
99
 
100
+ /**
101
+ *
102
+ * @param {Usage} v
103
+ */
104
+ set instance_usage(v) {
105
+ if (this.__instanceUsage === v) {
106
+ return;
107
+ }
108
+
109
+ this.__instanceUsage = v;
110
+
111
+ if (this.__attributeTransform !== null) {
112
+ this.__attributeTransform.setUsage(v);
113
+ }
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @return {Usage}
119
+ */
120
+ get instance_usage() {
121
+ return this.__instanceUsage;
122
+ }
123
+
93
124
  dispose() {
94
125
  if (this.__threeGeometry !== null) {
95
126
  this.__threeGeometry.dispose();
@@ -367,7 +398,7 @@ export class InstancedMeshGroup {
367
398
  //rewrite old attributes
368
399
  this.__attributeTransformArray = newTransformArray;
369
400
  this.__attributeTransform = new InstancedBufferAttribute(newTransformArray, 16);
370
- this.__attributeTransform.setUsage(StreamDrawUsage);
401
+ this.__attributeTransform.setUsage(this.__instanceUsage);
371
402
 
372
403
  //add attributes to newly created geometry
373
404
  geometry.setAttribute("instanceMatrix", this.__attributeTransform);
@@ -3,7 +3,7 @@ import { AABB3 } from "../../../../core/bvh2/aabb3/AABB3.js";
3
3
  import Vector4 from "../../../../core/geom/Vector4.js";
4
4
  import { computeBoundingSphereFromVertexData } from "../computeBoundingSphereFromVertexData.js";
5
5
  import { Box3, Sphere as ThreeSphere, Vector3 as ThreeVector3 } from "three";
6
- import { computeBoundingBoxFromVertexData } from "../../util/computeBoundingBoxFromVertexData.js";
6
+ import { computeBoundingBoxFromVertexData } from "../../../../core/geom/3d/aabb/computeBoundingBoxFromVertexData.js";
7
7
 
8
8
  /**
9
9
  *
@@ -0,0 +1,83 @@
1
+ import { MicronGeometryBinarySerializationAdapter } from "../MicronGeometryBinarySerializationAdapter.js";
2
+ import { MicronGeometry } from "../../MicronGeometry.js";
3
+
4
+ const SUPPORTED_ADAPTER_VERSION = 0;
5
+ const HEADER_MAGIC_TEXT = 'MICRON#001';
6
+
7
+ function obtain_micron_adapter() {
8
+
9
+ const ga = new MicronGeometryBinarySerializationAdapter();
10
+
11
+ if (ga.version !== SUPPORTED_ADAPTER_VERSION) {
12
+ throw new Error(`Incorrect version of serialization adapter, expected ${SUPPORTED_ADAPTER_VERSION}, instead got ${ga.version}`);
13
+ }
14
+
15
+ return ga;
16
+ }
17
+
18
+ /**
19
+ *
20
+ * @param {MicronGeometry[]} destination
21
+ * @param {BinaryBuffer} buffer
22
+ * @returns {number} how many geometries were read
23
+ */
24
+ export function deserialize_geometry_collection(destination, buffer) {
25
+ // read header
26
+ const header_text = buffer.readASCIICharacters(HEADER_MAGIC_TEXT.length);
27
+
28
+ if (header_text !== HEADER_MAGIC_TEXT) {
29
+ throw new Error(`Wrong header magic, expected '${HEADER_MAGIC_TEXT}', instead got '${header_text}'`);
30
+ }
31
+
32
+ // read how many geometries we're expecting
33
+ const geometry_occupies_count = buffer.readUint32();
34
+
35
+ const ga = obtain_micron_adapter();
36
+
37
+ for (let i = 0; i < geometry_occupies_count; i++) {
38
+ // read key
39
+ const key = buffer.readUint32();
40
+
41
+ const geometry = new MicronGeometry();
42
+
43
+ ga.deserialize(buffer, geometry);
44
+
45
+ destination[key] = geometry;
46
+ }
47
+
48
+ return geometry_occupies_count;
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @param {MicronGeometry[]} geometries
54
+ * @param {BinaryBuffer} buffer
55
+ */
56
+ export function serialize_geometry_collection(geometries, buffer) {
57
+ // write header
58
+ buffer.writeASCIIString(HEADER_MAGIC_TEXT); // magic bytes
59
+
60
+ // count geometries
61
+ let geometry_occupied_count = 0;
62
+ const geometry_count = geometries.length;
63
+ for (let i = 0; i < geometry_count; i++) {
64
+ if (geometries[i] === undefined) {
65
+ geometry_occupied_count++;
66
+ }
67
+ }
68
+
69
+ buffer.writeUint32(geometry_occupied_count); // how many geometries to expect
70
+
71
+ const ga = obtain_micron_adapter();
72
+
73
+ for (let i = 0; i < geometry_count; i++) {
74
+ const geometry = geometries[i];
75
+ if (geometry === undefined) {
76
+ continue;
77
+ }
78
+
79
+ buffer.writeUint32(i); // key
80
+
81
+ ga.serialize(buffer, geometry);
82
+ }
83
+ }
@@ -0,0 +1,24 @@
1
+ import { deserialize_geometry_collection, serialize_geometry_collection } from "./geometry_collection_serialization.js";
2
+ import { BinaryBuffer } from "../../../../../../core/binary/BinaryBuffer.js";
3
+
4
+ test('serialize empty', () => {
5
+ const bb = new BinaryBuffer();
6
+
7
+ expect(() => {
8
+ serialize_geometry_collection([], bb);
9
+ }).not.toThrow();
10
+
11
+ });
12
+
13
+ test('serialize/deserialize empty', () => {
14
+ const bb = new BinaryBuffer();
15
+
16
+ serialize_geometry_collection([], bb);
17
+
18
+ bb.position = 0;
19
+
20
+ const destination = [];
21
+ deserialize_geometry_collection(destination, bb);
22
+
23
+ expect(destination.length).toBe(0);
24
+ });
@@ -1,15 +1,15 @@
1
1
  import { AssetTransformer } from "../../../asset/AssetTransformer.js";
2
- import { MicronGeometryBinarySerializationAdapter } from "../format/serialization/MicronGeometryBinarySerializationAdapter.js";
3
- import { MICRON_URI_FIELD } from "../MICRON_URI_FIELD.js";
4
2
  import { computePathDirectory } from "../../../../core/FilePath.js";
5
3
  import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
6
4
  import { MicronGeometry } from "../format/MicronGeometry.js";
7
5
  import { MICRON_GEOMETRY_FIELD } from "../MICRON_GEOMETRY_FIELD.js";
8
6
  import { async_traverse_three_object } from "../../../asset/loaders/async_traverse_three_object.js";
9
7
  import { convert_three_object_to_micron } from "../convert_three_object_to_micron.js";
10
- import { compute_geometry_polycount } from "../../compute_geometry_polycount.js";
8
+ import { compute_geometry_polycount } from "../../geometry/compute_geometry_polycount.js";
11
9
  import { traverseThreeObject } from "../../ecs/highlight/renderer/traverseThreeObject.js";
12
10
  import { max2 } from "../../../../core/math/max2.js";
11
+ import { deserialize_geometry_collection } from "../format/serialization/collection/geometry_collection_serialization.js";
12
+ import { GLTF_MICRON_ID_FIELD } from "./GLTF_MICRON_ID_FIELD.js";
13
13
 
14
14
  export const ASSET_TYPE_ARRAY_BUFFER = "arraybuffer";
15
15
 
@@ -85,10 +85,10 @@ export class GLTFAssetTransformer extends AssetTransformer {
85
85
 
86
86
  /**
87
87
  *
88
- * @type {MicronGeometryBinarySerializationAdapter}
88
+ * @type {MicronGeometry[]}
89
89
  * @private
90
90
  */
91
- this.__serde = new MicronGeometryBinarySerializationAdapter();
91
+ this.__active_mesh_micron_cache = [];
92
92
  }
93
93
 
94
94
  /**
@@ -116,23 +116,52 @@ export class GLTFAssetTransformer extends AssetTransformer {
116
116
  */
117
117
  const geometry = object.geometry;
118
118
 
119
- const micron_uri = geometry.userData[MICRON_URI_FIELD];
119
+ const micron_geometry_index = geometry.userData[GLTF_MICRON_ID_FIELD];
120
120
 
121
- if (typeof micron_uri !== "string") {
121
+ if (typeof micron_geometry_index !== "number") {
122
122
  return;
123
123
  }
124
124
 
125
+ const micron_geometry = this.__active_mesh_micron_cache[micron_geometry_index];
125
126
 
126
- /**
127
- * @type {AssetDescription}
128
- */
129
- const ad = ctx.asset;
127
+ if (micron_geometry === undefined) {
128
+ console.error(`Micron geometry '${micron_geometry_index}' not found`);
129
+ return;
130
+ }
131
+
132
+ // set proxy for raycasting
133
+ micron_geometry.proxy = geometry;
134
+
135
+ geometry[MICRON_GEOMETRY_FIELD] = micron_geometry;
136
+ }
137
+
138
+
139
+ /**
140
+ *
141
+ * @param {{userData:{}}} gltf
142
+ * @param {AssetDescription} ad
143
+ * @private
144
+ */
145
+ async __load_mesh_micron_data(gltf, ad) {
146
+ // clear active cache
147
+ this.__active_mesh_micron_cache = [];
148
+
149
+ const micron_metadata = gltf.userData.micron;
150
+
151
+ if (micron_metadata === undefined) {
152
+ return;
153
+ }
154
+
155
+ const uri = micron_metadata.geometry_data_uri;
156
+ if (uri === undefined) {
157
+ return;
158
+ }
130
159
 
131
160
  const base = computePathDirectory(ad.path);
132
161
 
133
162
  let micron_data;
134
163
 
135
- const micron_path = `${base}/${micron_uri}`;
164
+ const micron_path = `${base}/${uri}`;
136
165
 
137
166
  try {
138
167
  micron_data = await this.__am.promise(micron_path, ASSET_TYPE_ARRAY_BUFFER);
@@ -143,14 +172,8 @@ export class GLTFAssetTransformer extends AssetTransformer {
143
172
 
144
173
  // deserialize micron data
145
174
  const buffer = BinaryBuffer.fromArrayBuffer(micron_data.create());
146
- const micron_geometry = new MicronGeometry();
147
175
 
148
- this.__serde.deserialize(buffer, micron_geometry);
149
-
150
- // set proxy for raycasting
151
- micron_geometry.proxy = geometry;
152
-
153
- geometry[MICRON_GEOMETRY_FIELD] = micron_geometry;
176
+ deserialize_geometry_collection(this.__active_mesh_micron_cache, buffer);
154
177
  }
155
178
 
156
179
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ * @type {string}
4
+ */
5
+ export const GLTF_MICRON_ID_FIELD = '@micron_geometry_index';
@@ -135,10 +135,6 @@ export class MicronRenderPlugin extends EnginePlugin {
135
135
  view.on.preRender.remove(observer);
136
136
  }
137
137
 
138
- __ingest_cache() {
139
- this.engine.storage.lo
140
- }
141
-
142
138
  async startup() {
143
139
 
144
140
  const engine = this.engine;
@@ -90,6 +90,16 @@ export class MicronShadedGeometryRenderAdapter extends AbstractRenderAdapter {
90
90
  pixelRatio = renderer.getPixelRatio();
91
91
  }
92
92
 
93
+ // clear context
94
+ const material_contexts = this.ctx.contexts_array;
95
+ const contexts_count = material_contexts.length;
96
+ for (let i = 0; i < contexts_count; i++) {
97
+ const mc = material_contexts[i];
98
+
99
+ mc.instances.clear();
100
+ }
101
+
102
+ // initialize geometry builder
93
103
  const vg_builder = this.ctx.builder;
94
104
 
95
105
  vg_builder.resolution.set(resolution.x * pixelRatio, resolution.y * pixelRatio);
@@ -38,7 +38,9 @@ import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
38
38
  import { TextureAttachmentsByMaterialType } from "../../asset/loaders/material/TextureAttachmensByMaterialType.js";
39
39
  import { distributePointsOnMesh } from "../particles/particular/engine/utils/distrubuteParticlesOnMesh.js";
40
40
  import { BinaryNode } from "../../../core/bvh2/BinaryNode.js";
41
- import { queryBinaryNode_SphereIntersections_Data } from "../../../core/bvh2/traversal/queryBinaryNode_SphereIntersections.js";
41
+ import {
42
+ queryBinaryNode_SphereIntersections_Data
43
+ } from "../../../core/bvh2/traversal/queryBinaryNode_SphereIntersections.js";
42
44
  import { ensureGeometryBoundingSphere } from "../geometry/buffered/ensureGeometryBoundingSphere.js";
43
45
  import { StaticMaterialCache } from "../../asset/loaders/material/StaticMaterialCache.js";
44
46
  import convertSampler2D2Canvas from "../texture/sampler/Sampler2D2Canvas.js";
@@ -461,7 +463,7 @@ function init() {
461
463
 
462
464
  // sample_gltf_sponza();
463
465
  // gltf_sample('data/models/RTS_Buildings_Humans/18/Building_R_18_out/Building_R_18.gltf');
464
- // sample_lucy();
466
+ sample_lucy();
465
467
  // sample_dragon();
466
468
  // sample_gltf_hapro_2();
467
469
  // sample_gltf_hapro_1();
@@ -481,7 +483,7 @@ function init() {
481
483
  // gltf_sample('moicon/03_Jan_22_Demo/8-assets/model.gltf');
482
484
  // gltf_sample('moicon/03_Jan_22_Demo/worker_test/model.gltf');
483
485
  // gltf_sample('moicon/A4/A4/model.gltf');
484
- gltf_sample('moicon/06_04_hapro/08-clickable-assets-new/model.gltf');
486
+ // gltf_sample('moicon/06_04_hapro/08-clickable-assets-new/model.gltf');
485
487
  // gltf_sample('moicon/ztest_object_many_pieces/model.gltf');
486
488
  // gltf_grid('moicon/ztest_object_many_pieces/model.gltf', 3, 3);
487
489
 
@@ -2,7 +2,7 @@ import { ActivePatchRecord } from "./ActivePatchRecord.js";
2
2
  import { ActivePatchFlags } from "./ActivePatchFlags.js";
3
3
  import { aabb3_project_to_2d } from "../../../../../core/geom/3d/aabb/aabb3_compute_projected_area.js";
4
4
  import { BitSet } from "../../../../../core/binary/BitSet.js";
5
- import { aabb3_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_intersects_frustum_array.js";
5
+ import { aabb3_array_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js";
6
6
 
7
7
  export class ActivePatchList {
8
8
  constructor() {
@@ -199,7 +199,7 @@ export class ActivePatchList {
199
199
  check if node is in view frustum
200
200
  NOTE: following suggestion in "FastMesh: Efficient View-dependent Meshing" by Renato Pajarola et al, we can do a more coarse frustum test approximating frustum as a cone initially
201
201
  */
202
- const in_view_frustum = aabb3_intersects_frustum_array(node.bounding_box, frustum_planes);
202
+ const in_view_frustum = aabb3_array_intersects_frustum_array(node.bounding_box, frustum_planes);
203
203
 
204
204
  if (!in_view_frustum) {
205
205
  // outside of view frustum, cull
@@ -1,5 +1,5 @@
1
1
  import { BitSet } from "../../../../../core/binary/BitSet.js";
2
- import { aabb3_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_intersects_frustum_array.js";
2
+ import { aabb3_array_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js";
3
3
  import { aabb3_estimate_projected_area2 } from "../../../../../core/geom/3d/aabb/aabb3_estimate_projected_area2.js";
4
4
 
5
5
 
@@ -67,7 +67,7 @@ export function get_geometry_patch_cut(
67
67
  check if node is in view frustum
68
68
  NOTE: following suggestion in "FastMesh: Efficient View-dependent Meshing" by Renato Pajarola et al, we can do a more coarse frustum test approximating frustum as a cone initially
69
69
  */
70
- const in_view_frustum = aabb3_intersects_frustum_array(patch.bounding_box, frustum_planes);
70
+ const in_view_frustum = aabb3_array_intersects_frustum_array(patch.bounding_box, frustum_planes);
71
71
 
72
72
  if (!in_view_frustum) {
73
73
  continue;
@@ -5,12 +5,6 @@ import Signal from "../../../../../core/events/signal/Signal.js";
5
5
  import { MaterialContext } from "./MaterialContext.js";
6
6
  import { MaterialVertexSpec, MaterialVertexSpecFlags } from "./MaterialVertexSpec.js";
7
7
 
8
- /**
9
- *
10
- * @type {MaterialVertexSpec}
11
- */
12
- const scratch_mvc = new MaterialVertexSpec();
13
-
14
8
  export class MicronRenderContext {
15
9
  constructor() {
16
10
 
@@ -25,7 +25,9 @@ import { read_frustum_planes_to_array } from "./cluster/read_frustum_planes_to_a
25
25
  import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
26
26
  import { TextureBackedMemoryRegion } from "./data/TextureBackedMemoryRegion.js";
27
27
  import { assert } from "../../../../core/assert.js";
28
- import { DataType2TypedArrayConstructorMapping } from "../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
28
+ import {
29
+ DataType2TypedArrayConstructorMapping
30
+ } from "../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
29
31
  import { NumericType } from "./data/NumericType.js";
30
32
  import { computeDataType } from "./data/computeDataType.js";
31
33
  import { computeThreeTextureTypeFromDataType } from "./data/computeThreeTextureTypeFromDataType.js";
@@ -1,56 +1,4 @@
1
- /**
2
- *
3
- * @param {number[]|Float32Array|mat4} result
4
- * @param {Vector3} position
5
- * @param {Quaternion} rotation
6
- * @param {Vector3} scale
7
- */
8
- export function compose_matrix4_array(result, position, rotation, scale) {
9
- const x = rotation.x;
10
- const y = rotation.y;
11
- const z = rotation.z;
12
- const w = rotation.w;
13
-
14
- const x2 = x + x;
15
- const y2 = y + y;
16
- const z2 = z + z;
17
-
18
- const xx = x * x2;
19
- const xy = x * y2;
20
- const xz = x * z2;
21
-
22
- const yy = y * y2;
23
- const yz = y * z2;
24
- const zz = z * z2;
25
-
26
- const wx = w * x2;
27
- const wy = w * y2;
28
- const wz = w * z2;
29
-
30
- const sx = scale.x;
31
- const sy = scale.y;
32
- const sz = scale.z;
33
-
34
- result[0] = (1 - (yy + zz)) * sx;
35
- result[1] = (xy + wz) * sx;
36
- result[2] = (xz - wy) * sx;
37
- result[3] = 0;
38
-
39
- result[4] = (xy - wz) * sy;
40
- result[5] = (1 - (xx + zz)) * sy;
41
- result[6] = (yz + wx) * sy;
42
- result[7] = 0;
43
-
44
- result[8] = (xz + wy) * sz;
45
- result[9] = (yz - wx) * sz;
46
- result[10] = (1 - (xx + yy)) * sz;
47
- result[11] = 0;
48
-
49
- result[12] = position.x;
50
- result[13] = position.y;
51
- result[14] = position.z;
52
- result[15] = 1;
53
- }
1
+ import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
54
2
 
55
3
  /**
56
4
  *
@@ -1,5 +1,5 @@
1
- import { compose_matrix4_array } from "./composeMatrix4.js";
2
1
  import Vector3 from "../../../core/geom/Vector3.js";
2
+ import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
3
3
 
4
4
  /**
5
5
  *
@@ -48,6 +48,15 @@ export class AbstractBlackboard {
48
48
  return this.acquire(name, DataType.Number, initialValue);
49
49
  }
50
50
 
51
+ /**
52
+ *
53
+ * @param {string} name
54
+ * @returns {void}
55
+ */
56
+ incrementNumber(name) {
57
+ this.acquireNumber(name).increment();
58
+ }
59
+
51
60
  /**
52
61
  *
53
62
  * @param {string} name
@@ -16,7 +16,7 @@ export class Notification {
16
16
  * @constructor
17
17
  */
18
18
  constructor({ title = "", description = "", image = "", classList = [] }) {
19
- assert.ok(Array.isArray(classList), 'classList must be an array, was something else instead');
19
+ assert.isArray(classList, 'classList');
20
20
 
21
21
  this.title = title;
22
22
 
@@ -12,7 +12,7 @@ export class DraggableAspect {
12
12
  *
13
13
  * @param {EventTarget} el
14
14
  * @param {function} [dragStart=noop]
15
- * @param {function} [drag=noop]
15
+ * @param {(position:Vector2,origin:Vector2)=>*} [drag=noop]
16
16
  * @param {function} [dragEnd=noop]
17
17
  * @param {boolean} [stopPropagation=true] prevent propagation of pointer events up the DOM tree
18
18
  */
@@ -34,6 +34,8 @@ export class DraggableAspect {
34
34
  const pointerGlobal = this.pointerGlobal = new PointerDevice(window);
35
35
 
36
36
  const dragOriginalPosition = new Vector2();
37
+ const delta = new Vector2();
38
+ const pointer_position_last = new Vector2();
37
39
 
38
40
  if (stopPropagation) {
39
41
  this.pointerLocal.on.down.add((p, e) => {
@@ -43,6 +45,7 @@ export class DraggableAspect {
43
45
 
44
46
  this.pointerLocal.on.dragStart.add((position) => {
45
47
  dragOriginalPosition.copy(position);
48
+ pointer_position_last.copy(position);
46
49
  pointerGlobal.start();
47
50
 
48
51
  dragStart(position);
@@ -1,7 +1,9 @@
1
1
  import Vector2 from "../../../core/geom/Vector2.js";
2
2
  import { AnimatedObjectEmitter } from "./AnimatedObjectEmitter.js";
3
3
 
4
-
4
+ /**
5
+ * @template T
6
+ */
5
7
  class ViewEmitter {
6
8
  /**
7
9
  *
@@ -24,6 +26,10 @@ class ViewEmitter {
24
26
  return view;
25
27
  };
26
28
 
29
+ /**
30
+ *
31
+ * @type {(T)=>View}
32
+ */
27
33
  this.viewFactory = null;
28
34
 
29
35
  /**
@@ -41,7 +41,7 @@ function notificationGenerator(callback, timeout = 5) {
41
41
  *
42
42
  * @param {NotificationManager} notifications
43
43
  */
44
- function testNotifications(notifications) {
44
+ export function testNotifications(notifications) {
45
45
  notificationGenerator(n => {
46
46
  notifications.addNotification(n, NotificationAreaKind.Primary);
47
47
  }, 1.3);