@woosh/meep-engine 2.40.0 → 2.41.0

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/binary/BinaryBuffer.js +6 -1
  2. package/core/collection/HashMap.d.ts +2 -0
  3. package/core/collection/HashMap.js +22 -0
  4. package/core/geom/3d/normal/hemioct/encode_unit3_hemioct.js +5 -0
  5. package/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +31 -0
  6. package/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +33 -0
  7. package/core/geom/3d/normal/octahedron/encoding.spec.js +29 -0
  8. package/core/geom/3d/topology/struct/BinaryTopology.js +112 -0
  9. package/core/geom/Quaternion.js +8 -8
  10. package/core/geom/Quaternion.spec.js +13 -0
  11. package/core/geom/Vector1.d.ts +2 -0
  12. package/core/math/sign_not_zero.js +8 -0
  13. package/core/parser/simple/SimpleParser.js +3 -86
  14. package/core/parser/simple/readUnsignedInteger.js +66 -0
  15. package/core/parser/simple/skipWhitespace.js +21 -0
  16. package/editor/view/ecs/components/common/NumberController.js +24 -6
  17. package/engine/EngineHarness.js +6 -1
  18. package/engine/asset/AssetDescription.spec.js +27 -0
  19. package/engine/asset/loaders/GLTFAssetLoader.js +5 -3
  20. package/engine/asset/loaders/image/png/PNG.js +6 -0
  21. package/engine/asset/loaders/image/png/PNGReader.js +41 -0
  22. package/engine/ecs/foliage/ImpostorFoliage.js +4 -0
  23. package/engine/ecs/terrain/tiles/TerrainTile.js +2 -0
  24. package/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +22 -7
  25. package/engine/graphics/filter/ImageFilter.js +2 -1
  26. package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +7 -1
  27. package/engine/{asset/loaders/geometry/geometry → graphics/geometry/buffered}/computeBufferAttributeHash.js +1 -1
  28. package/engine/{asset/loaders/geometry/geometry → graphics/geometry/buffered}/computeGeometryEquality.js +2 -2
  29. package/engine/{asset/loaders/geometry/geometry → graphics/geometry/buffered}/computeGeometryHash.js +1 -1
  30. package/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +2 -2
  31. package/engine/graphics/impostors/card_cluster/FacePlaneAssignment.js +30 -0
  32. package/engine/graphics/impostors/card_cluster/README.md +13 -0
  33. package/engine/graphics/impostors/octahedral/ImpostorBaker.js +332 -0
  34. package/engine/graphics/impostors/octahedral/ImpostorCaptureType.js +10 -0
  35. package/engine/graphics/impostors/octahedral/ImpostorDescription.js +63 -0
  36. package/engine/graphics/impostors/octahedral/README.md +29 -0
  37. package/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere.js +42 -0
  38. package/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +88 -0
  39. package/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +20 -0
  40. package/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +25 -0
  41. package/engine/graphics/impostors/octahedral/grid/UvEncoder.js +21 -0
  42. package/engine/graphics/impostors/octahedral/prototypeBaker.js +138 -0
  43. package/engine/graphics/impostors/octahedral/shader/BakeShaderStandard.js +157 -0
  44. package/engine/graphics/impostors/octahedral/shader/ImpostorShaderStandard.js +306 -0
  45. package/engine/graphics/impostors/octahedral/shader/glsl/common.glsl +206 -0
  46. package/engine/graphics/micron/convert_three_object_to_micron.js +2 -2
  47. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +2 -2
  48. package/engine/graphics/particles/node-based/codegen/CodeGenerator.js +1 -1
  49. package/engine/graphics/particles/node-based/nodes/noise/CurlNoiseNode.js +1 -1
  50. package/engine/graphics/render/forward_plus/LightManager.js +25 -0
  51. package/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +6 -2
  52. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +6 -11
  53. package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +268 -2
  54. package/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +32 -10
  55. package/engine/graphics/shaders/ScreenSpaceQuadShader.js +4 -14
  56. package/engine/graphics/shaders/glsl_gen_swizzled_read.js +39 -0
  57. package/engine/graphics/texture/atlas/AtlasPatch.js +12 -6
  58. package/engine/logging/ConsoleLoggerBackend.js +15 -0
  59. package/engine/logging/Logger.js +24 -1
  60. package/engine/logging/LoggerBackend.js +1 -0
  61. package/engine/physics/fluid/FluidField.js +9 -0
  62. package/engine/physics/fluid/effector/AbstractFluidEffector.js +6 -0
  63. package/engine/physics/fluid/effector/GlobalFluidEffector.js +12 -0
  64. package/engine/physics/fluid/effector/WakeFluidEffector.js +8 -0
  65. package/engine/ui/GUIEngine.js +8 -1
  66. package/package.json +1 -1
  67. package/view/tooltip/gml/parser/readReferenceToken.js +1 -1
  68. package/engine/asset/GameAssetManager.js +0 -137
