@woosh/meep-engine 2.33.61 → 2.33.65

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 (60) hide show
  1. package/core/FilePath.js +28 -2
  2. package/core/binary/BinaryBuffer.js +13 -0
  3. package/ecs/grid/pick.js +44 -0
  4. package/editor/actions/concrete/PaintTerrainOverlayAction.js +1 -1
  5. package/editor/process/ObstacleGridDisplayProcess.js +1 -1
  6. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
  7. package/editor/tools/FoliagePaintTool.js +1 -1
  8. package/editor/tools/GridPaintTool.js +2 -2
  9. package/editor/tools/paint/TerrainPaintTool.js +2 -2
  10. package/editor/tools/paint/TerrainTexturePaintTool.js +1 -1
  11. package/editor/view/EditorView.js +1 -1
  12. package/editor/view/GridPickCoordinateView.js +2 -2
  13. package/engine/asset/AssetManager.js +1 -1
  14. package/engine/asset/AssetTransformer.js +2 -1
  15. package/engine/asset/loaders/GLTFAssetLoader.js +5 -21
  16. package/engine/asset/loaders/async_traverse_three_object.js +24 -0
  17. package/engine/ecs/animation/InverseKinematicsSystem.js +1 -1
  18. package/engine/ecs/attachment/AttachmentSystem.js +3 -51
  19. package/engine/ecs/evaluation/world/ReadTerrainLayerWeightPointFitness.js +1 -1
  20. package/engine/ecs/fow/FogOfWarRevealerSystem.js +2 -2
  21. package/engine/ecs/team/Team.js +82 -0
  22. package/engine/ecs/terrain/ecs/ClingToTerrainSystem.js +2 -2
  23. package/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +112 -0
  24. package/engine/ecs/terrain/util/obtainTerrain.js +23 -0
  25. package/engine/ecs/tooltip/TooltipComponentSystem.js +1 -1
  26. package/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js +1 -1
  27. package/engine/graphics/ecs/water/WaterSystem.js +1 -1
  28. package/engine/graphics/ecs/water2/shader/testWaterShader.js +1 -1
  29. package/engine/graphics/geometry/AttributeSpec.d.ts +8 -0
  30. package/engine/graphics/geometry/VertexDataSpec.d.ts +15 -0
  31. package/engine/graphics/geometry/buffered/deinterleaveBufferAttribute.js +39 -0
  32. package/engine/graphics/geometry/buffered/deinterleaveBufferGeometry.js +50 -0
  33. package/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +1 -0
  34. package/engine/graphics/micron/MICRON_URI_FIELD.js +1 -0
  35. package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +10 -7
  36. package/engine/graphics/micron/convert_three_object_to_micron.js +17 -2
  37. package/engine/graphics/micron/format/MicronGeometry.d.ts +4 -0
  38. package/engine/graphics/micron/format/MicronGeometry.js +6 -0
  39. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +107 -6
  40. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +5 -3
  41. package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -2
  42. package/engine/graphics/render/webgpu/sample/MeshInstance.js +108 -0
  43. package/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +7 -3
  44. package/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +4 -3
  45. package/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +13 -6
  46. package/engine/graphics/render/webgpu/sample/main.js +83 -45
  47. package/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +5 -3
  48. package/engine/graphics/util/modelHitTest.js +63 -0
  49. package/engine/grid/systems/GridPosition2TransformSystem.js +1 -1
  50. package/engine/grid/systems/ViewportGridProjectionSystem.js +1 -1
  51. package/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  52. package/engine/scene/transitionToScene.js +1 -1
  53. package/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.js +1 -1
  54. package/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +1 -1
  55. package/generation/markers/debug/visualizeMarkers.js +1 -1
  56. package/generation/theme/ThemeEngine.js +1 -1
  57. package/package.json +1 -1
  58. package/samples/terrain/main.js +1 -1
  59. package/view/minimap/Minimap.js +1 -1
  60. package/engine/graphics/render/webgpu/sample/_main.ts +0 -650
