@woosh/meep-engine 2.39.40 → 2.39.41

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 (53) hide show
  1. package/core/binary/operations/ceilPowerOfTwo.spec.js +17 -0
  2. package/core/bvh2/binary/2/BinaryUint32BVH.js +7 -1
  3. package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +31 -1
  4. package/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.spec.js +2 -2
  5. package/core/collection/IteratorUtils.js +1 -0
  6. package/core/collection/queue/Deque.js +5 -2
  7. package/core/color/Color.js +22 -4
  8. package/core/color/hsluv/HSLuv.js +187 -0
  9. package/core/geom/3d/aabb/aabb3_matrix4_project.js +1 -0
  10. package/core/geom/3d/topology/simplify/simplifyTopoMesh2.js +1 -1
  11. package/core/primitives/strings/compareStrings.js +22 -0
  12. package/editor/Editor.js +2 -0
  13. package/editor/tools/v2/BlenderCameraOrientationGizmo.js +22 -11
  14. package/engine/EngineHarness.js +7 -0
  15. package/engine/asset/loaders/geometry/geometry/computeBufferAttributeHash.js +5 -6
  16. package/engine/asset/loaders/image/codec/Codec.js +9 -0
  17. package/engine/asset/loaders/image/codec/CodecWithFallback.js +52 -11
  18. package/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +12 -0
  19. package/engine/asset/loaders/image/png/PNGReader.js +2 -1
  20. package/engine/asset/loaders/image/png/PNG_HEADER_BYTES.js +1 -0
  21. package/engine/computeStridedIntegerArrayHash.js +19 -0
  22. package/engine/ecs/EntityBuilder.d.ts +2 -0
  23. package/engine/ecs/gui/GUIElement.d.ts +3 -1
  24. package/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +11 -2
  25. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +2 -8
  26. package/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +336 -0
  27. package/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +176 -0
  28. package/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +7 -3
  29. package/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -1
  30. package/engine/graphics/micron/prototypeVirtualGeometry.js +3 -3
  31. package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +32 -1
  32. package/engine/graphics/render/forward_plus/LightManager.js +58 -13
  33. package/engine/graphics/render/forward_plus/debug/createScreenGrid.js +192 -9
  34. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +42 -1
  35. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +1 -0
  36. package/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +5 -0
  37. package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +1 -4
  38. package/engine/graphics/render/forward_plus/model/Decal.js +33 -5
  39. package/engine/graphics/render/forward_plus/model/PointLight.js +1 -1
  40. package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +4 -0
  41. package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +480 -12
  42. package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +49 -29
  43. package/engine/graphics/texture/atlas/AbstractTextureAtlas.js +11 -0
  44. package/engine/graphics/texture/atlas/CachingTextureAtlas.js +34 -0
  45. package/engine/graphics/texture/atlas/ReferencedTextureAtlas.js +9 -1
  46. package/engine/graphics/texture/atlas/TextureAtlas.js +29 -16
  47. package/engine/graphics/texture/atlas/TextureAtlasDebugger.js +75 -19
  48. package/engine/graphics/texture/sampler/Sampler2D.d.ts +2 -0
  49. package/engine/graphics/texture/sampler/Sampler2D.js +49 -9
  50. package/engine/sound/ecs/SoundListenerSystem.js +5 -0
  51. package/engine/sound/ecs/emitter/SoundEmitter.js +12 -1
  52. package/package.json +1 -1
  53. package/view/tooltip/TooltipManager.js +0 -95