@@ -65,6 +65,7 @@ import { StaticKnowledgeDatabase } from "../../../../knowledge/database/StaticKn
65
65
  import { Localization } from "../../../../../core/Localization.js";
66
66
  import '../../../../../../../../css/game.scss'
67
67
  import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
68
+ import { debugAtlas } from "../../../particles/particular/engine/shader/debugAtlas.js";
68
69
 
69
70
  document.body.style.margin = 0;
70
71
 
@@ -871,6 +872,270 @@ data/textures/icons/sci-fi-nathan/v6/Proc normal_2.png`
871
872
  camera.position.set(0, 0, 10);
872
873
  }
873
874
 
875
+ async function prepare_scene_decal_2() {
876
+
877
+ const am = new AssetManager(null);
878
+
879
+ await am.registerLoader("image", new ImageRGBADataLoader());
880
+
881
+
882
+ const decal_urls = `data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_13_t.png
883
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_01_t.png
884
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_02_t.png
885
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_03_t.png
886
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_04_t.png
887
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_05_t.png
888
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_06_t.png
889
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_07_t.png
890
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_08_t.png
891
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_09_t.png
892
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_10_t.png
893
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_11_t.png
894
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_12_t.png
895
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_13_t.png
896
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_14_t.png
897
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_01_t.png
898
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_02_t.png
899
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_03_t.png
900
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_04_t.png
901
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_05_t.png
902
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_06_t.png
903
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_07_t.png
904
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_08_t.png
905
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_09_t.png
906
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_10_b.png
907
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_11_t.png
908
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_12_t.png
909
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_01_t.png
910
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_02_t.png
911
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_03_t.png
912
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_04_t.png
913
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_05_t.png
914
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_06_t.png
915
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_07_t.png
916
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_08_t.png
917
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_09_t.png
918
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_10_t.png
919
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_11_t.png
920
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_12_t.png
921
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_13_t.png
922
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_14_t.png
923
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_15_t.png
924
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_16_t.png
925
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_17_t.png
926
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_01_t.png
927
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_02_t.png
928
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_03_t.png
929
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_04_t.png
930
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_05_t.png
931
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_06_t.png
932
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_07_t.png
933
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_08_t.png
934
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_09_t.png
935
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_10_t.png
936
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_11_t.png
937
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_12_t.png
938
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_01_t.png
939
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_02_t.png
940
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_03_t.png
941
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_04_t.png
942
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_05_t.png
943
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_06_t.png
944
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_07_t.png
945
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_08_t.png
946
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_09_t.png
947
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_10_t.png
948
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_11_t.png
949
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_12_t.png
950
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_01_t.png
951
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_02_t.png
952
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_03_t.png
953
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_04_t.png
954
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_05_t.png
955
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_06_t.png
956
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_07_t.png
957
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_08_t.png
958
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_09_t.png
959
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_10_t.png
960
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_11_t.png
961
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_12_t.png
962
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_01_t.png
963
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_02_t.png
964
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_03_t.png
965
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_04_t.png
966
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_05_t.png
967
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_06_t.png
968
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_07_t.png
969
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_08_t.png
970
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_09_t.png
971
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_10_t.png
972
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_11_t.png
973
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_12_t.png
974
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_13_t.png
975
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_01_t.png
976
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_02_t.png
977
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_03_t.png
978
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_04_t.png
979
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_05_t.png
980
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_06_t.png
981
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_07_t.png
982
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_08_t.png
983
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_09_t.png
984
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_10_t.png
985
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_11_t.png
986
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_12_t.png
987
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_3.png
988
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_1.png
989
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_2.png
990
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_3.png
991
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_1.png
992
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_2.png
993
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_3.png
994
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_1.png
995
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_2.png
996
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_3.png
997
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_1.png
998
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_2.png
999
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_3.png
1000
+ data/textures/icons/sci-fi-nathan/v6/Core normal_1.png
1001
+ data/textures/icons/sci-fi-nathan/v6/Core normal_2.png
1002
+ data/textures/icons/sci-fi-nathan/v6/Core normal_3.png
1003
+ data/textures/icons/sci-fi-nathan/v6/Core strong_1.png
1004
+ data/textures/icons/sci-fi-nathan/v6/Core strong_2.png
1005
+ data/textures/icons/sci-fi-nathan/v6/Core strong_3.png
1006
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_1.png
1007
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_2.png
1008
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_3.png
1009
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_1.png
1010
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_2.png
1011
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_3.png
1012
+ data/textures/icons/sci-fi-nathan/v6/Core weak_1.png
1013
+ data/textures/icons/sci-fi-nathan/v6/Core weak_2.png
1014
+ data/textures/icons/sci-fi-nathan/v6/Core weak_3.png
1015
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_1.png
1016
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_2.png
1017
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_3.png
1018
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_1.png
1019
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_2.png
1020
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_3.png
1021
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_1.png
1022
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_2.png
1023
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_3.png
1024
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_1.png
1025
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_2.png
1026
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_3.png
1027
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_1.png
1028
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_2.png
1029
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_3.png
1030
+ data/textures/icons/sci-fi-nathan/v6/Module normal_1.png
1031
+ data/textures/icons/sci-fi-nathan/v6/Module normal_2.png
1032
+ data/textures/icons/sci-fi-nathan/v6/Module normal_3.png
1033
+ data/textures/icons/sci-fi-nathan/v6/Module strong_1.png
1034
+ data/textures/icons/sci-fi-nathan/v6/Module strong_2.png
1035
+ data/textures/icons/sci-fi-nathan/v6/Module strong_3.png
1036
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_1.png
1037
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_2.png
1038
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_3.png
1039
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_1.png
1040
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_2.png
1041
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_3.png
1042
+ data/textures/icons/sci-fi-nathan/v6/Module weak_1.png
1043
+ data/textures/icons/sci-fi-nathan/v6/Module weak_2.png
1044
+ data/textures/icons/sci-fi-nathan/v6/Module weak_3.png
1045
+ data/textures/icons/sci-fi-nathan/v6/Power normal_1.png
1046
+ data/textures/icons/sci-fi-nathan/v6/Power normal_2.png
1047
+ data/textures/icons/sci-fi-nathan/v6/Power normal_3.png
1048
+ data/textures/icons/sci-fi-nathan/v6/Power strong_1.png
1049
+ data/textures/icons/sci-fi-nathan/v6/Power strong_2.png
1050
+ data/textures/icons/sci-fi-nathan/v6/Power strong_3.png
1051
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_1.png
1052
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_2.png
1053
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_3.png
1054
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_1.png
1055
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_2.png
1056
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_3.png
1057
+ data/textures/icons/sci-fi-nathan/v6/Power weak_1.png
1058
+ data/textures/icons/sci-fi-nathan/v6/Power weak_2.png
1059
+ data/textures/icons/sci-fi-nathan/v6/Power weak_3.png
1060
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_1.png
1061
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_2.png
1062
+ data/textures/utility/sampling-test.png`
1063
+ .split('\n')
1064
+ .map(a => a.trim());
1065
+
1066
+ const samplers = [];
1067
+ const promises = [];
1068
+
1069
+ for (let i = 0; i < decal_urls.length; i++) {
1070
+ const promise = am.promise(decal_urls[i], 'image');
1071
+ promises.push(promise);
1072
+ }
1073
+
1074
+ const assets = await Promise.all(promises);
1075
+
1076
+ for (let i = 0; i < assets.length; i++) {
1077
+ const asset = assets[i];
1078
+
1079
+ samplers[i] = asset.create();
1080
+ }
1081
+
1082
+ const canvas_size = 5;
1083
+
1084
+ const random = seededRandom();
1085
+
1086
+ const COUNT = 1024;
1087
+
1088
+ const ROW_WIDTH = Math.ceil(Math.sqrt(COUNT));
1089
+ const size = canvas_size / ROW_WIDTH;
1090
+
1091
+ for (let i = 0; i < COUNT; i++) {
1092
+
1093
+ const q = new Quaternion();
1094
+ // q.fromEulerAnglesXYZ(0, (90 + randomFloatBetween(random, -60, 60)) * DEG2RAD, 0);
1095
+ q.fromEulerAnglesXYZ(0, (-180) * DEG2RAD, 0);
1096
+
1097
+ const sampler = randomFromArray(random, samplers);
1098
+ // const sampler = samplers[i % samplers.length];
1099
+
1100
+ // const size = randomFloatBetween(random, 1, 3);
1101
+ //const size = 0.5;
1102
+
1103
+ // const position = [
1104
+ // randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), -4
1105
+ // ];
1106
+
1107
+ const x = ((i % ROW_WIDTH)) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
1108
+ const y = Math.floor(i / ROW_WIDTH) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
1109
+ const position = [
1110
+ x * canvas_size, y * canvas_size, -4
1111
+ ];
1112
+
1113
+ addDecal({
1114
+ position: position,
1115
+ scale: [
1116
+ size, size, 1.5
1117
+ ],
1118
+ rotation: q,
1119
+ sampler: sampler,
1120
+ scene,
1121
+ light_manager: lm
1122
+ });
1123
+
1124
+ }
1125
+
1126
+ addBox([0, 0, -4], [canvas_size, canvas_size, 1], [0, 0, 0]);
1127
+ //
1128
+ // addKnot([0, 0, -4], 2, [0, 0, 0])
1129
+
1130
+ scene.add(new AmbientLight(0xFFFFFF, 0.8));
1131
+
1132
+ camera.near = 1;
1133
+ camera.far = 30;
1134
+
1135
+ camera.lookAt(0, 0, -5);
1136
+ camera.position.set(0, 0, 10);
1137
+ }
1138
+
874
1139
 
875
1140
  async function prepare_scene_9() {
876
1141
 
@@ -1295,7 +1560,8 @@ function draw_camera_view_planes() {
1295
1560
 
1296
1561
  // prepare_scene_2();
1297
1562
  // prepare_scene_decal_0();
1298
- prepare_scene_decal_1();
1563
+ // prepare_scene_decal_1();
1564
+ prepare_scene_decal_2();
1299
1565
  // prepare_scene_9();
1300
1566
  // prepare_scene_2();
1301
1567
  // prepare_scene_0();
@@ -1353,7 +1619,7 @@ const debugger_button = new ButtonView({
1353
1619
  }
1354
1620
  });
1355
1621
 
1356
- // debugAtlas(lm.__decal_atlas.atlas, { scale: new Vector2(0.125, 0.125) });
1622
+ debugAtlas(lm.__decal_atlas.atlas, { scale: new Vector2(0.125, 0.125) });
1357
1623
 
1358
1624
  debugger_button.link();
1359
1625
 
@@ -11,6 +11,9 @@ import {
11
11
  } from "three";
12
12
  import CheckersTexture from "../../../texture/CheckersTexture.js";
13
13
  import { FULL_SCREEN_TRIANGLE_GEOMETRY } from "../../../geometry/FULL_SCREEN_TRIANGLE_GEOMETRY.js";
14
+ import { formatToChannelCount } from "../../../texture/formatToChannelCount.js";
15
+ import { glsl_gen_swizzled_read } from "../../../shaders/glsl_gen_swizzled_read.js";
16
+ import { assert } from "../../../../../core/assert.js";
14
17
 
15
18
 
16
19
  /**
@@ -44,8 +47,19 @@ function sampleTexel(texture, name, uv) {
44
47
  /**
45
48
  *
46
49
  * @param {THREE.Texture} texture
50
+ * @param {number} [alpha_override] will force specified alpha value in output, useful for cases where alpha would be 0 otherwise
51
+ * @param {(string|number)[]} swizzle allows us to re-arrange pixels as they are being written out
47
52
  */
48
- function makeShader(texture) {
53
+ function makeShader({ texture, alpha_override, swizzle }) {
54
+ let _swizzle = swizzle.slice();
55
+
56
+ const texture_channel_count = formatToChannelCount(texture.format);
57
+
58
+ if (texture_channel_count < 4) {
59
+ // no override specified, and alpha would be 0, force it to one to make image visible
60
+ _swizzle[4] = 1;
61
+ }
62
+
49
63
  return new ShaderMaterial({
50
64
 
51
65
  vertexShader: /* glsl */`
