@woosh/meep-engine 2.36.0 → 2.36.4

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 (41) hide show
  1. package/core/collection/queue/Deque.js +1 -1
  2. package/core/color/Color.d.ts +32 -2
  3. package/core/color/Color.js +31 -18
  4. package/core/geom/AABB2.d.ts +2 -0
  5. package/core/geom/Vector3.js +5 -1
  6. package/core/process/undo/ActionProcessor.js +31 -3
  7. package/core/process/undo/ActionProcessor.spec.js +1 -1
  8. package/engine/animation/curve/AnimationCurve.js +40 -1
  9. package/engine/animation/curve/Keyframe.js +19 -0
  10. package/engine/animation/curve/compression/animation_curve_to_float_array.js +35 -0
  11. package/engine/animation/curve/compression/downsample_float_array.js +50 -0
  12. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +147 -0
  13. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.spec.js +47 -0
  14. package/engine/animation/curve/compression/prototypeCurveCompression.js +154 -0
  15. package/engine/animation/curve/draw/build_curve_editor.js +316 -0
  16. package/engine/animation/curve/draw/build_plot_entity_from_array.js +47 -0
  17. package/engine/animation/curve/draw/build_tangent_editor.js +115 -0
  18. package/engine/animation/curve/draw/draw_grid.js +27 -0
  19. package/engine/animation/curve/draw/draw_label.js +17 -0
  20. package/engine/animation/curve/draw/plot_array.js +76 -0
  21. package/engine/animation/curve/draw/plot_data.js +49 -0
  22. package/engine/ecs/parent/EntityNode.d.ts +7 -3
  23. package/engine/ecs/parent/EntityNode.js +21 -0
  24. package/engine/ecs/parent/entity_node_compute_bounding_box.js +41 -0
  25. package/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +11 -1
  26. package/engine/graphics/ecs/highlight/HighlightDefinition.js +18 -8
  27. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +5 -1
  28. package/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +122 -0
  29. package/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +148 -0
  30. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +2 -0
  31. package/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.d.ts +4 -0
  32. package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +34 -3
  33. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +24 -0
  34. package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +10 -0
  35. package/engine/graphics/micron/prototypeVirtualGeometry.js +5 -3
  36. package/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -6
  37. package/engine/graphics/render/forward_plus/LightManager.js +8 -6
  38. package/engine/graphics/render/forward_plus/data/channelCountToThreIntegerTextureType.js +3 -3
  39. package/engine/graphics/texture/channelCountToThreeTextureFormat.js +2 -2
  40. package/engine/ui/DraggableAspect.js +4 -1
  41. package/package.json +1 -1
@@ -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
 
@@ -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
 
@@ -9,7 +9,7 @@ import {
9
9
  LinearMipMapLinearFilter,
10
10
  NearestFilter,
11
11
  RGBAFormat,
12
- RGBAIntegerFormat,
12
+ RGBIntegerFormat,
13
13
  UnsignedByteType,
14
14
  UnsignedShortType
15
15
  } from "three";
@@ -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";
@@ -158,8 +160,8 @@ export class LightManager {
158
160
  this.__cluster_texture.minFilter = NearestFilter;
159
161
 
160
162
  this.__cluster_texture.type = UnsignedShortType;
161
- this.__cluster_texture.format = RGBAIntegerFormat;
162
- this.__cluster_texture.internalFormat = "RGBA16UI";
163
+ this.__cluster_texture.format = RGBIntegerFormat;
164
+ this.__cluster_texture.internalFormat = "RGB16UI";
163
165
 
164
166
  /**
165
167
  *
@@ -347,7 +349,7 @@ export class LightManager {
347
349
 
348
350
  const texture = this.__cluster_texture;
349
351
 
350
- const channelCount = 4;
352
+ const channelCount = 3;
351
353
 
352
354
  texture.dispose();
353
355
 
@@ -826,7 +828,7 @@ export class LightManager {
826
828
 
827
829
  const tile_index = slice_offset + (i_y_0 * tr_x) + i_x_0;
828
830
 
829
- const tile_address = tile_index * 4;
831
+ const tile_address = tile_index * 3;
830
832
 
831
833
 
832
834
  // construct tile data
@@ -1,4 +1,4 @@
1
- import { RedIntegerFormat, RGBAIntegerFormat, RGIntegerFormat } from "three";
1
+ import { RedIntegerFormat, RGBAIntegerFormat, RGBIntegerFormat, RGIntegerFormat } from "three";
2
2
 
3
3
  export function channelCountToThreIntegerTextureType(channel_count) {
4
4
  switch (channel_count) {
@@ -6,10 +6,10 @@ export function channelCountToThreIntegerTextureType(channel_count) {
6
6
  return RedIntegerFormat;
7
7
  case 2:
8
8
  return RGIntegerFormat;
9
+ case 3:
10
+ return RGBIntegerFormat;
9
11
  case 4:
10
12
  return RGBAIntegerFormat;
11
- case 3:
12
- // see https://github.com/mrdoob/three.js/pull/23228
13
13
  default:
14
14
  throw new Error(`Unsupported channel count '${channel_count}'`);
15
15
  }
@@ -1,4 +1,4 @@
1
- import { RedFormat, RGBAFormat, RGFormat } from "three";
1
+ import { RedFormat, RGBAFormat, RGBFormat, RGFormat } from "three";
2
2
 
3
3
  /**
4
4
  *
@@ -12,7 +12,7 @@ export function channelCountToThreeTextureFormat(count) {
12
12
  case 2:
13
13
  return RGFormat;
14
14
  case 3:
15
- // see https://github.com/mrdoob/three.js/pull/23228
15
+ return RGBFormat;
16
16
  case 4:
17
17
  return RGBAFormat;
18
18
  default:
@@ -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);
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.36.0",
8
+ "version": "2.36.4",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",