@woosh/meep-engine 2.75.7 → 2.75.9

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 (150) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +1052 -1234
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +1052 -1234
  5. package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
  6. package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
  7. package/editor/ecs/component/createObjectEditor.js +2 -2
  8. package/editor/process/EditorProcess.js +12 -16
  9. package/editor/process/ProcessEngine.js +9 -10
  10. package/package.json +1 -1
  11. package/src/core/binary/dec2hex.js +1 -1
  12. package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
  13. package/src/core/math/newton_solver_1d.js +13 -4
  14. package/src/core/math/solveQuadratic.js +5 -3
  15. package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
  16. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
  17. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
  18. package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
  19. package/src/core/math/spline/interpolate_bicubic.js +12 -0
  20. package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
  21. package/src/core/model/object/ImmutableObjectPool.js +14 -5
  22. package/src/engine/control/ControlContext.js +25 -27
  23. package/src/engine/ecs/EntityManager.js +12 -9
  24. package/src/engine/ecs/EntityObserver.js +26 -22
  25. package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
  26. package/src/engine/ecs/components/Motion.js +5 -7
  27. package/src/engine/ecs/components/SerializationMetadata.js +5 -3
  28. package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
  29. package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
  30. package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
  31. package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
  32. package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
  33. package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
  34. package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
  35. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
  36. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
  37. package/src/engine/ecs/parent/EntityNode.js +39 -37
  38. package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
  39. package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +7 -9
  40. package/src/engine/ecs/storage/BinaryBufferSerializer.js +15 -16
  41. package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +10 -59
  42. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +14 -15
  43. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -3
  44. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +60 -62
  45. package/src/engine/ecs/storage/binary/executeBinaryClassUpgraderChain.js +46 -0
  46. package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +2 -2
  47. package/src/engine/ecs/system/SystemEntityContext.js +25 -23
  48. package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
  49. package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
  50. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +37 -31
  51. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +8 -7
  52. package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
  53. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
  54. package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
  55. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
  56. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
  57. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
  58. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
  59. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
  60. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
  61. package/src/engine/graphics/render/RendererPool.js +36 -40
  62. package/src/engine/graphics/render/buffer/FrameBuffer.js +25 -24
  63. package/src/engine/graphics/render/buffer/RenderGraph.js +21 -21
  64. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
  65. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -5
  66. package/src/engine/graphics/render/frame_graph/IRenderContext.js +31 -1
  67. package/src/engine/graphics/render/frame_graph/RenderGraph.js +5 -5
  68. package/src/engine/graphics/render/frame_graph/RenderTarget.js +9 -0
  69. package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +57 -0
  70. package/src/engine/graphics/render/frame_graph/ResourceEntry.js +7 -5
  71. package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +48 -33
  72. package/src/engine/graphics/render/frame_graph/TextureInitialState.js +14 -0
  73. package/src/engine/graphics/render/frame_graph/sample/deferred/CopyPass.js +20 -0
  74. package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +4 -0
  75. package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +34 -6
  76. package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +34 -0
  77. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +3 -6
  78. package/src/engine/graphics/sh3/gi/prototypeSHGI.js +92 -0
  79. package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  80. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
  81. package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
  82. package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
  83. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
  84. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
  85. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
  86. package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
  87. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMemoryMapping.js → VirtualTextureMemoryMapping.js} +2 -26
  88. package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js} +10 -10
  89. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureTileLoader.js → VirtualTextureTileLoader.js} +7 -7
  90. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js} +1 -1
  91. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageUpdater.js → VirtualTextureUsageUpdater.js} +7 -7
  92. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/ResidencyDebugView.js +4 -4
  93. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsageDebugView.js +2 -2
  94. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsagePyramidDebugView.js +4 -4
  95. package/src/engine/graphics/texture/virtual/{v2/prototype.js → prototype.js} +7 -7
  96. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_finger_print.js +1 -1
  97. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_tile_address.js +2 -2
  98. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/tile_address_to_finger_print.js +1 -1
  99. package/src/engine/navigation/ecs/components/Path.js +10 -9
  100. package/src/engine/physics/computeInterceptPoint.js +44 -0
  101. package/src/engine/plugin/EnginePlugin.js +1 -2
  102. package/src/engine/ecs/components/AlignToVelocity.js +0 -9
  103. package/src/engine/ecs/components/CharacterController.js +0 -31
  104. package/src/engine/ecs/components/PhysicalBody.js +0 -51
  105. package/src/engine/ecs/components/Steering.js +0 -111
  106. package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
  107. package/src/engine/ecs/storage/json/Blueprint.js +0 -129
  108. package/src/engine/ecs/storage/json/EntityFactory.js +0 -207
  109. package/src/engine/ecs/storage/json/JSONDeSerializer.js +0 -148
  110. package/src/engine/ecs/storage/json/JSONSerializer.js +0 -132
  111. package/src/engine/ecs/storage/json/README.md +0 -5
  112. package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
  113. package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
  114. package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
  115. package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
  116. package/src/engine/ecs/systems/SteeringSystem.js +0 -171
  117. package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
  118. package/src/engine/ecs/systems/TagSystem.js +0 -31
  119. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +0 -108
  120. package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +0 -71
  121. package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +0 -39
  122. package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +0 -21
  123. package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +0 -41
  124. package/src/engine/graphics/render/webgpu/sample/main.js +0 -605
  125. package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +0 -9
  126. package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +0 -30
  127. package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
  128. package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
  129. package/src/engine/graphics/texture/virtual/TileOperation.js +0 -13
  130. package/src/engine/graphics/texture/virtual/TileTree.js +0 -150
  131. package/src/engine/graphics/texture/virtual/TileTree.spec.js +0 -58
  132. package/src/engine/graphics/texture/virtual/TileUsage.js +0 -137
  133. package/src/engine/graphics/texture/virtual/VirtualTexture.js +0 -238
  134. package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +0 -39
  135. package/src/engine/graphics/texture/virtual/page/TilePage.js +0 -148
  136. package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +0 -36
  137. package/src/engine/graphics/texture/virtual/tile/Tile.js +0 -44
  138. package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +0 -11
  139. package/src/engine/graphics/texture/virtual/tile/TileAddress.js +0 -63
  140. package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +0 -30
  141. package/src/engine/graphics/texture/virtual/tile/TileLoader.js +0 -178
  142. package/src/engine/graphics/texture/virtual/tile/TileRequest.js +0 -40
  143. package/src/engine/graphics/texture/virtual/tile/TileStatus.js +0 -10
  144. package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
  145. /package/src/engine/graphics/texture/virtual/{v2/NOTES.md → NOTES.md} +0 -0
  146. /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMaterial.js → VirtualTextureMaterial.js} +0 -0
  147. /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageShader.js → VirtualTextureUsageShader.js} +0 -0
  148. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/VirtualTextureTile.js +0 -0
  149. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/decompose_finger_print.js +0 -0
  150. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/finger_print_to_tile_address.js +0 -0