@@ -68,11 +82,7 @@ function makeShader(texture) {
68
82
  void main() {
69
83
 
70
84
  vec4 texel = ${sampleTexel(texture, 'tDiffuse', 'vUv')};
71
- gl_FragColor = texel;
72
-
73
- gl_FragColor.a = 1.0;
74
- // gl_FragColor.r *= 255.0;
75
-
85
+ gl_FragColor = ${glsl_gen_swizzled_read('texel', swizzle)};
76
86
  }`,
77
87
  uniforms: {
78
88
 
@@ -88,7 +98,8 @@ function makeShader(texture) {
88
98
  * @param {number} width
89
99
  * @param {THREE.Texture} texture
90
100
  * @param {THREE.WebGLRenderer} renderer
91
- * @param flipY
101
+ * @param {boolean} [flipY]
102
+ * @param {(string|number)[]} [swizzle]
92
103
  * @return {{view: View, render: function}}
93
104
  */
94
105
  export function buildCanvasViewFromTexture({
@@ -96,9 +107,18 @@ export function buildCanvasViewFromTexture({
96
107
  width = texture.image.width,
97
108
  height = texture.image.height,
98
109
  renderer,
99
- flipY = true
110
+ flipY = true,
111
+ swizzle = ['r', 'g', 'b', 'a']
100
112
  }) {
113
+
114
+ assert.isArray(swizzle, 'swizzle');
115
+
101
116
  const canvasView = new CanvasView();
117
+ canvasView.css({
118
+ position: 'absolute',
119
+ left: 0,
120
+ top: 0
121
+ });
102
122
  canvasView.size.set(width, height);
103
123
 
104
124
  const ctx = canvasView.context2d;
@@ -137,7 +157,7 @@ export function buildCanvasViewFromTexture({
137
157
  */
138
158
  function getShader() {
139
159
  if (__texture_cached !== texture || copyShader === null) {
140
- copyShader = makeShader(texture);
160
+ copyShader = makeShader({ texture: texture, swizzle });
141
161
 
142
162
  copyShader.side = DoubleSide;
143
163
  copyShader.uniforms.tDiffuse.value = texture;
@@ -154,6 +174,8 @@ export function buildCanvasViewFromTexture({
154
174
 
155
175
  getShader().uniforms.tDiffuse.value = texture;
156
176
 
177
+ const _rt = renderer.getRenderTarget();
178
+
157
179
  renderer.setRenderTarget(renderTarget);
158
180
 
159
181
  renderer.render(scene, camera);
@@ -163,7 +185,7 @@ export function buildCanvasViewFromTexture({
163
185
 
164
186
  ctx.putImageData(imageData, 0, 0)
165
187
 
166
- renderer.setRenderTarget(null);
188
+ renderer.setRenderTarget(_rt);
167
189
  };
168
190
 
169
191
  return {
@@ -1,3 +1,5 @@
1
+ import { glsl_gen_swizzled_read } from "./glsl_gen_swizzled_read.js";
2
+
1
3
  function vertexShader() {
2
4
  return `
3
5
  varying vec2 vUv;
@@ -11,25 +13,13 @@ function vertexShader() {
11
13
  `;
12
14
  }
13
15
 
16
+
14
17
  /**
15
18
  *
16
19
  * @param {string[]} [swizzle] what to read from the texture
17
20
  * @returns {string}
18
21
  */
19
22
  function fragmentShader(swizzle = ['r', 'g', 'b', 'a']) {
20
- const swizzle_read = [];
21
- const n = swizzle.length;
22
- for (let i = 0; i < n; i++) {
23
- const token = swizzle[i];
24
-
25
- if (typeof token === "string") {
26
- swizzle_read[i] = `texel.${token}`;
27
- } else if (typeof token === "number") {
28
- swizzle_read[i] = Number(token).toFixed(4);
29
- } else {
30
- throw new Error(`Unsupported swizzle token '${token}'`);
31
- }
32
- }
33
23
 
34
24
  return `
35
25
  uniform sampler2D tTexture;
@@ -37,7 +27,7 @@ function fragmentShader(swizzle = ['r', 'g', 'b', 'a']) {
37
27
 
38
28
  void main(){
39
29
  vec4 texel = texture2D( tTexture, vUv );
40
- gl_FragColor = vec4(${swizzle_read.join(',')});
30
+ gl_FragColor = ${glsl_gen_swizzled_read('texel', swizzle)};
41
31
  }
42
32
  `;
43
33
  }
@@ -0,0 +1,39 @@
1
+ /**
2
+ *
3
+ * @param {string} input name of the variable on which components are being accessed
4
+ * @param {(string|number)[]} swizzle
5
+ * @returns {string} swizzled vector
6
+ */
7
+ export function glsl_gen_swizzled_read(input, swizzle) {
8
+ const swizzle_read = [];
9
+ const n = swizzle.length;
10
+ for (let i = 0; i < n; i++) {
11
+ const token = swizzle[i];
12
+
13
+ if (typeof token === "string") {
14
+ swizzle_read[i] = `${input}.${token}`;
15
+ } else if (typeof token === "number") {
16
+ swizzle_read[i] = Number(token).toFixed(4);
17
+ } else {
18
+ throw new Error(`Unsupported swizzle token '${token}'`);
19
+ }
20
+ }
21
+
22
+ const arg_string = swizzle_read.join(', ');
23
+
24
+ const ctors = [
25
+ undefined,
26
+ 'float',
27
+ 'vec2',
28
+ 'vec3',
29
+ 'vec4'
30
+ ];
31
+
32
+ const ctor = ctors[swizzle.length];
33
+
34
+ if (ctor === undefined) {
35
+ throw new Error(`No constructor for input length ${swizzle.length}`);
36
+ }
37
+
38
+ return `${ctor}(${arg_string})`;
39
+ }
@@ -65,15 +65,21 @@ export class AtlasPatch {
65
65
  */
66
66
  updateUV(canvasWidth, canvasHeight) {
67
67
 
68
+ const position = this.position;
68
69
  const size = this.size;
70
+ const uv = this.uv;
69
71
 
70
- const position = this.position;
72
+ const x0 = position.x;
73
+ const y0 = position.y;
74
+
75
+ const sx = size.x;
76
+ const sy = size.y;
71
77
 
72
- this.uv.set(
73
- position.x / canvasWidth,
74
- position.y / canvasHeight,
75
- size.x / canvasWidth,
76
- size.y / canvasHeight
78
+ uv.set(
79
+ x0 / canvasWidth,
80
+ y0 / canvasHeight,
81
+ sx / canvasWidth,
82
+ sy / canvasHeight
77
83
  );
78
84
 
79
85
  }
@@ -1,6 +1,8 @@
1
1
  import { LoggerBackend } from "./LoggerBackend.js";
2
2
  import { LogLevel } from "./LogLevel.js";
3
3
 
4
+ let instance;
5
+
4
6
  export class ConsoleLoggerBackend extends LoggerBackend {
5
7
  log(level, message) {
6
8
  switch (level) {
@@ -19,4 +21,17 @@ export class ConsoleLoggerBackend extends LoggerBackend {
19
21
  console.log(message);
20
22
  }
21
23
  }
24
+
25
+ /**
26
+ * Singleton instance
27
+ * NOTE: you can still create additional instances if you find that useful
28
+ * @return {ConsoleLoggerBackend}
29
+ */
30
+ static get INSTANCE() {
31
+ if (instance === undefined) {
32
+ instance = new ConsoleLoggerBackend();
33
+ }
34
+
35
+ return instance;
36
+ }
22
37
  }
@@ -12,11 +12,34 @@ export class Logger {
12
12
  }
13
13
 
14
14
  /**
15
- *
15
+ * Add a logging backend, this is a structure that handles incoming log messages.
16
+ * There can be multiple backends registered at any given time or even none at all
16
17
  * @param {LoggerBackend} backend
18
+ * @returns {boolean} will return false if backend instance is already attached
17
19
  */
18
20
  addBackend(backend) {
21
+ if (this.backends.includes(backend)) {
22
+ // already registered
23
+ return false;
24
+ }
25
+
19
26
  this.backends.push(backend);
27
+ return true;
28
+ }
29
+
30
+ /**
31
+ * Remove backend instance, counterpart to {@link #addBackend} see {@link #addBackend} for more information
32
+ * @param {LoggerBackend} backend
33
+ * @return {boolean}
34
+ */
35
+ removeBackend(backend) {
36
+ const i = this.backends.indexOf(backend);
37
+ if (i === -1) {
38
+ return false;
39
+ } else {
40
+ this.backends.splice(i, 1);
41
+ return true;
42
+ }
20
43
  }
21
44
 
22
45
  /**
@@ -30,6 +30,7 @@ export class LoggerBackend {
30
30
  *
31
31
  * @param {LogLevel} level
32
32
  * @param {string} message
33
+ * @returns {void}
33
34
  */
34
35
  log(level, message) {
35
36
  throw new Error('Abstract class, method needs to be implemented in the subclass');
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Represents a space where fluid simulation happens
3
+ *
4
+ * @see 2019 GDC talk by Runard Rupert "Wind Simulation in God of War" https://www.youtube.com/watch?v=dDgyBKkSf7A
5
+ * @see Inspired by GDC talk "Interactive Wind and Vegetation in 'God of War'" - https://www.youtube.com/watch?v=MKX45_riWQA
6
+ */
7
+ export class FluidField{
8
+
9
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Base interface for injecting external forces into the simulation
3
+ */
4
+ export class AbstractFluidEffector {
5
+
6
+ }
@@ -0,0 +1,12 @@
1
+ import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
2
+
3
+ /**
4
+ * Affects fluid everywhere inside the field uniformly
5
+ */
6
+ export class GlobalFluidEffector extends AbstractFluidEffector{
7
+ /**
8
+ * 3d force vector
9
+ * @type {number[]}
10
+ */
11
+ force = [0, 0, 0];
12
+ }
@@ -0,0 +1,8 @@
1
+ import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
2
+
3
+ /**
4
+ * Creates force in its "wake" (behind it) as it travels
5
+ */
6
+ export class WakeFluidEffector extends AbstractFluidEffector {
7
+
8
+ }
@@ -103,7 +103,14 @@ function GUIEngine() {
103
103
  }
104
104
  });
105
105
 
106
- this.view = new EmptyView({ classList: ['gui-engine-root'] });
106
+ this.view = new EmptyView({
107
+ classList: ['gui-engine-root'],
108
+ css: {
109
+ position: "absolute",
110
+ left: "0",
111
+ top: "0"
112
+ }
113
+ });
107
114
 
108
115
  /**
109
116
  *
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.40.0",
8
+ "version": "2.41.0",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",