@woosh/meep-engine 2.34.43 → 2.34.47

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/bvh2/BinaryNode.js +62 -32
  2. package/core/bvh2/LeafNode.js +2 -1
  3. package/core/bvh2/aabb3/AABB3.js +879 -1059
  4. package/core/bvh2/aabb3/AABB3.spec.js +5 -7
  5. package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +2 -2
  6. package/core/bvh2/aabb3/aabb3_box_surface_area_2.js +10 -0
  7. package/core/bvh2/aabb3/aabb3_compute_half_surface_area.js +16 -0
  8. package/core/bvh2/aabb3/aabb3_compute_surface_area.js +18 -0
  9. package/core/bvh2/aabb3/aabb3_expand_array.js +15 -0
  10. package/core/bvh2/aabb3/aabb3_intersect_aabb3.js +28 -0
  11. package/core/bvh2/aabb3/aabb3_intersect_ray_slab.js +73 -0
  12. package/core/bvh2/aabb3/{aabb3_intersects_frustum.js → aabb3_intersects_frustum_array.js} +16 -1
  13. package/core/bvh2/aabb3/aabb3_intersects_line_segment.js +79 -0
  14. package/core/bvh2/aabb3/aabb3_intersects_ray.js +92 -0
  15. package/core/bvh2/aabb3/{AABB3Math.spec.js → aabb3_intersects_ray.spec.js} +3 -3
  16. package/core/bvh2/aabb3/aabb3_intersects_ray_fast.js +176 -0
  17. package/core/bvh2/aabb3/aabb3_score_boxes_SAH.js +43 -0
  18. package/core/bvh2/aabb3/aabb_score_boxes_SAH_delta.js +37 -0
  19. package/core/bvh2/aabb3/deserializeAABB3.js +17 -0
  20. package/core/bvh2/aabb3/deserializeAABB3Encoded_v0.js +73 -0
  21. package/core/bvh2/aabb3/deserializeAABB3Quantized16Uint.js +36 -0
  22. package/core/bvh2/aabb3/serializeAABB3.js +13 -0
  23. package/core/bvh2/aabb3/serializeAABB3Quantized16Uint.js +33 -0
  24. package/core/bvh2/binary/2/BinaryUint32BVH.js +3 -3
  25. package/core/bvh2/binary/BinaryBVH.js +2 -2
  26. package/core/bvh2/binary/RayLeafIntersectionVisitor.js +2 -2
  27. package/core/bvh2/serialization/deserializeBinaryNode.js +1 -1
  28. package/core/bvh2/serialization/deserializeBinaryNodeFromBinaryBuffer.js +2 -1
  29. package/core/bvh2/serialization/serializeBinaryNode.js +1 -1
  30. package/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +2 -1
  31. package/core/bvh2/transform/BottomUpOptimizingRebuilder.js +6 -5
  32. package/core/bvh2/transform/tryRotateSingleNode.js +2 -1
  33. package/core/bvh2/traversal/bvh_traverse_pre_order_using_stack.js +43 -0
  34. package/core/bvh2/visual/convert_bvh_to_dot_format_string.js +50 -0
  35. package/core/geom/3d/frustum/{array_setFromProjectionMatrix.js → frustum_from_projection_matrix_array.js} +1 -1
  36. package/core/geom/3d/topology/TopoMesh.js +0 -8
  37. package/core/geom/3d/topology/TopoVertex.js +7 -6
  38. package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +93 -5
  39. package/core/geom/3d/topology/simplify/quadratic/build_vertex_quadratics.js +7 -4
  40. package/core/geom/3d/topology/simplify/quadratic/compute_edge_collapse_cost_quadratic.js +7 -1
  41. package/core/geom/3d/topology/simplify/simplifyTopoMesh.js +1 -14
  42. package/core/graph/convertGraphToDotString.js +4 -4
  43. package/core/graph/v2/Graph.js +4 -0
  44. package/core/math/fabsf.js +8 -0
  45. package/engine/development/performance/MetricCollection.js +6 -0
  46. package/engine/ecs/foliage/ecs/Foliage2System.js +7 -2
  47. package/engine/graphics/compute_geometry_polycount.js +21 -0
  48. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +2 -2
  49. package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +66 -9
  50. package/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +2 -2
  51. package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +4 -0
  52. package/engine/graphics/micron/build/hierarchy/merge_patches.js +1 -1
  53. package/engine/graphics/micron/convert_three_object_to_micron.js +2 -0
  54. package/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +3 -2
  55. package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +176 -0
  56. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +1 -135
  57. package/engine/graphics/micron/prototypeVirtualGeometry.js +12 -7
  58. package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
  59. package/engine/graphics/micron/render/VirtualGeometryBuilder.js +16 -43
  60. package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +5 -1
  61. package/engine/graphics/micron/render/refinement/ActivePatchList.js +4 -10
  62. package/engine/graphics/micron/render/refinement/RefinementSpec.js +16 -20
  63. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +316 -11
  64. package/engine/graphics/render/layers/RenderLayer.js +22 -14
  65. package/engine/graphics/render/visibility/IncrementalDeltaSet.js +18 -5
  66. package/engine/graphics/render/visibility/VisibilityComputer.js +11 -15
  67. package/package.json +1 -1
  68. package/core/bvh2/aabb3/AABB3Math.js +0 -579