@@ -1,4 +1,6 @@
1
1
  import {
2
+ AmbientLight,
3
+ BoxBufferGeometry,
2
4
  Group,
3
5
  HemisphereLight,
4
6
  Line,
@@ -12,7 +14,7 @@ import {
12
14
  Scene,
13
15
  TorusKnotBufferGeometry,
14
16
  Vector2,
15
- WebGLRenderer
17
+ WebGLRenderer,
16
18
  } from "three";
17
19
  import { min2 } from "../../../../../core/math/min2.js";
18
20
  import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
@@ -48,6 +50,23 @@ import { mat4 } from "gl-matrix";
48
50
  import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
49
51
  import { makeHelperBoxGeometry } from "../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
50
52
  import { array_copy } from "../../../../../core/collection/array/copyArray.js";
53
+ import { BufferGeometry } from "three/src/core/BufferGeometry.js";
54
+ import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
55
+ import Quaternion from "../../../../../core/geom/Quaternion.js";
56
+ import { v2_distance } from "../../../../../core/geom/Vector2.js";
57
+ import { DEG2RAD, smoothstep } from "three/src/math/MathUtils.js";
58
+ import { AssetManager } from "../../../../asset/AssetManager.js";
59
+ import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
60
+ import { Color } from "../../../../../core/color/Color.js";
61
+ import { TooltipManager } from "../../../../../view/tooltip/TooltipManager.js";
62
+ import { GMLEngine } from "../../../../../view/tooltip/gml/GMLEngine.js";
63
+ import { PointerDevice } from "../../../../input/devices/PointerDevice.js";
64
+ import { StaticKnowledgeDatabase } from "../../../../knowledge/database/StaticKnowledgeDatabase.js";
65
+ import { Localization } from "../../../../../core/Localization.js";
66
+ import '../../../../../../../../css/game.scss'
67
+ import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
68
+
69
+ document.body.style.margin = 0;
51
70
 
52
71
  const on_render = new Signal();
53
72
 
@@ -140,6 +159,47 @@ function addKnot(position, scale, rotation) {
140
159
  group.scale.setScalar(scale);
141
160
 
142
161
 
162
+ const mesh = new Mesh(knot_geometry, debug_material);
163
+
164
+ mesh.layers.set(2);
165
+
166
+
167
+ const outline = new Mesh(knot_geometry, material_fp_standard);
168
+ outline.layers.set(3);
169
+
170
+ group.add(mesh);
171
+ group.add(outline);
172
+
173
+ group.matrixAutoUpdate = false;
174
+
175
+ threeUpdateTransform(group);
176
+
177
+ scene.add(group);
178
+ }
179
+
180
+ function addBox(position, scale, rotation) {
181
+
182
+ const group = new Group();
183
+
184
+ group.position.set(
185
+ position[0],
186
+ position[1],
187
+ position[2]
188
+ );
189
+
190
+ group.rotation.set(
191
+ rotation[0],
192
+ rotation[1],
193
+ rotation[1]
194
+ );
195
+
196
+ if (typeof scale === "number") {
197
+ group.scale.setScalar(scale);
198
+ } else {
199
+ group.scale.fromArray(scale);
200
+ }
201
+
202
+
143
203
  const mesh = new Mesh(box_geometry, debug_material);
144
204
 
145
205
  mesh.layers.set(2);
@@ -328,22 +388,45 @@ function addDecal({
328
388
  const decal = new Decal();
329
389
 
330
390
  mat4.fromRotationTranslationScale(decal.transform, rotation, position, scale);
391
+ mat4.invert(decal.transform_inverse, decal.transform);
392
+
331
393
  decal.texture_diffuse = sampler;
332
394
 
333
- const vis = new LineSegments(makeHelperBoxGeometry(), new LineBasicMaterial({ color: 0xFFFFFF }));
395
+ const vis = new Group();
396
+ vis.frustumCulled = false;
397
+
398
+ const tLine = new LineSegments(makeHelperBoxGeometry(), new LineBasicMaterial({
399
+ color: 0xFFFFFF,
400
+ transparent: true,
401
+ opacity: 0.4
402
+ }));
403
+
404
+ vis.add(tLine);
405
+
406
+
407
+ const _lineGeometry = new BufferGeometry();
408
+ _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0.3, 0, 0, 0.5], 3));
409
+
410
+ const tHelper = new Line(_lineGeometry, new LineBasicMaterial({ color: 0xFFFFFF, toneMapped: false }));
334
411
 
335
- vis.layers.set(1);
412
+ vis.add(tHelper);
336
413
 
337
- vis.matrixAutoUpdate = false;
338
- vis.matrixWorldNeedsUpdate = false;
339
- array_copy(decal.transform, 0, vis.matrixWorld.elements, 0, 16);
414
+ vis.traverse(o => {
415
+ o.layers.set(1);
416
+
417
+ o.matrixAutoUpdate = false;
418
+ o.matrixWorldNeedsUpdate = false;
419
+ array_copy(decal.transform, 0, o.matrixWorld.elements, 0, 16);
420
+
421
+ });
340
422
 
341
423
  scene.add(vis);
342
424
 
343
425
  light_manager.addLight(decal);
344
426
  }
345
427
 