@@ -1,66 +1,17 @@
1
- import { assert } from "../../../../core/assert.js";
2
-
3
- /**
4
- * Upgrade binary data by executing a sequnece of upgraders on it
5
- * @param {BinaryClassUpgrader[]} upgraders
6
- * @param {BinaryBuffer} buffer
7
- * @param {BinaryBuffer} tempBuffer0
8
- * @param {BinaryBuffer} tempBuffer1
9
- * @return {BinaryBuffer} new buffer with upgraded data
10
- */
11
- export function executeBinaryClassUpgraderChain(upgraders, buffer, tempBuffer0, tempBuffer1) {
12
- assert.ok(Array.isArray(upgraders), 'upgraders must be an array, instead was something else');
13
- assert.defined(buffer);
14
- assert.defined(tempBuffer0);
15
- assert.defined(tempBuffer1);
16
-
1
+ export class BinaryClassUpgrader {
17
2
 
18
3
  /**
19
4
  *
20
- * @type {BinaryBuffer[]}
5
+ * @type {number}
6
+ * @protected
21
7
  */
22
- const tempBuffers = [tempBuffer0, tempBuffer1];
23
-
24
- let sourceBuffer = buffer;
25
- let targetBuffer = tempBuffer0;
26
-
27
- const upgraderCount = upgraders.length;
28
-
29
- //perform upgrade
30
- for (
31
- let i = 0;
32
- i < upgraderCount;
33
- i++, sourceBuffer = targetBuffer, targetBuffer = tempBuffers[i % 2]
34
- ) {
35
- const upgrader = upgraders[i];
36
-
37
- targetBuffer.position = 0;
38
-
39
- upgrader.upgrade(sourceBuffer, targetBuffer);
40
-
41
- //rewind target buffer so it can be read
42
- targetBuffer.position = 0;
43
- }
44
-
45
- return sourceBuffer;
46
- }
47
-
48
- export class BinaryClassUpgrader {
49
- constructor() {
50
- /**
51
- *
52
- * @type {number}
53
- * @protected
54
- */
55
- this.__startVersion = 0;
56
- /**
57
- *
58
- * @type {number}
59
- * @protected
60
- */
61
- this.__targetVersion = 0;
62
- }
63
-
8
+ __startVersion = 0;
9
+ /**
10
+ *
11
+ * @type {number}
12
+ * @protected
13
+ */
14
+ __targetVersion = 0;
64
15
 
65
16
  /**
66
17
  *
@@ -1,24 +1,23 @@
1
- import { Graph } from "../../../../core/graph/Graph.js";
2
1
  import { assert } from "../../../../core/assert.js";
2
+ import { Graph } from "../../../../core/graph/Graph.js";
3
3
 
4
4
  /**
5
5
  * Contains serializers for various data types as well as data upgraders which enable support for serialization format changes
6
6
  */
7
7
  export class BinarySerializationRegistry {
8
- constructor() {
9
- /**
10
- * @readonly
11
- * @private
12
- * @type {Map<string, Graph<BinaryClassUpgrader>>}
13
- */
14
- this.upgraders = new Map();
15
- /**
16
- * @readonly
17
- * @private
18
- * @type {Map<string, BinaryClassSerializationAdapter>}
19
- */
20
- this.serializers = new Map();
21
- }
8
+
9
+ /**
10
+ * @readonly
11
+ * @private
12
+ * @type {Map<string, Graph<BinaryClassUpgrader>>}
13
+ */
14
+ upgraders = new Map();
15
+ /**
16
+ * @readonly
17
+ * @private
18
+ * @type {Map<string, BinaryClassSerializationAdapter>}
19
+ */
20
+ serializers = new Map();
22
21
 
23
22
  /**
24
23
  *
@@ -1,10 +1,10 @@
1
- import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
2
- import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
3
1
  import { assert } from "../../../../../core/assert.js";
2
+ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
4
3
  import { IllegalStateException } from "../../../../../core/fsm/exceptions/IllegalStateException.js";
5
- import { executeBinaryClassUpgraderChain } from "../BinaryClassUpgrader.js";
6
4
  import { returnEmptyArray } from "../../../../../core/function/Functions.js";
7
5
  import { objectKeyByValue } from "../../../../../core/model/object/objectKeyByValue.js";
6
+ import { executeBinaryClassUpgraderChain } from "../executeBinaryClassUpgraderChain.js";
7
+ import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
8
8
 
9
9
  /**
10
10
  *
@@ -1,70 +1,68 @@
1
1
  import { assert } from "../../../../../core/assert.js";
2
- import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
3
2
  import { HashMap } from "../../../../../core/collection/map/HashMap.js";
4
3
  import { returnEmptyArray } from "../../../../../core/function/Functions.js";
4
+ import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
5
5
 
6
6
  export class BinaryCollectionSerializer {
7
- constructor() {
8
-
9
- /**
10
- * @private
11
- * @type {BinarySerializationRegistry}
12
- */
13
- this.registry = null;
14
-
15
- /**
16
- * @private
17
- * @type {BinaryBuffer}
18
- */
19
- this.buffer = null;
20
-
21
- /**
22
- * @private
23
- * @type {BinaryClassSerializationAdapter}
24
- */
25
- this.adapter = null;
26
-
27
-
28
- /**
29
- *
30
- * @type {String}
31
- */
32
- this.className = null;
33
-
34
- /**
35
- *
36
- * @type {boolean}
37
- * @private
38
- */
39
- this.__dictionaryEnabled = false;
40
-
41
- /**
42
- * @private
43
- * @type {number}
44
- */
45
- this.elementCount = 0;
46
7
 
8
+ /**
9
+ * @private
10
+ * @type {BinarySerializationRegistry}
11
+ */
12
+ registry = null;
47
13
 
48
- /**
49
- * @private
50
- * @type {number}
51
- */
52
- this.startAddress = 0;
53
-
54
- /**
55
- * @private
56
- * @type {number}
57
- */
58
- this.headerAddress = 0;
59
-
60
- /**
61
- * @private
62
- * @type {Map<any, number>}
63
- */
64
- this.dictionary = new HashMap({
65
- capacity: 1024, //pre-allocate larger size to avoid rehashing
66
- });
67
- }
14
+ /**
15
+ * @private
16
+ * @type {BinaryBuffer}
17
+ */
18
+ buffer = null;
19
+
20
+ /**
21
+ * @private
22
+ * @type {BinaryClassSerializationAdapter}
23
+ */
24
+ adapter = null;
25
+
26
+
27
+ /**
28
+ *
29
+ * @type {String}
30
+ */
31
+ className = null;
32
+
33
+ /**
34
+ *
35
+ * @type {boolean}
36
+ * @private
37
+ */
38
+ __dictionaryEnabled = false;
39
+
40
+ /**
41
+ * @private
42
+ * @type {number}
43
+ */
44
+ elementCount = 0;
45
+
46
+
47
+ /**
48
+ * @private
49
+ * @type {number}
50
+ */
51
+ startAddress = 0;
52
+
53
+ /**
54
+ * @private
55
+ * @type {number}
56
+ */
57
+ headerAddress = 0;
58
+
59
+ /**
60
+ * @private
61
+ * @type {Map<any, number>}
62
+ */
63
+ dictionary = new HashMap({
64
+ capacity: 1024, //pre-allocate larger size to avoid rehashing
65
+ });
68
66
 
69
67
  /**
70
68
  *
@@ -115,10 +113,10 @@ export class BinaryCollectionSerializer {
115
113
  */
116
114
  initialize({
117
115
  adapterOptionsSupplier = returnEmptyArray,
118
- problemConsumer = console.warn
116
+ problemConsumer = console.warn
119
117
  } = {}) {
120
118
 
121
- assert.isFunction(adapterOptionsSupplier, 'adapterOptionsSupplier');
119
+ assert.isFunction(adapterOptionsSupplier, 'adapterOptionsSupplier');
122
120
 
123
121
  const className = this.className;
124
122
 
@@ -0,0 +1,46 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+
3
+ /**
4
+ * Upgrade binary data by executing a sequnece of upgraders on it
5
+ * @param {BinaryClassUpgrader[]} upgraders
6
+ * @param {BinaryBuffer} buffer
7
+ * @param {BinaryBuffer} tempBuffer0
8
+ * @param {BinaryBuffer} tempBuffer1
9
+ * @return {BinaryBuffer} new buffer with upgraded data
10
+ */
11
+ export function executeBinaryClassUpgraderChain(upgraders, buffer, tempBuffer0, tempBuffer1) {
12
+ assert.ok(Array.isArray(upgraders), 'upgraders must be an array, instead was something else');
13
+ assert.defined(buffer);
14
+ assert.defined(tempBuffer0);
15
+ assert.defined(tempBuffer1);
16
+
17
+
18
+ /**
19
+ *
20
+ * @type {BinaryBuffer[]}
21
+ */
22
+ const tempBuffers = [tempBuffer0, tempBuffer1];
23
+
24
+ let sourceBuffer = buffer;
25
+ let targetBuffer = tempBuffer0;
26
+
27
+ const upgraderCount = upgraders.length;
28
+
29
+ //perform upgrade
30
+ for (
31
+ let i = 0;
32
+ i < upgraderCount;
33
+ i++, sourceBuffer = targetBuffer, targetBuffer = tempBuffers[i % 2]
34
+ ) {
35
+ const upgrader = upgraders[i];
36
+
37
+ targetBuffer.position = 0;
38
+
39
+ upgrader.upgrade(sourceBuffer, targetBuffer);
40
+
41
+ //rewind target buffer so it can be read
42
+ targetBuffer.position = 0;
43
+ }
44
+
45
+ return sourceBuffer;
46
+ }
@@ -1,6 +1,6 @@
1
- import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
2
- import { executeBinaryClassUpgraderChain } from "../BinaryClassUpgrader.js";
3
1
  import { assert } from "../../../../../core/assert.js";
2
+ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
3
+ import { executeBinaryClassUpgraderChain } from "../executeBinaryClassUpgraderChain.js";
4
4
 
5
5
  /**
6
6
  * Tool for serializing and deserializing whole objects
@@ -1,27 +1,29 @@
1
1
  export class SystemEntityContext {
2
- constructor() {
3
-
4
- this.entity = -1;
5
-
6
- /**
7
- * Pointer back to the system
8
- * @type {System}
9
- */
10
- this.system = null;
11
-
12
- /**
13
- *
14
- * @type {*[]}
15
- */
16
- this.components = [];
17
-
18
- /**
19
- *
20
- * @type {boolean}
21
- * @protected
22
- */
23
- this.__is_linked = false;
24
- }
2
+
3
+ /**
4
+ *
5
+ * @type {number}
6
+ */
7
+ entity = -1;
8
+
9
+ /**
10
+ * Pointer back to the system
11
+ * @type {System}
12
+ */
13
+ system = null;
14
+
15
+ /**
16
+ *
17
+ * @type {*[]}
18
+ */
19
+ components = [];
20
+
21
+ /**
22
+ *
23
+ * @type {boolean}
24
+ * @protected
25
+ */
26
+ __is_linked = false;
25
27
 
26
28
  /**
27
29
  *
@@ -0,0 +1,18 @@
1
+ import Tag from "../components/Tag.js";
2
+
3
+ /**
4
+ *
5
+ * @param {string} tag
6
+ * @param {EntityComponentDataset} ecd
7
+ * @returns {number[]}
8
+ */
9
+ export function find_entities_with_tag(tag, ecd) {
10
+ const r = [];
11
+ ecd.traverseComponents(Tag, (t, e) => {
12
+ if (t.contains(tag)) {
13
+ r.push(e);
14
+ }
15
+ });
16
+
17
+ return r;
18
+ }
@@ -3,8 +3,8 @@
3
3
  */
4
4
 
5
5
 
6
- import Vector2 from '../../../core/geom/Vector2.js';
7
6
  import { RepeatWrapping, TextureLoader } from "three";
7
+ import Vector2 from '../../../core/geom/Vector2.js';
8
8
 
9
9
  const texture_cache = new Map();
10
10
 
@@ -33,31 +33,30 @@ function loadCloudTexture(url) {
33
33
 
34
34
 
35
35
  class Clouds {
36
- constructor() {
37
- /**
38
- *
39
- * @type {boolean}
40
- * @private
41
- */
42
- this.__enabled = false;
43
- /**
44
- *
45
- * @type {Array}
46
- * @private
47
- */
48
- this.materials = [];
49
- this.time = 0;
50
-
51
-
52
- this.__speed0 = new Vector2();
53
- this.__speed1 = new Vector2();
54
- this.__speed2 = new Vector2();
55
-
56
- //how fast clouds reform
57
- this.variability = 0.37;
36
+ /**
37
+ *
38
+ * @type {boolean}
39
+ * @private
40
+ */
41
+ __enabled = false;
42
+ /**
43
+ *
44
+ * @type {Array}
45
+ * @private
46
+ */
47
+ materials = [];
48
+ time = 0;
58
49
 
59
- this.setSpeed(0.5, -0.5);
60
50
 
51
+ __speed0 = new Vector2();
52
+ __speed1 = new Vector2();
53
+ __speed2 = new Vector2();
54
+
55
+ //how fast clouds reform
56
+ variability = 0.37;
57
+
58
+ constructor() {
59
+ this.setSpeed(0.5, -0.5);
61
60
  }
62
61
 
63
62
  /**
@@ -1,11 +1,11 @@
1
- import Vector2 from "../../../../../core/geom/Vector2.js";
2
- import { GameAssetType } from "../../../../asset/GameAssetType.js";
3
- import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
4
1
  import { Cache } from "../../../../../core/cache/Cache.js";
5
2
  import Signal from "../../../../../core/events/signal/Signal.js";
3
+ import Vector2 from "../../../../../core/geom/Vector2.js";
6
4
  import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
7
- import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
8
5
  import { string_compute_byte_size } from "../../../../../core/primitives/strings/string_compute_byte_size.js";
6
+ import { GameAssetType } from "../../../../asset/GameAssetType.js";
7
+ import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
8
+ import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
9
9
 
10
10
  /**
11
11
  *
@@ -26,37 +26,37 @@ const cache = new Cache({
26
26
  });
27
27
 
28
28
  export class TerrainLayer {
29
- constructor() {
30
- /**
31
- *
32
- * @type {String}
33
- */
34
- this.textureDiffuseURL = "";
35
29
 
36
- /**
37
- *
38
- * @type {Sampler2D}
39
- */
40
- this.diffuse = Sampler2D.uint8(3, 1, 1);
30
+ /**
31
+ *
32
+ * @type {String}
33
+ */
34
+ textureDiffuseURL = "";
41
35
 
42
- /**
43
- *
44
- * @type {Vector2}
45
- */
46
- this.size = new Vector2(1, 1);
36
+ /**
37
+ *
38
+ * @type {Sampler2D}
39
+ */
40
+ diffuse = Sampler2D.uint8(3, 1, 1);
47
41
 
48
- /**
49
- * Additional free-form JSON metadata
50
- * @type {Object}
51
- */
52
- this.extra = {};
42
+ /**
43
+ *
44
+ * @type {Vector2}
45
+ */
46
+ size = new Vector2(1, 1);
47
+
48
+ /**
49
+ * Additional free-form JSON metadata
50
+ * @type {Object}
51
+ */
52
+ extra = {};
53
+
54
+ /**
55
+ *
56
+ * @type {Signal}
57
+ */
58
+ onChanged = new Signal();
53
59
 
54
- /**
55
- *
56
- * @type {Signal}
57
- */
58
- this.onChanged = new Signal();
59
- }
60
60
 
61
61
  toJSON() {
62
62
  return {
@@ -163,3 +163,9 @@ export class TerrainLayer {
163
163
  });
164
164
  }
165
165
  }
166
+
167
+ /**
168
+ * @readonly
169
+ * @type {boolean}
170
+ */
171
+ TerrainLayer.prototype.isTerrainLayer = true;
@@ -13,16 +13,16 @@ import {
13
13
  UnsignedByteType
14
14
  } from "three";
15
15
  import { assert } from "../../../../../core/assert.js";
16
- import Vector2 from "../../../../../core/geom/Vector2.js";
17
- import { TerrainLayer } from "./TerrainLayer.js";
18
- import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
19
- import { sampler2d_scale } from "../../../../graphics/texture/sampler/resize/sampler2d_scale.js";
20
- import List from "../../../../../core/collection/list/List.js";
21
16
  import { Cache } from "../../../../../core/cache/Cache.js";
22
- import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
17
+ import { typed_array_copy } from "../../../../../core/collection/array/typed/typed_array_copy.js";
18
+ import List from "../../../../../core/collection/list/List.js";
19
+ import Vector2 from "../../../../../core/geom/Vector2.js";
23
20
  import { invokeObjectEquals } from "../../../../../core/model/object/invokeObjectEquals.js";
24
21
  import { invokeObjectHash } from "../../../../../core/model/object/invokeObjectHash.js";
25
- import { typed_array_copy } from "../../../../../core/collection/array/typed/typed_array_copy.js";
22
+ import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
23
+ import { sampler2d_scale } from "../../../../graphics/texture/sampler/resize/sampler2d_scale.js";
24
+ import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
25
+ import { TerrainLayer } from "./TerrainLayer.js";
26
26
 
27
27
  class ScaledTextureKey {
28
28
  uri = '';
@@ -278,6 +278,7 @@ export class TerrainLayers {
278
278
  */
279
279
  addLayer(layer) {
280
280
  assert.defined(layer);
281
+ assert.equal(layer.isTerrainLayer, true, 'layer.isTerrainLayer !== true');
281
282
 
282
283
  const index = this.layers.length;
283
284
 
@@ -3,6 +3,9 @@ import AABB2 from "../../../../../core/geom/AABB2.js";
3
3
  import { max2 } from "../../../../../core/math/max2.js";
4
4
  import { min2 } from "../../../../../core/math/min2.js";
5
5
  import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
6
+ import {
7
+ sampler2d_sub_copy_same_item_size
8
+ } from "../../../../graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js";
6
9
 
7
10
  export class SplatMapMaterialPatch {
8
11
  /**
@@ -413,8 +416,8 @@ export class SplatMapMaterialPatch {
413
416
  const target = new Sampler2D(newWeights, 1, nW, nH);
414
417
 
415
418
  //copy both sources to the new weights target
416
- target.copy_sameItemSize(t_Source, 0, 0, nBB_x0 - t_bb.x0, nBB_y0 - t_bb.y0, t_bb.getHeight(), t_bb.getHeight());
417
- target.copy_sameItemSize(o_Source, 0, 0, nBB_x0 - o_bb.x0, nBB_y0 - o_bb.y0, o_bb.getHeight(), o_bb.getHeight());
419
+ sampler2d_sub_copy_same_item_size(target,t_Source, 0, 0, nBB_x0 - t_bb.x0, nBB_y0 - t_bb.y0, t_bb.getHeight(), t_bb.getHeight());
420
+ sampler2d_sub_copy_same_item_size(target,o_Source, 0, 0, nBB_x0 - o_bb.x0, nBB_y0 - o_bb.y0, o_bb.getHeight(), o_bb.getHeight());
418
421
 
419
422
  this.weights = newWeights;
420
423
  }
@@ -3,19 +3,20 @@
3
3
  */
4
4
 
5
5
 
6
- import Vector4 from '../../../../core/geom/Vector4.js';
7
- import canvas2Sampler2D from "../../../graphics/texture/Canvas2Sampler2D.js";
8
- import Vector2 from "../../../../core/geom/Vector2.js";
9
- import Vector1 from "../../../../core/geom/Vector1.js";
10
- import { assert } from "../../../../core/assert.js";
11
- import ObservedString from "../../../../core/model/ObservedString.js";
12
6
  import { ClampToEdgeWrapping, DataTexture, NearestFilter } from "three";
13
- import { Sampler2D } from "../../../graphics/texture/sampler/Sampler2D.js";
14
- import { sampler2d_scale } from "../../../graphics/texture/sampler/resize/sampler2d_scale.js";
15
- import { uint82float } from "../../../../core/binary/uint82float.js";
7
+ import { assert } from "../../../../core/assert.js";
16
8
  import { float2uint8 } from "../../../../core/binary/float2uint8.js";
17
- import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
9
+ import { uint82float } from "../../../../core/binary/uint82float.js";
18
10
  import { array_copy } from "../../../../core/collection/array/array_copy.js";
11
+ import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
12
+ import Vector1 from "../../../../core/geom/Vector1.js";
13
+ import Vector2 from "../../../../core/geom/Vector2.js";
14
+ import Vector4 from '../../../../core/geom/Vector4.js';
15
+ import ObservedString from "../../../../core/model/ObservedString.js";
16
+ import canvas2Sampler2D from "../../../graphics/texture/Canvas2Sampler2D.js";
17
+ import { sampler2d_scale } from "../../../graphics/texture/sampler/resize/sampler2d_scale.js";
18
+ import { Sampler2D } from "../../../graphics/texture/sampler/Sampler2D.js";
19
+ import { sampler2d_paint } from "../../../graphics/texture/sampler/sampler2d_paint.js";
19
20
  import { WHITE_PIXEL_DATA_URL } from "../../../graphics/WHITE_PIXEL_DATA_URL.js";
20
21
 
21
22
  class Context {
@@ -69,7 +70,7 @@ export class TerrainOverlay {
69
70
  */
70
71
  this.size = new Vector2(size.x, size.y);
71
72
 
72
- /**
73
+ /**
73
74
  *
74
75
  * @type {ObservedString}
75
76
  */
@@ -120,7 +121,7 @@ export class TerrainOverlay {
120
121
  *
121
122
  * @returns {string}
122
123
  */
123
- get baseTileImage(){
124
+ get baseTileImage() {
124
125
  return this.stack.length === 0 ? this.tileImage.getValue() : this.stack[0].tileImage
125
126
  }
126
127
 
@@ -128,7 +129,7 @@ export class TerrainOverlay {
128
129
  *
129
130
  * @param {string} v
130
131
  */
131
- set baseTileImage(v){
132
+ set baseTileImage(v) {
132
133
  if (this.stack.length === 0) {
133
134
  this.tileImage.set(v);
134
135
  } else {
@@ -316,7 +317,7 @@ export class TerrainOverlay {
316
317
  const scaled_source = Sampler2D.uint8(4, dWidth, dHeight);
317
318
  sampler2d_scale(source, scaled_source);
318
319
 
319
- this.sampler.paint(scaled_source, 0, 0, dx, dy, dWidth, dHeight);
320
+ sampler2d_paint(this, scaled_source, 0, 0, dx, dy, dWidth, dHeight);
320
321
 
321
322
  this.texture.needsUpdate = true;
322
323
  }