@@ -0,0 +1,108 @@
1
+ import { array_copy } from "../../../../../core/collection/array/copyArray.js";
2
+
3
+ const BIND_GROUP_MATERIAL = 1;
4
+
5
+ export class MeshInstance {
6
+ constructor() {
7
+
8
+ /**
9
+ *
10
+ * @type {THREE.BufferGeometry|null}
11
+ */
12
+ this.geometry = null;
13
+
14
+ /**
15
+ *
16
+ * @type {null}
17
+ */
18
+ this.material = null;
19
+
20
+ /**
21
+ *
22
+ * @type {GPUBuffer|null}
23
+ */
24
+ this.vertex_buffer = null;
25
+
26
+ /**
27
+ *
28
+ * @type {GPUBuffer|null}
29
+ */
30
+ this.index_buffer = null;
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @param {GPUDevice} device
36
+ */
37
+ init(device) {
38
+ const mesh = this.geometry;
39
+
40
+ const kVertexStride = 8;
41
+ const attribute_position = mesh.getAttribute('position');
42
+ const vertexBuffer = device.createBuffer({
43
+ // position: vec3, normal: vec3, uv: vec2
44
+ size: attribute_position.array.length * kVertexStride * Float32Array.BYTES_PER_ELEMENT,
45
+ usage: GPUBufferUsage.VERTEX,
46
+ mappedAtCreation: true,
47
+ });
48
+
49
+ {
50
+ const mapping = new Float32Array(vertexBuffer.getMappedRange());
51
+
52
+ const attribute_normal = mesh.getAttribute('normal');
53
+ const attribute_uv = mesh.getAttribute('uv');
54
+
55
+ const vertex_count = attribute_position.count;
56
+
57
+ for (let i = 0; i < vertex_count; ++i) {
58
+ const address = kVertexStride * i;
59
+ array_copy(attribute_position.array, i * 3, mapping, address, 3);
60
+ array_copy(attribute_normal.array, i * 3, mapping, address + 3, 3);
61
+ array_copy(attribute_uv.array, i * 2, mapping, address + 6, 2);
62
+ }
63
+ vertexBuffer.unmap();
64
+ }
65
+
66
+ this.vertex_buffer = vertexBuffer;
67
+
68
+ const indexCount = mesh.getIndex().array.length;
69
+ const indexBuffer = device.createBuffer({
70
+ size: indexCount * Uint32Array.BYTES_PER_ELEMENT,
71
+ usage: GPUBufferUsage.INDEX,
72
+ mappedAtCreation: true,
73
+ });
74
+ {
75
+ const mapping = new Uint32Array(indexBuffer.getMappedRange());
76
+
77
+ mapping.set(mesh.getIndex().array);
78
+
79
+ indexBuffer.unmap();
80
+ }
81
+
82
+ this.index_buffer = indexBuffer;
83
+
84
+ }
85
+
86
+ /**
87
+ *
88
+ * @param {GPURenderPassEncoder} pass
89
+ */
90
+ preparePass(pass) {
91
+
92
+ }
93
+
94
+ /**
95
+ *
96
+ * @param {GPURenderPassEncoder} pass
97
+ */
98
+ draw(pass) {
99
+ // set material bindings
100
+
101
+ // pass.setBindGroup(BIND_GROUP_MATERIAL, {});
102
+
103
+ pass.setVertexBuffer(0, this.vertex_buffer);
104
+ pass.setIndexBuffer(this.index_buffer, 'uint32');
105
+
106
+ pass.drawIndexed(this.geometry.getIndex().array.length);
107
+ }
108
+ }
@@ -7,19 +7,23 @@ struct LightData {
7
7
  color : vec3<f32>;
8
8
  radius : f32;
9
9
  };
10
- [[block]] struct LightsBuffer {
10
+
11
+ struct LightsBuffer {
11
12
  lights: array<LightData>;
12
13
  };
14
+
13
15
  [[group(1), binding(0)]] var<storage, read> lightsBuffer: LightsBuffer;
14
16
 
15
- [[block]] struct Config {
17
+ struct Config {
16
18
  numLights : u32;
17
19
  };
20
+
18
21
  [[group(1), binding(1)]] var<uniform> config: Config;
19
22
 
20
- [[block]] struct CanvasConstants {
23
+ struct CanvasConstants {
21
24
  size: vec2<f32>;
22
25
  };
26
+
23
27
  [[group(2), binding(0)]] var<uniform> canvas : CanvasConstants;
24
28
 
25
29
  [[stage(fragment)]]
@@ -2,9 +2,10 @@
2
2
  [[group(0), binding(1)]] var gBufferNormal: texture_2d<f32>;
3
3
  [[group(0), binding(2)]] var gBufferAlbedo: texture_2d<f32>;
4
4
 
5
- [[block]] struct CanvasConstants {
5
+ struct CanvasConstants {
6
6
  size: vec2<f32>;
7
7
  };
8
+
8
9
  [[group(1), binding(0)]] var<uniform> canvas : CanvasConstants;
9
10
 
10
11
  [[stage(fragment)]]
@@ -18,7 +19,7 @@ fn main([[builtin(position)]] coord : vec4<f32>)
18
19
  vec2<i32>(floor(coord.xy)),
19
20
  0
20
21
  );
21
- } elseif (c.x < 0.66667) {
22
+ } else if (c.x < 0.66667) {
22
23
  result = textureLoad(
23
24
  gBufferNormal,
24
25
  vec2<i32>(floor(coord.xy)),
@@ -35,4 +36,4 @@ fn main([[builtin(position)]] coord : vec4<f32>)
35
36
  );
36
37
  }
37
38
  return result;
38
- }
39
+ }
@@ -3,20 +3,22 @@ struct LightData {
3
3
  color : vec3<f32>;
4
4
  radius : f32;
5
5
  };
6
- [[block]] struct LightsBuffer {
6
+ struct LightsBuffer {
7
7
  lights: array<LightData>;
8
8
  };
9
9
  [[group(0), binding(0)]] var<storage, read_write> lightsBuffer: LightsBuffer;
10
10
 
11
- [[block]] struct Config {
11
+ struct Config {
12
12
  numLights : u32;
13
13
  };
14
+
14
15
  [[group(0), binding(1)]] var<uniform> config: Config;
15
16
 
16
- [[block]] struct LightExtent {
17
+ struct LightExtent {
17
18
  min : vec4<f32>;
18
19
  max : vec4<f32>;
19
20
  };
21
+
20
22
  [[group(0), binding(2)]] var<uniform> lightExtent: LightExtent;
21
23
 
22
24
  [[stage(compute), workgroup_size(64, 1, 1)]]
@@ -26,9 +28,14 @@ fn main([[builtin(global_invocation_id)]] GlobalInvocationID : vec3<u32>) {
26
28
  return;
27
29
  }
28
30
 
29
- lightsBuffer.lights[index].position.y = lightsBuffer.lights[index].position.y - 0.5 - 0.003 * (f32(index) - 64.0 * floor(f32(index) / 64.0));
31
+ let light = &lightsBuffer.lights[index];
30
32
 
31
- if (lightsBuffer.lights[index].position.y < lightExtent.min.y) {
32
- lightsBuffer.lights[index].position.y = lightExtent.max.y;
33
+ (*light).position.y = (*light).position.y - 0.001 - 0.003 * (f32(index) - 64.0 * floor(f32(index) / 64.0));
34
+
35
+ if ((*light).position.y < lightExtent.min.y) {
36
+ (*light).position.y = lightExtent.max.y;
33
37
  }
38
+
39
+ // write out
40
+ // lightBuffer.lighs[index] = light;
34
41
  }
@@ -5,62 +5,95 @@ import fragmentWriteGBuffers from './fragmentWriteGBuffers.wgsl';
5
5
  import vertexTextureQuad from './vertexTextureQuad.wgsl';
6
6
  import fragmentGBuffersDebugView from './fragmentGBuffersDebugView.wgsl';
7
7
  import fragmentDeferredRendering from './fragmentDeferredRendering.wgsl';
8
- import { GUI } from "dat.gui";
8
+ import dat from "dat.gui";
9
+ import { PLYLoader } from "three/examples/jsm/loaders/PLYLoader.js";
10
+ import { noop } from "../../../../../core/function/Functions.js";
11
+ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
12
+ import { MeshInstance } from "./MeshInstance.js";
9
13
 
10
14
  const kMaxNumLights = 1024;
11
15
  const lightExtentMin = vec3.fromValues(-50, -30, -50);
12
16
  const lightExtentMax = vec3.fromValues(50, 50, 50);
13
- const mesh = [];
17
+
18
+ /**
19
+ *
20
+ * @param {string} path
21
+ * @return {Promise<THREE.BufferGeometry>}
22
+ */
23
+ function load_geometry(path) {
24
+ const loader = new PLYLoader();
25
+
26
+ return new Promise((resolve, reject) => {
27
+
28
+ loader.load(path, resolve, noop, reject);
29
+ });
30
+ }
31
+
32
+ function load_geometry_gltf(path) {
33
+ const loader = new GLTFLoader();
34
+
35
+ return new Promise((resolve, reject) => {
36
+ loader.load(path, (gltf) => {
37
+ let r = null;
38
+
39
+ gltf.scene.traverse(o => {
40
+ if (o.isMesh) {
41
+ r = o.geometry;
42
+ }
43
+ });
44
+
45
+ resolve(r);
46
+
47
+ }, noop, reject);
48
+ });
49
+ }
14
50
 
15
51
  const init = async ({ canvasRef, gui }) => {
52
+
53
+ // const mesh = await load_geometry("data/models/stanford/dragon_recon/dragon_vrip.ply");
54
+ const mesh = await load_geometry_gltf("data/models/stanford/DragonAttenuation.glb");
55
+
56
+
16
57
  const adapter = await navigator.gpu.requestAdapter();
17
58
  const device = await adapter.requestDevice();
18
- if (canvasRef.current === null)
59
+
60
+ /**
61
+ *
62
+ * @type {HTMLCanvasElement}
63
+ */
64
+ const canvas = canvasRef.current;
65
+
66
+ if (canvas === null) {
19
67
  return;
20
- const context = canvasRef.current.getContext('webgpu');
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @type {GPUCanvasContext}
73
+ */
74
+ const context = canvas.getContext('webgpu');
75
+
21
76
  const devicePixelRatio = window.devicePixelRatio || 1;
77
+
22
78
  const presentationSize = [
23
- canvasRef.current.clientWidth * devicePixelRatio,
24
- canvasRef.current.clientHeight * devicePixelRatio,
79
+ canvas.clientWidth * devicePixelRatio,
80
+ canvas.clientHeight * devicePixelRatio,
25
81
  ];
82
+
26
83
  const aspect = presentationSize[0] / presentationSize[1];
84
+
27
85
  const presentationFormat = context.getPreferredFormat(adapter);
86
+
28
87
  context.configure({
29
88
  device,
30
89
  format: presentationFormat,
31
90
  size: presentationSize,
32
91
  });
33
- // Create the model vertex buffer.
34
- const kVertexStride = 8;
35
- const vertexBuffer = device.createBuffer({
36
- // position: vec3, normal: vec3, uv: vec2
37
- size: mesh.positions.length * kVertexStride * Float32Array.BYTES_PER_ELEMENT,
38
- usage: GPUBufferUsage.VERTEX,
39
- mappedAtCreation: true,
40
- });
41
- {
42
- const mapping = new Float32Array(vertexBuffer.getMappedRange());
43
- for (let i = 0; i < mesh.positions.length; ++i) {
44
- mapping.set(mesh.positions[i], kVertexStride * i);
45
- mapping.set(mesh.normals[i], kVertexStride * i + 3);
46
- mapping.set(mesh.uvs[i], kVertexStride * i + 6);
47
- }
48
- vertexBuffer.unmap();
49
- }
50
- // Create the model index buffer.
51
- const indexCount = mesh.triangles.length * 3;
52
- const indexBuffer = device.createBuffer({
53
- size: indexCount * Uint16Array.BYTES_PER_ELEMENT,
54
- usage: GPUBufferUsage.INDEX,
55
- mappedAtCreation: true,
56
- });
57
- {
58
- const mapping = new Uint16Array(indexBuffer.getMappedRange());
59
- for (let i = 0; i < mesh.triangles.length; ++i) {
60
- mapping.set(mesh.triangles[i], 3 * i);
61
- }
62
- indexBuffer.unmap();
63
- }
92
+
93
+ const m_instance = new MeshInstance();
94
+ m_instance.geometry = mesh;
95
+ m_instance.init(device);
96
+
64
97
  // GBuffer texture render targets
65
98
  const gBufferTexture2DFloat = device.createTexture({
66
99
  size: [...presentationSize, 3],
@@ -290,7 +323,7 @@ const init = async ({ canvasRef, gui }) => {
290
323
  };
291
324
  const settings = {
292
325
  mode: 'rendering',
293
- numLights: 128,
326
+ numLights:1,
294
327
  };
295
328
  const configUniformBuffer = (() => {
296
329
  const buffer = device.createBuffer({
@@ -486,7 +519,7 @@ const init = async ({ canvasRef, gui }) => {
486
519
 
487
520
  // Rotates the camera around the origin based on time.
488
521
  function getCameraViewProjMatrix() {
489
- const eyePosition = vec3.fromValues(0, 50, -100);
522
+ const eyePosition = vec3.fromValues(0, 50, -10);
490
523
  const rad = Math.PI * (Date.now() / 5000);
491
524
  vec3.rotateY(eyePosition, eyePosition, origin, rad);
492
525
  const viewMatrix = mat4.create();
@@ -497,7 +530,7 @@ const init = async ({ canvasRef, gui }) => {
497
530
 
498
531
  function frame() {
499
532
  // Sample is no longer the active page.
500
- if (!canvasRef.current)
533
+ if (!canvas)
501
534
  return;
502
535
  const cameraViewProj = getCameraViewProjMatrix();
503
536
  device.queue.writeBuffer(cameraUniformBuffer, 0, cameraViewProj.buffer, cameraViewProj.byteOffset, cameraViewProj.byteLength);
@@ -507,9 +540,9 @@ const init = async ({ canvasRef, gui }) => {
507
540
  const gBufferPass = commandEncoder.beginRenderPass(writeGBufferPassDescriptor);
508
541
  gBufferPass.setPipeline(writeGBuffersPipeline);
509
542
  gBufferPass.setBindGroup(0, sceneUniformBindGroup);
510
- gBufferPass.setVertexBuffer(0, vertexBuffer);
511
- gBufferPass.setIndexBuffer(indexBuffer, 'uint16');
512
- gBufferPass.drawIndexed(indexCount);
543
+
544
+ m_instance.draw(gBufferPass);
545
+
513
546
  gBufferPass.endPass();
514
547
  }
515
548
  {
@@ -557,10 +590,15 @@ const init = async ({ canvasRef, gui }) => {
557
590
  };
558
591
 
559
592
  const canvas_el = document.createElement('canvas');
593
+ canvas_el.width = window.innerWidth;
594
+ canvas_el.height = window.innerHeight;
560
595
 
596
+ document.body.appendChild(canvas_el);
597
+
598
+ const gui = new dat.GUI();
561
599
  init({
562
600
  canvasRef: {
563
601
  current: canvas_el,
564
- gui: new GUI()
565
- }
602
+ },
603
+ gui: gui
566
604
  });
@@ -1,10 +1,12 @@
1
- [[block]] struct Uniforms {
1
+ struct Uniforms {
2
2
  modelMatrix : mat4x4<f32>;
3
3
  normalModelMatrix : mat4x4<f32>;
4
4
  };
5
- [[block]] struct Camera {
5
+
6
+ struct Camera {
6
7
  viewProjectionMatrix : mat4x4<f32>;
7
8
  };
9
+
8
10
  [[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
9
11
  [[group(0), binding(1)]] var<uniform> camera : Camera;
10
12
 
@@ -25,4 +27,4 @@ fn main([[location(0)]] position : vec3<f32>,
25
27
  output.fragNormal = normalize((uniforms.normalModelMatrix * vec4<f32>(normal, 1.0)).xyz);
26
28
  output.fragUV = uv;
27
29
  return output;
28
- }
30
+ }
@@ -0,0 +1,63 @@
1
+ import Vector2 from "../../../core/geom/Vector2.js";
2
+ import Mesh from "../ecs/mesh/Mesh.js";
3
+
4
+ const tempPoint = new Vector2();
5
+
6
+ /**
7
+ *
8
+ * @param {SurfacePoint3} result
9
+ * @param {Array.<Number>} entities
10
+ * @param {EntityComponentDataset} ecd
11
+ * @param {GraphicsEngine} ge
12
+ * @param {Number} x
13
+ * @param {Number} y
14
+ * @returns {Number} entity number or -1 in case of failed test
15
+ */
16
+ function modelHitTest(result, entities, ecd, ge, x, y) {
17
+ tempPoint.set(x, y);
18
+
19
+ ge.normalizeViewportPoint(tempPoint, tempPoint);
20
+
21
+ let i = 0;
22
+ const l = entities.length;
23
+
24
+ for (; i < l; i++) {
25
+
26
+ const entity = entities[i];
27
+
28
+ const model = ecd.getComponent(entity, Mesh);
29
+
30
+ if (model === null) {
31
+ //entity no longer exists most likely
32
+ continue;
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @type {Intersection[]}
38
+ */
39
+ const hits = ge.intersectObjectUnderViewportPoint(tempPoint.x, tempPoint.y, model.mesh, true);
40
+
41
+ // get hit
42
+
43
+
44
+ if (hits.length > 0) {
45
+ /**
46
+ *
47
+ * @type {Intersection}
48
+ */
49
+ const hit = hits[0];
50
+
51
+ result.position.copy(hit.point);
52
+
53
+ //TODO extract normal
54
+
55
+ return entity;
56
+ }
57
+
58
+ }
59
+
60
+ return -1;
61
+ }
62
+
63
+ export { modelHitTest };
@@ -6,8 +6,8 @@ import { Transform } from '../../ecs/transform/Transform.js';
6
6
  import GridPosition from '../components/GridPosition.js';
7
7
  import { GridPosition2Transform } from '../components/GridPosition2Transform.js';
8
8
  import Vector3 from "../../../core/geom/Vector3.js";
9
- import { obtainTerrain } from "../../../../model/game/scenes/SceneUtils.js";
10
9
  import { GridPosition2TransformFlags } from "../components/GridPosition2TransformFlags.js";
10
+ import { obtainTerrain } from "../../ecs/terrain/util/obtainTerrain.js";
11
11
 
12
12
 
13
13
  export class GridPosition2TransformSystem extends System {
@@ -5,9 +5,9 @@ import { System } from '../../ecs/System.js';
5
5
  import GeometryBVH from '../../ecs/components/GeometryBVH.js';
6
6
  import GridPosition from '../components/GridPosition.js';
7
7
  import ViewportGridProjection from '../components/ViewportGridProjection.js';
8
- import { obtainTerrain } from "../../../../model/game/scenes/SceneUtils.js";
9
8
  import Vector2 from "../../../core/geom/Vector2.js";
10
9
  import Vector3 from "../../../core/geom/Vector3.js";
10
+ import { obtainTerrain } from "../../ecs/terrain/util/obtainTerrain.js";
11
11
 
12
12
  class ViewportGridProjectionSystem extends System {
13
13
  constructor(grid, graphicsEngine) {
@@ -2,9 +2,9 @@ import { System } from "../../ecs/System.js";
2
2
  import { Transform2GridPosition } from "./Transform2GridPosition.js";
3
3
  import GridPosition from "../components/GridPosition.js";
4
4
  import { Transform } from "../../ecs/transform/Transform.js";
5
- import { obtainTerrain } from "../../../../model/game/scenes/SceneUtils.js";
6
5
  import Vector2 from "../../../core/geom/Vector2.js";
7
6
  import { Transform2GridPositionMode } from "./Transform2GridPositionMode.js";
7
+ import { obtainTerrain } from "../../ecs/terrain/util/obtainTerrain.js";
8
8
 
9
9
  const v2 = new Vector2();
10
10
 
@@ -1,11 +1,11 @@
1
1
  import { actionTask, delayTask, wrapTaskIgnoreFailure } from "../../core/process/task/TaskUtils.js";
2
- import { loadVisibleTerrainTiles } from "../../../model/game/scenes/SceneUtils.js";
3
2
  import TaskGroup from "../../core/process/task/TaskGroup.js";
4
3
  import Task from "../../core/process/task/Task.js";
5
4
  import TaskState from "../../core/process/task/TaskState.js";
6
5
  import { noop } from "../../core/function/Functions.js";
7
6
  import { compileAllMaterials } from "../graphics/ecs/compileAllMaterials.js";
8
7
  import { createTaskWaitForMeshesToLoad } from "../graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js";
8
+ import { loadVisibleTerrainTiles } from "../ecs/terrain/util/loadVisibleTerrainTiles.js";
9
9
 
10
10
 
11
11
  /**
@@ -2,9 +2,9 @@ import { lerp } from "../../../core/math/lerp.js";
2
2
  import { min2 } from "../../../core/math/min2.js";
3
3
  import { ContinuousGridCellAction } from "./ContinuousGridCellAction.js";
4
4
  import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
5
- import { obtainTerrain } from "../../../../model/game/scenes/SceneUtils.js";
6
5
  import { assert } from "../../../core/assert.js";
7
6
  import { CellFilterLiteralFloat } from "../../filtering/numeric/CellFilterLiteralFloat.js";
7
+ import { obtainTerrain } from "../../../engine/ecs/terrain/util/obtainTerrain.js";
8
8
 
9
9
  export class ContinuousGridCellActionSetTerrainHeight extends ContinuousGridCellAction {
10
10
  constructor() {
@@ -1,7 +1,7 @@
1
1
  import { MarkerNodeEntityProcessor } from "./MarkerNodeEntityProcessor.js";
2
- import { obtainTerrain } from "../../../../../model/game/scenes/SceneUtils.js";
3
2
  import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
4
3
  import { alignToVector } from "../../../../engine/ecs/terrain/ecs/ClingToTerrainSystem.js";
4
+ import { obtainTerrain } from "../../../../engine/ecs/terrain/util/obtainTerrain.js";
5
5
 
6
6
  const p = new SurfacePoint3();
7
7
 
@@ -11,13 +11,13 @@ import {
11
11
  import EntityBuilder from "../../../engine/ecs/EntityBuilder.js";
12
12
  import Renderable from "../../../engine/ecs/components/Renderable.js";
13
13
  import { Transform } from "../../../engine/ecs/transform/Transform.js";
14
- import { obtainTerrain } from "../../../../model/game/scenes/SceneUtils.js";
15
14
  import LabelView from "../../../view/common/LabelView.js";
16
15
  import GUIElement from "../../../engine/ecs/gui/GUIElement.js";
17
16
  import ViewportPosition from "../../../engine/ecs/gui/position/ViewportPosition.js";
18
17
  import HeadsUpDisplay from "../../../engine/ecs/gui/hud/HeadsUpDisplay.js";
19
18
  import Vector3 from "../../../core/geom/Vector3.js";
20
19
  import { MarkerNodeMatcherAny } from "../matcher/MarkerNodeMatcherAny.js";
20
+ import { obtainTerrain } from "../../../engine/ecs/terrain/util/obtainTerrain.js";
21
21
 
22
22
  function formatValue(v) {
23
23
 
@@ -1,6 +1,5 @@
1
1
  import { QuadTreeNode } from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
2
2
  import { assert } from "../../core/assert.js";
3
- import { obtainTerrain } from "../../../model/game/scenes/SceneUtils.js";
4
3
  import { seededRandom } from "../../core/math/random/seededRandom.js";
5
4
  import { TerrainLayerRuleAggregator } from "./TerrainLayerRuleAggregator.js";
6
5
  import { actionTask, countTask, emptyTask, futureTask } from "../../core/process/task/TaskUtils.js";
@@ -17,6 +16,7 @@ import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.j
17
16
  import { TerrainFlags } from "../../engine/ecs/terrain/ecs/TerrainFlags.js";
18
17
  import { binarySearchLowIndex } from "../../core/collection/array/binarySearchLowIndex.js";
19
18
  import { randomFloatBetween } from "../../core/math/random/randomFloatBetween.js";
19
+ import { obtainTerrain } from "../../engine/ecs/terrain/util/obtainTerrain.js";
20
20
 
21
21
  /**
22
22
  *
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.33.61",
8
+ "version": "2.33.65",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -2,11 +2,11 @@ import { EngineConfiguration } from "../../engine/EngineConfiguration.js";
2
2
  import { EngineHarness } from "../../engine/EngineHarness.js";
3
3
  import { GameAssetType } from "../../engine/asset/GameAssetType.js";
4
4
  import { TextureAssetLoader } from "../../engine/asset/loaders/texture/TextureAssetLoader.js";
5
- import { obtainTerrain } from "../../../model/game/scenes/SceneUtils.js";
6
5
  import { ImprovedNoise } from "three/examples/jsm/math/ImprovedNoise.js";
7
6
  import { lerp } from "../../core/math/lerp.js";
8
7
  import Vector2 from "../../core/geom/Vector2.js";
9
8
  import Vector3 from "../../core/geom/Vector3.js";
9
+ import { obtainTerrain } from "../../engine/ecs/terrain/util/obtainTerrain.js";
10
10
 
11
11
  const eh = new EngineHarness();
12
12
 
@@ -19,7 +19,7 @@ import { MinimapWorldGL } from "./gl/MinimapWorldGL.js";
19
19
  import { MinimapCameraView } from "./dom/MinimapCameraView.js";
20
20
  import { MinimapFogOfWar } from "./gl/MinimapFogOfWar.js";
21
21
  import { MinimapTerrainGL } from "./gl/MinimapTerrainGL.js";
22
- import { obtainTerrain } from "../../../model/game/scenes/SceneUtils.js";
22
+ import { obtainTerrain } from "../../engine/ecs/terrain/util/obtainTerrain.js";
23
23
 
24
24
 
25
25
  class MinimapView extends View {