346
- const box_geometry = new TorusKnotBufferGeometry(1, 0.3, 128, 128);
428
+ const knot_geometry = new TorusKnotBufferGeometry(1, 0.3, 128, 128);
429
+ const box_geometry = new BoxBufferGeometry(1, 1, 1);
347
430
  const debug_material = new FPlusDebugMaterial();
348
431
 
349
432
 
@@ -457,7 +540,50 @@ function prepare_scene_decal_0() {
457
540
  }
458
541
  );
459
542
 
460
- const sampler = new Sampler2D(new Uint8Array([255, 255, 255, 255]), 4, 1, 1);
543
+ addPointLight({
544
+ position: [
545
+ -1.5, 0, -4
546
+ ], radius: 1.5, color: 0xFFFFFF, intensity: 1
547
+ }
548
+ );
549
+
550
+
551
+ function make_radial_sampler(size = 16) {
552
+
553
+ const s = Sampler2D.uint8(4, size, size);
554
+
555
+ const size_2 = size * 0.5;
556
+ const size_2_inv = 1 / size_2;
557
+
558
+ const sample = [];
559
+ for (let y = 0; y < size; y++) {
560
+ for (let x = 0; x < size; x++) {
561
+ const distance = v2_distance(x, y, size_2 - 0.5, size_2 - 0.5) * size_2_inv;
562
+
563
+ sample[0] = Math.round((x / size) * 255);
564
+ sample[1] = Math.round((y / size) * 255);
565
+ sample[2] = 255;
566
+ sample[3] = Math.round((1 - smoothstep(distance, 0.5, 1)) * 255);
567
+
568
+ s.set(x, y, sample);
569
+ }
570
+ }
571
+
572
+ return s;
573
+ }
574
+
575
+ // const sampler = new Sampler2D(new Uint8Array([
576
+ // 255, 0, 0, 255,
577
+ // 0, 255, 0, 255,
578
+ // 0, 0, 255, 255,
579
+ // 255, 255, 255, 255,
580
+ // ]), 4, 2, 2);
581
+
582
+ const sampler = make_radial_sampler();
583
+
584
+ const q = new Quaternion();
585
+ q.fromEulerAnglesXYZ(0, (90 + 60) * DEG2RAD, 0);
586
+
461
587
  addDecal({
462
588
  position: [
463
589
  -1.5, 0, -4
@@ -465,12 +591,16 @@ function prepare_scene_decal_0() {
465
591
  scale: [
466
592
  1.5, 1.5, 1.5
467
593
  ],
594
+ rotation: q,
468
595
  sampler: sampler,
469
596
  scene,
470
597
  light_manager: lm
471
598
  });
472
599
 
473
- addKnot([0, 0, -5], 1, [0, 0, 0]);
600
+ // addBox([0, 0, -4], 2, [0, 0, 0]);
601
+ addKnot([0, 0, -4], 1, [0, 0, 0]);
602
+
603
+ scene.add(new AmbientLight(0xFFFFFF, 0.1));
474
604
 
475
605
  camera.near = 1;
476
606
  camera.far = 7;
@@ -478,6 +608,305 @@ function prepare_scene_decal_0() {
478
608
  camera.lookAt(0, 0, -5);
479
609
  }
480
610
 
611
+ async function prepare_scene_decal_1() {
612
+
613
+ const am = new AssetManager(null);
614
+
615
+ await am.registerLoader("image", new ImageRGBADataLoader());
616
+
617
+
618
+ const decal_urls = `data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_13_t.png
619
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_01_t.png
620
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_02_t.png
621
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_03_t.png
622
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_04_t.png
623
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_05_t.png
624
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_06_t.png
625
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_07_t.png
626
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_08_t.png
627
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_09_t.png
628
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_10_t.png
629
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_11_t.png
630
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_12_t.png
631
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_13_t.png
632
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_14_t.png
633
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_01_t.png
634
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_02_t.png
635
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_03_t.png
636
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_04_t.png
637
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_05_t.png
638
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_06_t.png
639
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_07_t.png
640
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_08_t.png
641
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_09_t.png
642
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_10_b.png
643
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_11_t.png
644
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_12_t.png
645
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_01_t.png
646
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_02_t.png
647
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_03_t.png
648
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_04_t.png
649
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_05_t.png
650
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_06_t.png
651
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_07_t.png
652
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_08_t.png
653
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_09_t.png
654
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_10_t.png
655
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_11_t.png
656
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_12_t.png
657
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_13_t.png
658
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_14_t.png
659
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_15_t.png
660
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_16_t.png
661
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_17_t.png
662
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_01_t.png
663
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_02_t.png
664
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_03_t.png
665
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_04_t.png
666
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_05_t.png
667
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_06_t.png
668
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_07_t.png
669
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_08_t.png
670
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_09_t.png
671
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_10_t.png
672
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_11_t.png
673
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_12_t.png
674
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_01_t.png
675
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_02_t.png
676
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_03_t.png
677
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_04_t.png
678
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_05_t.png
679
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_06_t.png
680
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_07_t.png
681
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_08_t.png
682
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_09_t.png
683
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_10_t.png
684
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_11_t.png
685
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_12_t.png
686
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_01_t.png
687
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_02_t.png
688
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_03_t.png
689
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_04_t.png
690
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_05_t.png
691
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_06_t.png
692
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_07_t.png
693
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_08_t.png
694
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_09_t.png
695
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_10_t.png
696
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_11_t.png
697
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_12_t.png
698
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_01_t.png
699
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_02_t.png
700
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_03_t.png
701
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_04_t.png
702
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_05_t.png
703
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_06_t.png
704
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_07_t.png
705
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_08_t.png
706
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_09_t.png
707
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_10_t.png
708
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_11_t.png
709
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_12_t.png
710
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_13_t.png
711
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_01_t.png
712
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_02_t.png
713
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_03_t.png
714
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_04_t.png
715
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_05_t.png
716
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_06_t.png
717
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_07_t.png
718
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_08_t.png
719
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_09_t.png
720
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_10_t.png
721
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_11_t.png
722
+ data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_12_t.png
723
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_3.png
724
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_1.png
725
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_2.png
726
+ data/textures/icons/sci-fi-nathan/v6/Proc strong_3.png
727
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_1.png
728
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_2.png
729
+ data/textures/icons/sci-fi-nathan/v6/Proc very strong_3.png
730
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_1.png
731
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_2.png
732
+ data/textures/icons/sci-fi-nathan/v6/Proc very weak_3.png
733
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_1.png
734
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_2.png
735
+ data/textures/icons/sci-fi-nathan/v6/Proc weak_3.png
736
+ data/textures/icons/sci-fi-nathan/v6/Core normal_1.png
737
+ data/textures/icons/sci-fi-nathan/v6/Core normal_2.png
738
+ data/textures/icons/sci-fi-nathan/v6/Core normal_3.png
739
+ data/textures/icons/sci-fi-nathan/v6/Core strong_1.png
740
+ data/textures/icons/sci-fi-nathan/v6/Core strong_2.png
741
+ data/textures/icons/sci-fi-nathan/v6/Core strong_3.png
742
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_1.png
743
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_2.png
744
+ data/textures/icons/sci-fi-nathan/v6/Core very strong_3.png
745
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_1.png
746
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_2.png
747
+ data/textures/icons/sci-fi-nathan/v6/Core very weak_3.png
748
+ data/textures/icons/sci-fi-nathan/v6/Core weak_1.png
749
+ data/textures/icons/sci-fi-nathan/v6/Core weak_2.png
750
+ data/textures/icons/sci-fi-nathan/v6/Core weak_3.png
751
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_1.png
752
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_2.png
753
+ data/textures/icons/sci-fi-nathan/v6/Memory normal_3.png
754
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_1.png
755
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_2.png
756
+ data/textures/icons/sci-fi-nathan/v6/Memory strong_3.png
757
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_1.png
758
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_2.png
759
+ data/textures/icons/sci-fi-nathan/v6/Memory very strong_3.png
760
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_1.png
761
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_2.png
762
+ data/textures/icons/sci-fi-nathan/v6/Memory very weak_3.png
763
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_1.png
764
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_2.png
765
+ data/textures/icons/sci-fi-nathan/v6/Memory weak_3.png
766
+ data/textures/icons/sci-fi-nathan/v6/Module normal_1.png
767
+ data/textures/icons/sci-fi-nathan/v6/Module normal_2.png
768
+ data/textures/icons/sci-fi-nathan/v6/Module normal_3.png
769
+ data/textures/icons/sci-fi-nathan/v6/Module strong_1.png
770
+ data/textures/icons/sci-fi-nathan/v6/Module strong_2.png
771
+ data/textures/icons/sci-fi-nathan/v6/Module strong_3.png
772
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_1.png
773
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_2.png
774
+ data/textures/icons/sci-fi-nathan/v6/Module very strong_3.png
775
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_1.png
776
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_2.png
777
+ data/textures/icons/sci-fi-nathan/v6/Module very weak_3.png
778
+ data/textures/icons/sci-fi-nathan/v6/Module weak_1.png
779
+ data/textures/icons/sci-fi-nathan/v6/Module weak_2.png
780
+ data/textures/icons/sci-fi-nathan/v6/Module weak_3.png
781
+ data/textures/icons/sci-fi-nathan/v6/Power normal_1.png
782
+ data/textures/icons/sci-fi-nathan/v6/Power normal_2.png
783
+ data/textures/icons/sci-fi-nathan/v6/Power normal_3.png
784
+ data/textures/icons/sci-fi-nathan/v6/Power strong_1.png
785
+ data/textures/icons/sci-fi-nathan/v6/Power strong_2.png
786
+ data/textures/icons/sci-fi-nathan/v6/Power strong_3.png
787
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_1.png
788
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_2.png
789
+ data/textures/icons/sci-fi-nathan/v6/Power very strong_3.png
790
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_1.png
791
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_2.png
792
+ data/textures/icons/sci-fi-nathan/v6/Power very weak_3.png
793
+ data/textures/icons/sci-fi-nathan/v6/Power weak_1.png
794
+ data/textures/icons/sci-fi-nathan/v6/Power weak_2.png
795
+ data/textures/icons/sci-fi-nathan/v6/Power weak_3.png
796
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_1.png
797
+ data/textures/icons/sci-fi-nathan/v6/Proc normal_2.png`
798
+ .split('\n')
799
+ .map(a => a.trim());
800
+
801
+ const samplers = [];
802
+ const promises = [];
803
+
804
+ for (let i = 0; i < decal_urls.length; i++) {
805
+ const promise = am.promise(decal_urls[i], 'image');
806
+ promises.push(promise);
807
+ }
808
+
809
+ const assets = await Promise.all(promises);
810
+
811
+ for (let i = 0; i < assets.length; i++) {
812
+ const asset = assets[i];
813
+
814
+ samplers[i] = asset.create();
815
+ }
816
+
817
+ const canvas_size = 5;
818
+
819
+ const random = seededRandom();
820
+
821
+ const COUNT = 1024;
822
+
823
+ const ROW_WIDTH = Math.ceil(Math.sqrt(COUNT));
824
+ const size = canvas_size / ROW_WIDTH;
825
+
826
+ for (let i = 0; i < COUNT; i++) {
827
+
828
+ const q = new Quaternion();
829
+ // q.fromEulerAnglesXYZ(0, (90 + randomFloatBetween(random, -60, 60)) * DEG2RAD, 0);
830
+ q.fromEulerAnglesXYZ(0, (-180) * DEG2RAD, 0);
831
+
832
+ const sampler = randomFromArray(random, samplers);
833
+ // const sampler = samplers[i % samplers.length];
834
+
835
+ // const size = randomFloatBetween(random, 1, 3);
836
+ //const size = 0.5;
837
+
838
+ // const position = [
839
+ // randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), -4
840
+ // ];
841
+
842
+ const x = ((i % ROW_WIDTH)) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
843
+ const y = Math.floor(i / ROW_WIDTH) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
844
+ const position = [
845
+ x * canvas_size, y * canvas_size, -4
846
+ ];
847
+
848
+ addDecal({
849
+ position: position,
850
+ scale: [
851
+ size, size, 1.5
852
+ ],
853
+ rotation: q,
854
+ sampler: sampler,
855
+ scene,
856
+ light_manager: lm
857
+ });
858
+
859
+ }
860
+
861
+ // addBox([0, 0, -4], [canvas_size, canvas_size, 1], [0, 0, 0]);
862
+ //
863
+ addKnot([0, 0, -4], 2, [0, 0, 0])
864
+
865
+ scene.add(new AmbientLight(0xFFFFFF, 0.8));
866
+
867
+ camera.near = 1;
868
+ camera.far = 30;
869
+
870
+ camera.lookAt(0, 0, -5);
871
+ camera.position.set(0, 0, 10);
872
+ }
873
+
874
+
875
+ async function prepare_scene_9() {
876
+
877
+
878
+ const canvas_size = 20;
879
+
880
+ const random = seededRandom();
881
+
882
+ const color = new Color();
883
+
884
+ for (let i = 0; i < 100; i++) {
885
+
886
+ color.setHSV(random(), 1, 1);
887
+
888
+ addPointLight({
889
+ position: [
890
+ randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), -3
891
+ ],
892
+ radius: 1.5,
893
+ color: color.toUint(),
894
+ intensity: 1
895
+ }
896
+ );
897
+
898
+ }
899
+
900
+ addBox([0, 0, -4], [canvas_size, canvas_size, 1], [0, 0, 0]);
901
+
902
+ // scene.add(new AmbientLight(0xFFFFFF, 0.5));
903
+
904
+ camera.near = 1;
905
+ camera.far = 30;
906
+
907
+ camera.lookAt(0, 0, -5);
908
+ }
909
+
481
910
 
482
911
  function prepare_scene_5() {
483
912
 
@@ -731,8 +1160,36 @@ function move_camera(time_delta) {
731
1160
  camera.rotation.z += 0.0131 * time_delta;
732
1161
  }
733
1162
 
1163
+
1164
+ const pointerDevice = new PointerDevice(renderer.domElement);
1165
+
1166
+ const gml = new GMLEngine();
1167
+ gml.initialize(new StaticKnowledgeDatabase(), new Localization());
1168
+
1169
+ const tips = new TooltipManager();
1170
+ tips.initialize(gml, pointerDevice);
1171
+ tips.startup();
1172
+
1173
+ tips.contextView.css({
1174
+ position: 'absolute',
1175
+ left: 0,
1176
+ top: 0
1177
+ });
1178
+
1179
+ document.body.appendChild(tips.contextView.el);
1180
+ tips.contextView.link();
1181
+ tips.contextView.size.set(window.innerWidth, window.innerHeight);
1182
+
1183
+
734
1184
  const lightClusterWidget = buildLightClusterWidget(lm, camera);
735
- const screenGrid = createScreenGrid({ width: window.innerWidth, height: window.innerHeight, lm: lm, heatmap: true });
1185
+ const screenGrid = createScreenGrid({
1186
+ width: window.innerWidth,
1187
+ height: window.innerHeight,
1188
+ lm: lm,
1189
+ heatmap: true,
1190
+ tooltips: tips
1191
+ });
1192
+ screenGrid.view.link();
736
1193
 
737
1194
  function animate() {
738
1195
 
@@ -747,6 +1204,10 @@ function animate() {
747
1204
 
748
1205
  // controls.update();
749
1206
 
1207
+ camera.updateMatrix();
1208
+ camera.updateWorldMatrix(true, true);
1209
+ camera.updateProjectionMatrix();
1210
+
750
1211
  do_sample();
751
1212
 
752
1213
  debug_material.uniforms.fp_f_camera_near.value = camera.near;
@@ -834,8 +1295,10 @@ function draw_camera_view_planes() {
834
1295
 
835
1296
  // prepare_scene_2();
836
1297
  // prepare_scene_decal_0();
837
- // prepare_scene_2();
838
- prepare_scene_0();
1298
+ // prepare_scene_decal_1();
1299
+ // prepare_scene_9();
1300
+ prepare_scene_2();
1301
+ // prepare_scene_0();
839
1302
  animate();
840
1303
 
841
1304
  // draw_camera_view_planes();
@@ -873,8 +1336,10 @@ const debugger_button = new ButtonView({
873
1336
  action() {
874
1337
  if (screenGrid.domElement.parentNode !== null) {
875
1338
  document.body.removeChild(screenGrid.domElement);
1339
+ screenGrid.view.unlink();
876
1340
  } else {
877
1341
  document.body.appendChild(screenGrid.domElement);
1342
+ screenGrid.view.link();
878
1343
  }
879
1344
  },
880
1345
  name: "debugger",
@@ -888,6 +1353,8 @@ const debugger_button = new ButtonView({
888
1353
  }
889
1354
  });
890
1355
 
1356
+ // debugAtlas(lm.__decal_atlas.atlas, { scale: new Vector2(0.125, 0.125) });
1357
+
891
1358
  debugger_button.link();
892
1359
 
893
1360
  document.body.appendChild(debugger_button.el);
@@ -907,4 +1374,5 @@ function onWindowResize() {
907
1374
  renderer.setSize(w, h);
908
1375
  }
909
1376
 
1377
+ onWindowResize();
910
1378
  window.addEventListener("resize", onWindowResize);