@@ -188,8 +188,8 @@ heatmap_lut_pink_to_blue.write([
188
188
  ]);
189
189
  heatmap_lut_pink_to_blue.computeUniformPositions();
190
190
 
191
- const heatmap_lut_3 = new ParameterLookupTable(4);
192
- heatmap_lut_3.write(
191
+ const heatmap_lut_discrete = new ParameterLookupTable(4);
192
+ heatmap_lut_discrete.write(
193
193
  [
194
194
  196, 196, 196, 255,
195
195
  196, 196, 196, 255,
@@ -360,7 +360,7 @@ async function sample_scene_0(engine) {
360
360
  // large open room, dense particles
361
361
  await make_demo_volume({
362
362
  ecd: ecd,
363
- lut: heatmap_lut_3,
363
+ lut: heatmap_lut_discrete,
364
364
  shape: UnionShape3D.from([
365
365
  TransformedShape3D.from_m4(new UnitCubeShape3D(), [20.977896627021547, 0, 0, 0, 0, 2.956899734575006, 0, 0, 0, 0, 36.201589869571954, 0, 99.2120028317975, 1.5919924971428276, 49.21655402009093, 1]),
366
366
  TransformedShape3D.from_m4(new UnitCubeShape3D(), [24.455615450514458, 0, 0, 0, 0, 2.956899734575006, 0, 0, 0, 0, 28.081536987027807, 0, 80.11618755300161, 1.5919924971428276, 45.13808745329574, 1]),
@@ -534,7 +534,7 @@ async function sample_scene_nam(engine) {
534
534
 
535
535
  await make_demo_volume({
536
536
  ecd: ecd,
537
- lut: heatmap_lut_3,
537
+ lut: heatmap_lut_discrete,
538
538
  shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.260857135913424, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 24.82865688356064, 1.4169994923726943, 2.4066558057134095, 1]),
539
539
  particle_size: P_SIZE_SMALL,
540
540
  density: 3,
@@ -545,7 +545,7 @@ async function sample_scene_nam(engine) {
545
545
 
546
546
  await make_demo_volume({
547
547
  ecd: ecd,
548
- lut: heatmap_lut_3,
548
+ lut: heatmap_lut_discrete,
549
549
  shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.870266350649175, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 20.022408905267525, 1.4169994923726943, 2.4066558057134095, 1]),
550
550
  particle_size: P_SIZE_SMALL,
551
551
  density: 3,
@@ -585,6 +585,309 @@ async function sample_scene_nam(engine) {
585
585
  // }));
586
586
  }
587
587
 
588
+ /**
589
+ *
590
+ * @param {Engine} engine
591
+ * @returns {Promise<void>}
592
+ */
593
+ async function sample_scene_moicon_0(engine) {
594
+ const ecd = engine.entityManager.dataset;
595
+
596
+ ecd.getAnyComponent(TopDownCameraController).component.fromJSON({
597
+ "target": {
598
+ "x": 21.09522080045099,
599
+ "y": -0.6327784109623013,
600
+ "z": 6.138907038731565
601
+ },
602
+ "pitch": 1.1099999999999923,
603
+ "yaw": -3.143185307179591,
604
+ "roll": 0,
605
+ "distance": 29,
606
+ "distanceMin": 0,
607
+ "distanceMax": 1000
608
+ });
609
+
610
+ load_model('moicon/10_Feb_22_Demo/1/model.gltf', ecd);
611
+ load_model('moicon/10_Feb_22_Demo/2/model.gltf', ecd);
612
+ // load_model('moicon/10_Feb_22_Demo/3/model.gltf', ecd); // volume markers - main floor
613
+ // load_model('moicon/10_Feb_22_Demo/4/model.gltf', ecd); // volume markers - small corner room
614
+ load_model('moicon/10_Feb_22_Demo/5/model.gltf', ecd);
615
+ // load_model('moicon/10_Feb_22_Demo/6/model.gltf', ecd); // roof
616
+ load_model('moicon/10_Feb_22_Demo/7/model.gltf', ecd);
617
+ load_model('moicon/10_Feb_22_Demo/assets/model.gltf', ecd);
618
+
619
+ const P_SIZE_SMALL = 0.15;
620
+ const P_SIZE_MEDIUM = 0.6;
621
+ const P_SIZE_LARGE = 2;
622
+
623
+ const random = seededRandom(42);
624
+
625
+ const PERIOD_LONG = 13;
626
+
627
+ // await make_demo_volume({
628
+ // ecd: ecd,
629
+ // lut: heatmap_lut_pink_to_blue,
630
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.267098043281134, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 2.8037239954452864, 1.4169994923726943, 11.460158766988037, 1]),
631
+ // particle_size: P_SIZE_MEDIUM,
632
+ // density: 3,
633
+ // period: PERIOD_LONG,
634
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
635
+ // sprite: 'data/textures/particle/UETools/Hexagon_01.png'
636
+ // });
637
+ // await make_demo_volume({
638
+ // ecd: ecd,
639
+ // lut: heatmap_lut_orange_to_red,
640
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.7577406314060395, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 8.075207307031247, 1.4169994923726943, 11.460158766988037, 1]),
641
+ // particle_size: P_SIZE_MEDIUM,
642
+ // density: 3,
643
+ // period: PERIOD_LONG,
644
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
645
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
646
+ // });
647
+ //
648
+ // await make_demo_volume({
649
+ // ecd: ecd,
650
+ // lut: heatmap_lut_pink_to_blue,
651
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [6.956797095914032, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 14.17733466985805, 1.4169994923726943, 11.460158766988037, 1]),
652
+ // particle_size: P_SIZE_MEDIUM,
653
+ // density: 3,
654
+ // period: PERIOD_LONG,
655
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
656
+ // sprite: 'data/textures/particle/travnik/plus_2.png'
657
+ // });
658
+ //
659
+ // await make_demo_volume({
660
+ // ecd: ecd,
661
+ // lut: heatmap_lut_pink_to_blue,
662
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.733772190018377, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 20.284613387782148, 1.4169994923726943, 11.460158766988037, 1]),
663
+ // particle_size: P_SIZE_MEDIUM,
664
+ // density: 3,
665
+ // period: PERIOD_LONG,
666
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
667
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
668
+ // });
669
+ //
670
+ // await make_demo_volume({
671
+ // ecd: ecd,
672
+ // lut: heatmap_lut_pink_to_blue,
673
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.924905976332568, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 31.662442543335885, 1.4169994923726943, 11.460158766988037, 1]),
674
+ // particle_size: P_SIZE_MEDIUM,
675
+ // density: 3,
676
+ // period: PERIOD_LONG,
677
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
678
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
679
+ // });
680
+ //
681
+ // await make_demo_volume({
682
+ // ecd: ecd,
683
+ // lut: heatmap_lut_0,
684
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.7305058801925, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 6.606365126660234, 0, 37.70942297505848, 1.4169994923726943, 11.460158766988037, 1]),
685
+ // particle_size: P_SIZE_MEDIUM,
686
+ // density: 8,
687
+ // period: PERIOD_LONG,
688
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
689
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
690
+ // });
691
+ // await make_demo_volume({
692
+ // ecd: ecd,
693
+ // lut: heatmap_lut_0,
694
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [6.575632395877399, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 37.272800538855826, 1.4169994923726943, 2.4066558057134095, 1]),
695
+ // particle_size: P_SIZE_MEDIUM,
696
+ // density: 8,
697
+ // period: PERIOD_LONG,
698
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
699
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
700
+ // });
701
+ //
702
+ // await make_demo_volume({
703
+ // ecd: ecd,
704
+ // lut: heatmap_lut_0,
705
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [6.410614101275306, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 30.458756650580582, 1.4169994923726943, 2.4066558057134095, 1]),
706
+ // particle_size: P_SIZE_MEDIUM,
707
+ // density: 8,
708
+ // period: PERIOD_LONG,
709
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
710
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
711
+ // });
712
+ //
713
+ // await make_demo_volume({
714
+ // ecd: ecd,
715
+ // lut: heatmap_lut_3,
716
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.260857135913424, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 24.82865688356064, 1.4169994923726943, 2.4066558057134095, 1]),
717
+ // particle_size: P_SIZE_SMALL,
718
+ // density: 3,
719
+ // period: PERIOD_LONG,
720
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
721
+ // sprite: 'data/textures/particle/UETools/Circle_01.png'
722
+ // });
723
+ //
724
+ // await make_demo_volume({
725
+ // ecd: ecd,
726
+ // lut: heatmap_lut_3,
727
+ // shape: TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.870266350649175, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 4.51714948412602, 0, 20.022408905267525, 1.4169994923726943, 2.4066558057134095, 1]),
728
+ // particle_size: P_SIZE_SMALL,
729
+ // density: 3,
730
+ // period: PERIOD_LONG,
731
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
732
+ // sprite: 'data/textures/particle/UETools/Cross_04.png'
733
+ // });
734
+ // await make_demo_volume({
735
+ // ecd: ecd,
736
+ // lut: heatmap_lut_pink_to_blue,
737
+ // shape: UnionShape3D.from([
738
+ // TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.985827128973811, 0, 0, 0, 0, 2.435269776236539, 0, 0, 0, 0, 4.669621139110231, 0, 11.08356834576874, 1.2643565739307023, 2.4360416869081885, 1]),
739
+ // TransformedShape3D.from_m4(new UnitCubeShape3D(), [8.413758403821523, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 7.775469675813772, 0, 4.313201108449287, 1.4169994923726943, 4.011630095541064, 1]),
740
+ // TransformedShape3D.from_m4(new UnitCubeShape3D(), [8.413758403821523, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 2.925065210015915, 0, 12.417224289491141, 1.4169994923726943, 6.432483110925785, 1])
741
+ // ]),
742
+ // particle_size: P_SIZE_LARGE,
743
+ // density: 4,
744
+ // period: PERIOD_LONG,
745
+ // period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
746
+ // sprite: 'data/textures/particle/UETools/Circle_04.png'
747
+ // });
748
+ await make_demo_volume({
749
+ ecd: ecd,
750
+ lut: heatmap_lut_pink_to_blue,
751
+ shape: UnionShape3D.from([
752
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [24.84144698268643, 0, 0, 0, 0, 5, 0, 0, 0, 0, 10.014132199037626, 0, 17.535114352814745, 2.5767637841580786, 15.087856547232908, 1]),
753
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [3.119746486000208, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5.08916554361867, 0, 6.026351574317095, 2.5767637841580786, 17.554804169904074, 1])
754
+ ]),
755
+ particle_size: P_SIZE_LARGE,
756
+ density: 4,
757
+ period: PERIOD_LONG,
758
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
759
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
760
+ });
761
+
762
+ await make_demo_volume({
763
+ ecd: ecd,
764
+ lut: heatmap_lut_orange_to_red,
765
+ shape: UnionShape3D.from([
766
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.23148852648068, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 4.843722925544828, 0, 2.178004397277256, 1.4442400806689264, 17.49419453432575, 1])
767
+ ]),
768
+ particle_size: P_SIZE_MEDIUM,
769
+ density: 4,
770
+ period: PERIOD_LONG,
771
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
772
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
773
+ });
774
+ await make_demo_volume({
775
+ ecd: ecd,
776
+ lut: heatmap_lut_pink_to_blue,
777
+ shape: UnionShape3D.from([
778
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.23148852648068, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 4.843722925544828, 0, -2.3684201443478874, 1.4819864080894103, 17.435101092023466, 1])
779
+ ]),
780
+ particle_size: P_SIZE_LARGE,
781
+ density: 4,
782
+ period: PERIOD_LONG,
783
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
784
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
785
+ });
786
+ await make_demo_volume({
787
+ ecd: ecd,
788
+ lut: heatmap_lut_orange_to_red,
789
+ shape: UnionShape3D.from([
790
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.827875822302671, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 7.195620725226215, 0, -7.134776782683499, 1.4819864080894103, 16.41960212963852, 1])
791
+ ]),
792
+ particle_size: P_SIZE_MEDIUM,
793
+ density: 4,
794
+ period: PERIOD_LONG,
795
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
796
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
797
+ });
798
+ await make_demo_volume({
799
+ ecd: ecd,
800
+ lut: heatmap_lut_pink_to_blue,
801
+ shape: UnionShape3D.from([
802
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.827875822302671, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 7.142815034586885, 0, -12.122694984141244, 1.4819864080894103, 16.39260186069935, 1]),
803
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [2.0910380492069933, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 5.042906378175556, 0, -13.835348677127275, 1.4819864080894103, 17.348732325334534, 1])
804
+ ]),
805
+ particle_size: P_SIZE_LARGE,
806
+ density: 4,
807
+ period: PERIOD_LONG,
808
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
809
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
810
+ });
811
+ await make_demo_volume({
812
+ ecd: ecd,
813
+ lut: heatmap_lut_orange_to_red,
814
+ shape: UnionShape3D.from([
815
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.630054702949254, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 5.132455640292213, 0, -17.444335306984925, 1.4819864080894103, 17.416555162219638, 1])
816
+ ]),
817
+ particle_size: P_SIZE_MEDIUM,
818
+ density: 4,
819
+ period: PERIOD_LONG,
820
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
821
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
822
+ });
823
+ await make_demo_volume({
824
+ ecd: ecd,
825
+ lut: heatmap_lut_pink_to_blue,
826
+ shape: UnionShape3D.from([
827
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [3.9334060066229277, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 4.909748196656206, 0, -2.993297445749089, 1.4819864080894103, -6.9614900068054615, 1])
828
+ ]),
829
+ particle_size: P_SIZE_LARGE,
830
+ density: 4,
831
+ period: PERIOD_LONG,
832
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
833
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
834
+ });
835
+ await make_demo_volume({
836
+ ecd: ecd,
837
+ lut: heatmap_lut_orange_to_red,
838
+ shape: UnionShape3D.from([
839
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.693637284485993, 0, 0, 0, 0, 2.8688316144733066, 0, 0, 0, 0, 9.774881301181045, 0, -26.90124286380605, 4.656150234283974, 14.984350120152822, 1])
840
+ ]),
841
+ particle_size: P_SIZE_MEDIUM,
842
+ density: 4,
843
+ period: PERIOD_LONG,
844
+ period_offset: randomFloatBetween(random, 0, PERIOD_LONG),
845
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
846
+ });
847
+
848
+ await make_demo_volume({
849
+ ecd: ecd,
850
+ lut: heatmap_lut_discrete,
851
+ shape: UnionShape3D.from([
852
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [6.331512511030024, 0, 0, 0, 0, 2.329600948715924, 0, 0, 0, 0, 9.610682816430089, 0, -21.021354476323573, 1.3409243433436, -1.345765978128314, 1])]),
853
+ particle_size: P_SIZE_SMALL,
854
+ density: 4,
855
+ period: PERIOD_LONG,
856
+ period_offset: 0,
857
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
858
+ });
859
+ await make_demo_volume({
860
+ ecd: ecd,
861
+ lut: heatmap_lut_discrete,
862
+ shape: UnionShape3D.from([
863
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [13.623136537846888, 0, 0, 0, 0, 2.193382560214131, 0, 0, 0, 0, 4.880453458023407, 0, 8.339521865997591, 1.1217848106509791, -1.5586407794900627, 1]),
864
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.162666210784313, 0, 0, 0, 0, 1.7455477622575266, 0, 0, 0, 0, 4.880453458023407, 0, 2.0126515547811556, 0.9110827940157051, -1.5586407794900627, 1]),
865
+ TransformedShape3D.from_m4(new UnitCubeShape3D(), [4.162666210784313, 0, 0, 0, 0, 1.1232395183163202, 0, 0, 0, 0, 3.565672994277359, 0, 2.0440383546262932, 1.8620329637166853, -2.1963940023653703, 1])
866
+ ]),
867
+ particle_size: P_SIZE_SMALL,
868
+ density: 4,
869
+ period: PERIOD_LONG,
870
+ period_offset: PERIOD_LONG * 0.5,
871
+ sprite: 'data/textures/particle/UETools/Circle_04.png'
872
+ });
873
+
874
+ make_shape_vis_toggle(engine).toggle(); // turn off shape vis initially
875
+
876
+ // editing box
877
+ // make_box_editor(engine, Transform.fromJSON({
878
+ // position: {
879
+ // x: -2,
880
+ // y: 0,
881
+ // z: 0
882
+ // },
883
+ // scale: {
884
+ // x: 5,
885
+ // y: 5,
886
+ // z: 5
887
+ // }
888
+ // }));
889
+ }
890
+
588
891
  /**
589
892
  *
590
893
  * @param {Engine} engine
@@ -608,8 +911,9 @@ async function main(engine) {
608
911
 
609
912
  engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
610
913
 
611
- await sample_scene_nam(engine);
914
+ // await sample_scene_nam(engine);
612
915
  // await sample_scene_0(engine);
916
+ await sample_scene_moicon_0(engine);
613
917
  }
614
918
 
615
919
  /**
@@ -788,7 +1092,7 @@ function make_symbol_view({
788
1092
  };
789
1093
 
790
1094
  const symbol_view = new EmptyView();
791
- symbol_view.size.set(128, 20);
1095
+ symbol_view.size.set(64, 20);
792
1096
 
793
1097
  symbol_view.css({
794
1098
  position: 'absolute',
@@ -798,7 +1102,7 @@ function make_symbol_view({
798
1102
  });
799
1103
 
800
1104
  const view_lut = new CanvasView();
801
- view_lut.size.set(128, 10);
1105
+ view_lut.size.set(64, 4);
802
1106
  view_lut.css({
803
1107
  position: 'absolute',
804
1108
  border: '1px solid white',
@@ -817,10 +1121,11 @@ function make_symbol_view({
817
1121
 
818
1122
  view_cursor.css({
819
1123
  position: 'absolute',
820
- left: 0,
821
- top: "-1px",
1124
+ left: "-6px",
1125
+ top: "-4px",
822
1126
  height: "10px",
823
- width: "4px",
1127
+ width: "10px",
1128
+ borderRadius: "10px",
824
1129
  border: '2px solid white',
825
1130
  zIndex: 2,
826
1131
  boxShadow: '0 0 4px black'
@@ -55,6 +55,7 @@ export class RenderLayer {
55
55
  this.extractRenderable = passThrough;
56
56
 
57
57
  /**
58
+ * @deprecated use CameraView's visible set instead
58
59
  * Contains visible elements across all views, if element is in at least one view - it will be here
59
60
  * @type {IncrementalDeltaSet<THREE.Object3D>}
60
61
  */
@@ -112,35 +113,42 @@ export class RenderLayer {
112
113
 
113
114
  /**
114
115
  *
116
+ * @param {THREE.Object3D[]} destination
117
+ * @param {number} destination_offset
115
118
  * @param {CameraView} view
116
- * @param {function(THREE.Object3D)} callback
117
- * @param {*} [callbackContext]
119
+ * @returns {number} Number of records added to destination
118
120
  */
119
- buildVisibleSet(view, callback, callbackContext) {
121
+ buildVisibleSet(destination, destination_offset, view) {
120
122
  const frustum = view.frustum;
121
123
 
122
124
  const reader = this.extractRenderable;
123
125
 
126
+ if (typeof reader !== "function") {
127
+ // no reader method
128
+ return 0;
129
+ }
124
130
 
125
- if (typeof reader === "function") {
126
-
127
- const hits = queryBinaryNode_FrustumIntersections_Data(scratch_array, 0, this.bvh, frustum);
131
+ const intersection_count = queryBinaryNode_FrustumIntersections_Data(scratch_array, 0, this.bvh, frustum);
128
132
 
129
- for (let i = 0; i < hits; i++) {
130
- const datum = scratch_array[i];
133
+ let additions = 0;
134
+ let i = 0;
131
135
 
132
- const object3D = reader(datum);
136
+ for (; i < intersection_count; i++) {
137
+ const datum = scratch_array[i];
133
138
 
134
- if (!object3D) {
135
- // null or undefined
136
- continue;
137
- }
139
+ const object3D = reader(datum);
138
140
 
139
- callback.call(callbackContext, object3D);
141
+ if (!object3D) {
142
+ // null or undefined
143
+ continue;
140
144
  }
141
145
 
146
+ destination[additions + destination_offset] = object3D;
147
+
148
+ additions++;
142
149
  }
143
150
 
151
+ return additions;
144
152
  }
145
153
  }
146
154
 
@@ -251,26 +251,31 @@ export class IncrementalDeltaSet {
251
251
  * @param {V} element
252
252
  */
253
253
  push(element) {
254
+ const elements = this.__elements;
255
+
254
256
  //check if element is already in the set
255
- const index = this.__indexExpected(element);
257
+ const existing_size = this.size;
258
+ const index = binarySearchHighIndex(elements, element, this.__compare, 0, existing_size - 1);
256
259
 
257
- const elements = this.__elements;
260
+
261
+ const flags = this.flags;
258
262
 
259
263
  if (elements[index] !== element) {
260
264
  // element is not in the set
261
265
 
262
266
  // shift flags to make space for it
263
- this.flags.shift(1, index, this.size);
267
+ flags.shift(1, index, existing_size);
264
268
 
265
269
  // insert
266
270
  elements.splice(index, 0, element);
267
- this.size++;
271
+
272
+ this.size = existing_size + 1;
268
273
 
269
274
  this.onAdded.send1(element);
270
275
  }
271
276
 
272
277
  // clear flag for inserted element
273
- this.flags.clear(index);
278
+ flags.clear(index);
274
279
 
275
280
  }
276
281
 
@@ -281,6 +286,7 @@ export class IncrementalDeltaSet {
281
286
  pushOther(other) {
282
287
  const elements = other.__elements;
283
288
  const n = other.size;
289
+
284
290
  for (let i = 0; i < n; i++) {
285
291
  const el = elements[i];
286
292
 
@@ -288,3 +294,10 @@ export class IncrementalDeltaSet {
288
294
  }
289
295
  }
290
296
  }
297
+
298
+
299
+ /**
300
+ * @readonly
301
+ * @type {boolean}
302
+ */
303
+ IncrementalDeltaSet.prototype.isIncrementalDeltaSet = true;
@@ -1,4 +1,4 @@
1
- import { assert } from "../../../../core/assert.js";
1
+ const scratch_array = [];
2
2
 
3
3
  export class VisibilityComputer {
4
4
  constructor() {
@@ -67,19 +67,6 @@ export class VisibilityComputer {
67
67
  this.__view = view;
68
68
  }
69
69
 
70
- /**
71
- * @private
72
- * @param {Object3D} object3d
73
- */
74
- __includeObject(object3d) {
75
- assert.equal(object3d.isObject3D, true, 'object3d.isObject3D !== true');
76
-
77
- //object passed all filters, add it to visible set
78
- this.__output.push(object3d);
79
-
80
- this.__activeLayer.visibleSet.push(object3d);
81
- }
82
-
83
70
  /**
84
71
  * @private
85
72
  * @param {RenderLayer} layer
@@ -101,7 +88,16 @@ export class VisibilityComputer {
101
88
  return;
102
89
  }
103
90
 
104
- layer.buildVisibleSet(this.__view, this.__includeObject, this);
91
+ const added_objects = layer.buildVisibleSet(scratch_array, 0, this.__view);
92
+
93
+ for (let i = 0; i < added_objects; i++) {
94
+ const object3d = scratch_array[i];
95
+
96
+ //object passed all filters, add it to visible set
97
+ this.__output.push(object3d);
98
+
99
+ this.__activeLayer.visibleSet.push(object3d);
100
+ }
105
101
  }
106
102
 
107
103
 
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.34.43",
8
+ "version": "2.34.47",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",