@woosh/meep-engine 2.33.60 → 2.33.64

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 (89) hide show
  1. package/core/geom/3d/SurfacePoint3.js +44 -5
  2. package/core/geom/Vector2.d.ts +2 -0
  3. package/core/geom/packing/MaxRectangles.js +13 -4
  4. package/core/math/hash/murmur3_32.js +3 -3
  5. package/ecs/grid/pick.js +44 -0
  6. package/editor/actions/concrete/PaintTerrainOverlayAction.js +1 -1
  7. package/editor/process/ObstacleGridDisplayProcess.js +1 -1
  8. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
  9. package/editor/tools/FoliagePaintTool.js +1 -1
  10. package/editor/tools/GridPaintTool.js +2 -2
  11. package/editor/tools/paint/TerrainPaintTool.js +2 -2
  12. package/editor/tools/paint/TerrainTexturePaintTool.js +1 -1
  13. package/editor/view/EditorView.js +1 -1
  14. package/editor/view/GridPickCoordinateView.js +2 -2
  15. package/engine/asset/loaders/material/computeTextureHash.js +7 -13
  16. package/engine/ecs/animation/InverseKinematicsSystem.js +1 -1
  17. package/engine/ecs/attachment/AttachmentSystem.js +9 -56
  18. package/engine/ecs/evaluation/world/ReadTerrainLayerWeightPointFitness.js +1 -1
  19. package/engine/ecs/fow/FogOfWarRevealerSystem.js +2 -2
  20. package/engine/ecs/grid/HeightMap2NormalMap.js +1 -1
  21. package/engine/ecs/grid/NormalMap2AOMap.js +1 -1
  22. package/engine/ecs/gui/position/ViewportPositionSystem.js +5 -5
  23. package/engine/ecs/parent/EntityNode.d.ts +20 -0
  24. package/engine/ecs/parent/EntityNode.js +284 -0
  25. package/engine/ecs/parent/FaceEditor.js +137 -0
  26. package/engine/ecs/parent/testCompositionEntityNode.js +153 -0
  27. package/engine/ecs/parent/testHuDPerf.js +123 -0
  28. package/engine/ecs/team/Team.js +82 -0
  29. package/engine/ecs/terrain/ecs/ClingToTerrainSystem.js +2 -2
  30. package/engine/ecs/terrain/ecs/Terrain.js +14 -5
  31. package/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +112 -0
  32. package/engine/ecs/terrain/util/obtainTerrain.js +23 -0
  33. package/engine/ecs/tooltip/TooltipComponentSystem.js +1 -1
  34. package/engine/graphics/GraphicsEngine.js +1 -2
  35. package/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
  36. package/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js +1 -1
  37. package/engine/graphics/ecs/light/LightSystem.js +1 -1
  38. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +29 -0
  39. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +158 -1
  40. package/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
  41. package/engine/graphics/ecs/water/WaterSystem.js +1 -1
  42. package/engine/graphics/ecs/water2/shader/testWaterShader.js +1 -1
  43. package/engine/graphics/geometry/AttributeSpec.d.ts +8 -0
  44. package/engine/graphics/geometry/VertexDataSpec.d.ts +15 -0
  45. package/engine/graphics/geometry/buffered/deinterleaveBufferAttribute.js +39 -0
  46. package/engine/graphics/geometry/buffered/deinterleaveBufferGeometry.js +50 -0
  47. package/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +55 -11
  48. package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +10 -7
  49. package/engine/graphics/micron/format/MicronGeometry.d.ts +4 -0
  50. package/engine/graphics/micron/render/v1/MaterialContext.js +1 -0
  51. package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +19 -3
  52. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -4
  53. package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
  54. package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -4
  55. package/engine/graphics/render/frame_graph/FrameGraphBuilder.js +36 -0
  56. package/engine/graphics/render/frame_graph/IRenderContext.js +8 -0
  57. package/engine/graphics/render/frame_graph/RenderPass.js +32 -0
  58. package/engine/graphics/render/frame_graph/RenderPassFlags.js +6 -0
  59. package/engine/graphics/render/frame_graph/RenderPassResources.js +15 -0
  60. package/engine/graphics/render/frame_graph/Resource.js +21 -0
  61. package/engine/graphics/render/frame_graph/ResourceReference.js +14 -0
  62. package/engine/graphics/render/frame_graph/TextureDescriptor.js +30 -0
  63. package/engine/graphics/render/frame_graph/UsageModeType.js +5 -0
  64. package/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js +27 -0
  65. package/engine/graphics/render/frame_graph/sample/deferred/PresentPass.js +17 -0
  66. package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
  67. package/engine/graphics/render/webgpu/sample/MeshInstance.js +108 -0
  68. package/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +71 -0
  69. package/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +39 -0
  70. package/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +21 -0
  71. package/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +41 -0
  72. package/engine/graphics/render/webgpu/sample/main.js +604 -0
  73. package/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +9 -0
  74. package/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +30 -0
  75. package/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  76. package/engine/{ecs/grid → graphics/texture/sampler}/sampler2DToFloat32Texture.js +1 -1
  77. package/engine/graphics/util/modelHitTest.js +63 -0
  78. package/engine/grid/systems/GridPosition2TransformSystem.js +1 -1
  79. package/engine/grid/systems/ViewportGridProjectionSystem.js +1 -1
  80. package/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  81. package/engine/scene/transitionToScene.js +1 -1
  82. package/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.js +1 -1
  83. package/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +1 -1
  84. package/generation/markers/debug/visualizeMarkers.js +1 -1
  85. package/generation/theme/ThemeEngine.js +1 -1
  86. package/package.json +1 -1
  87. package/samples/terrain/main.js +117 -0
  88. package/view/minimap/Minimap.js +1 -1
  89. package/engine/ecs/sockets/AttachmentSocketsSystem.js +0 -10
@@ -0,0 +1,50 @@
1
+ import { BufferGeometry } from "three";
2
+ import { deinterleaveBufferAttribute } from "./deinterleaveBufferAttribute.js";
3
+
4
+ /**
5
+ *
6
+ * @param {THREE.BufferGeometry} geometry
7
+ * @returns {THREE.BufferGeometry}
8
+ */
9
+ export function deinterleaveBufferGeometry(geometry) {
10
+ const result = new BufferGeometry();
11
+
12
+ if (geometry.getIndex() !== null) {
13
+ result.setIndex(deinterleaveBufferAttribute(geometry.getIndex()));
14
+ }
15
+
16
+ for (const attribute_key in geometry.attributes) {
17
+ const source_attribute = geometry.attributes[attribute_key];
18
+
19
+ result.setAttribute(attribute_key, deinterleaveBufferAttribute(source_attribute));
20
+ }
21
+
22
+ // copy other bits
23
+ result.name = geometry.name;
24
+
25
+ result.morphTargetsRelative = geometry.morphTargetsRelative;
26
+
27
+ for (const attribute_key in geometry.morphAttributes) {
28
+ const source_attributes = geometry.morphAttributes[attribute_key];
29
+
30
+ const result_attributes = [];
31
+
32
+ result.morphAttributes[attribute_key] = result_attributes;
33
+
34
+ for (let i = 0; i < source_attributes.length; i++) {
35
+ const source_attribute = source_attributes[i];
36
+ result_attributes[i] = deinterleaveBufferAttribute(source_attribute);
37
+ }
38
+ }
39
+
40
+ result.groups = geometry.groups.slice();
41
+
42
+
43
+ result.boundingBox = geometry.boundingBox !== null ? geometry.boundingBox.clone() : null;
44
+ result.boundingSphere = geometry.boundingSphere !== null ? geometry.boundingSphere.clone() : null;
45
+ result.drawRange.start = geometry.drawRange.start;
46
+ result.drawRange.count = geometry.drawRange.count;
47
+ result.userData = JSON.parse(JSON.stringify(geometry.userData));
48
+
49
+ return result;
50
+ }
@@ -2,6 +2,7 @@ import { Cache } from "../../../../../core/cache/Cache.js";
2
2
  import { buildUnsorted } from "../../bvh/buffered/BinaryBVHFromBufferGeometry.js";
3
3
  import { ClippingPlaneContainmentComputingVisitor } from "./ClippingPlaneContainmentComputingVisitor.js";
4
4
  import { RaycastNearestHitComputingVisitor } from "./RaycastNearestHitComputingVisitor.js";
5
+ import { assert } from "../../../../../core/assert.js";
5
6
 
6
7
  export class GeometrySpatialQueryAccelerator {
7
8
  constructor(cache_size = 100 * 1024 * 1024) {
@@ -38,6 +39,8 @@ export class GeometrySpatialQueryAccelerator {
38
39
  * @returns {number} -1,0,1. -1 means fully outside, 0 means partially inside, 1 means fully inside
39
40
  */
40
41
  queryContainmentViaClippingPlanes(geometry, planes) {
42
+ assert.notNull(geometry, 'geometry');
43
+ assert.defined(geometry, 'geometry');
41
44
 
42
45
  const bvh = this.__acquireBVH(geometry);
43
46
 
@@ -53,14 +56,25 @@ export class GeometrySpatialQueryAccelerator {
53
56
  }
54
57
 
55
58
  /**
56
- * Get the nearest ray intersection
59
+ *
57
60
  * @param {SurfacePoint3} destination
58
61
  * @param {THREE.BufferGeometry} geometry
59
- * @param {Vector3} ray_origin
60
- * @param {Vector3} ray_direction
61
- * @returns {boolean} true if hit detected, false otherwise
62
+ * @param {number} ray_origin_x
63
+ * @param {number} ray_origin_y
64
+ * @param {number} ray_origin_z
65
+ * @param {number} ray_direction_x
66
+ * @param {number} ray_direction_y
67
+ * @param {number} ray_direction_z
68
+ * @return {boolean}
62
69
  */
63
- queryRaycastNearest(destination, geometry, ray_origin, ray_direction) {
70
+ queryRaycastNearest_primitive(
71
+ destination,
72
+ geometry,
73
+ ray_origin_x, ray_origin_y, ray_origin_z,
74
+ ray_direction_x, ray_direction_y, ray_direction_z
75
+ ) {
76
+ assert.notNull(geometry, 'geometry');
77
+ assert.defined(geometry, 'geometry');
64
78
 
65
79
  const bvh = this.__acquireBVH(geometry);
66
80
 
@@ -69,12 +83,12 @@ export class GeometrySpatialQueryAccelerator {
69
83
  this.__visitor_raycast.setGeometry(geometry);
70
84
  this.__visitor_raycast.setRoot(bvh);
71
85
  this.__visitor_raycast.setRay(
72
- ray_origin.x,
73
- ray_origin.y,
74
- ray_origin.z,
75
- ray_direction.x,
76
- ray_direction.y,
77
- ray_direction.z
86
+ ray_origin_x,
87
+ ray_origin_y,
88
+ ray_origin_z,
89
+ ray_direction_x,
90
+ ray_direction_y,
91
+ ray_direction_z
78
92
  );
79
93
 
80
94
  bvh.traversePreOrderStack(this.__visitor_raycast, 0);
@@ -87,6 +101,27 @@ export class GeometrySpatialQueryAccelerator {
87
101
  } else {
88
102
  return false;
89
103
  }
104
+ }
105
+
106
+ /**
107
+ * Get the nearest ray intersection
108
+ * @param {SurfacePoint3} destination
109
+ * @param {THREE.BufferGeometry} geometry
110
+ * @param {Vector3} ray_origin
111
+ * @param {Vector3} ray_direction
112
+ * @returns {boolean} true if hit detected, false otherwise
113
+ */
114
+ queryRaycastNearest(destination, geometry, ray_origin, ray_direction) {
115
+
116
+ return this.queryRaycastNearest_primitive(
117
+ destination, geometry,
118
+ ray_origin.x,
119
+ ray_origin.y,
120
+ ray_origin.z,
121
+ ray_direction.x,
122
+ ray_direction.y,
123
+ ray_direction.z
124
+ );
90
125
 
91
126
  }
92
127
 
@@ -96,6 +131,9 @@ export class GeometrySpatialQueryAccelerator {
96
131
  * @returns {IndexedBinaryBVH}
97
132
  */
98
133
  __acquireBVH(geometry) {
134
+ assert.notNull(geometry, 'geometry');
135
+ assert.defined(geometry, 'geometry');
136
+
99
137
  const existing = this.cache.get(geometry);
100
138
 
101
139
  if (existing !== null) {
@@ -122,3 +160,9 @@ export class GeometrySpatialQueryAccelerator {
122
160
  }
123
161
 
124
162
  }
163
+
164
+ /**
165
+ * @readonly
166
+ * @type {GeometrySpatialQueryAccelerator}
167
+ */
168
+ GeometrySpatialQueryAccelerator.INSTANCE = new GeometrySpatialQueryAccelerator();
@@ -12,6 +12,7 @@ import { expandConnectivityByLocality } from "../../../../core/geom/3d/topology/
12
12
  import { build_geometry_info } from "./build_geometry_info.js";
13
13
  import { build_leaf_patches_metis } from "./clustering/build_leaf_patches_metis.js";
14
14
  import { compute_buffer_geometry_byte_size } from "../../geometry/buffered/compute_buffer_geometry_byte_size.js";
15
+ import { deinterleaveBufferGeometry } from "../../geometry/buffered/deinterleaveBufferGeometry.js";
15
16
 
16
17
  /**
17
18
  * Returns current time in milliseconds
@@ -105,11 +106,13 @@ const PRINT_VERBOSE_STATS = false;
105
106
  * @returns {MicronGeometry}
106
107
  */
107
108
  export async function buildMicronGeometryFromBufferGeometry(input) {
109
+ const source_geometry = deinterleaveBufferGeometry(input);
110
+
108
111
  // build topology representation
109
112
  const topoMesh = new TopoMesh();
110
113
 
111
- const position_attribute = input.getAttribute("position");
112
- const index_attribute = input.index;
114
+ const position_attribute = source_geometry.getAttribute("position");
115
+ const index_attribute = source_geometry.index;
113
116
 
114
117
  const face_index_array = index_attribute.array;
115
118
  const vertex_position_array = position_attribute.array;
@@ -183,18 +186,18 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
183
186
 
184
187
  const r = new MicronGeometry();
185
188
 
186
- r.proxy = input; // TODO use r.buildProxy(1) instead
189
+ r.proxy = source_geometry; // TODO use r.buildProxy(1) instead
187
190
 
188
191
  r.source_triangle_count = index_attribute.count / 3;
189
- r.source_vertex_count = input.getAttribute('position').count;
190
- r.source_byte_size = compute_buffer_geometry_byte_size(input);
192
+ r.source_vertex_count = source_geometry.getAttribute('position').count;
193
+ r.source_byte_size = compute_buffer_geometry_byte_size(source_geometry);
191
194
 
192
195
  // console.time('build geometry');
193
196
 
194
- const vertex_attributes = attributes_from_buffer_geometry(input);
197
+ const vertex_attributes = attributes_from_buffer_geometry(source_geometry);
195
198
 
196
199
  r.vertex_spec.setAttributes(vertex_attributes);
197
- r.root = compilePatchGraph(root, input, r.vertex_spec);
200
+ r.root = compilePatchGraph(root, source_geometry, r.vertex_spec);
198
201
 
199
202
  r.initialize();
200
203
 
@@ -1,5 +1,9 @@
1
1
  import {BufferGeometry} from "three";
2
+ import {VertexDataSpec} from "../../geometry/VertexDataSpec";
2
3
 
3
4
  export class MicronGeometry {
5
+ vertex_spec: VertexDataSpec
4
6
  public proxy: BufferGeometry
7
+
8
+ initialize(): void
5
9
  }
@@ -82,6 +82,7 @@ export class MaterialContext {
82
82
 
83
83
  if (material[MATERIAL_FLAG] === undefined) {
84
84
  material.onBeforeCompile = composeCompile(this.material.onBeforeCompile, rewrite_material);
85
+ material.needsUpdate = true;
85
86
 
86
87
  material[MATERIAL_FLAG] = true;
87
88
  material[MATERIAL_VERTEX_DISPLACED] = true;
@@ -10,11 +10,26 @@ import {
10
10
  } from "../emitter/PARTICLE_ATTRIBUTES.js";
11
11
  import { update_parameters } from "./update_parameters.js";
12
12
 
13
- const velocity = [];
14
- const position = [];
13
+ /**
14
+ * Common buffer for better memory layout
15
+ * @type {ArrayBuffer}
16
+ */
17
+ const scratch_common_buffer = new ArrayBuffer(4 * 3 * 2);
18
+ /**
19
+ *
20
+ * @type {Float32Array|number[]|vec3}
21
+ */
22
+ const velocity = new Float32Array(scratch_common_buffer, 0, 3);
23
+
24
+ /**
25
+ *
26
+ * @type {Float32Array|number[]|vec3}
27
+ */
28
+ const position = new Float32Array(scratch_common_buffer, 3 * 4, 3);
15
29
 
16
30
  export class SimulationStepFixedPhysics extends AbstractSimulationStep {
17
31
  execute() {
32
+ let i = 0;
18
33
  const particles = this.particles;
19
34
  const timeDelta = this.timeDelta;
20
35
 
@@ -31,7 +46,7 @@ export class SimulationStepFixedPhysics extends AbstractSimulationStep {
31
46
  */
32
47
  const layers = emitter.layers.asArray();
33
48
 
34
- for (let i = 0; i < liveParticleCount; i++) {
49
+ for (; i < liveParticleCount; i++) {
35
50
 
36
51
  const layer_position = particles.readAttributeScalar(i, PARTICLE_ATTRIBUTE_LAYER_POSITION);
37
52
 
@@ -70,6 +85,7 @@ export class SimulationStepFixedPhysics extends AbstractSimulationStep {
70
85
 
71
86
  particles.readAttributeVector3(i, PARTICLE_ATTRIBUTE_POSITION, position);
72
87
 
88
+ // Verlet integration
73
89
  const p_x = position[0] + velocity[0] * timeDelta;
74
90
  const p_y = position[1] + velocity[1] * timeDelta;
75
91
  const p_z = position[2] + velocity[2] * timeDelta;
@@ -3,7 +3,6 @@ import { EngineConfiguration } from "../../../../../../EngineConfiguration.js";
3
3
  import GUIElementSystem from "../../../../../../ecs/gui/GUIElementSystem.js";
4
4
  import HeadsUpDisplaySystem from "../../../../../../ecs/gui/hud/HeadsUpDisplaySystem.js";
5
5
  import TagSystem from "../../../../../../ecs/systems/TagSystem.js";
6
- import { AttachmentSocketsSystem } from "../../../../../../ecs/sockets/AttachmentSocketsSystem.js";
7
6
  import { AttachmentSystem } from "../../../../../../ecs/attachment/AttachmentSystem.js";
8
7
  import { SoundEmitterSystem } from "../../../../../../sound/ecs/emitter/SoundEmitterSystem.js";
9
8
  import SoundControllerSystem from "../../../../../../sound/ecs/SoundControllerSystem.js";
@@ -43,8 +42,6 @@ import { RepeatBehavior } from "../../../../../../intelligence/behavior/decorato
43
42
  import { ActionBehavior } from "../../../../../../intelligence/behavior/primitive/ActionBehavior.js";
44
43
  import { pingpong } from "../../../../../../../core/math/pingpong.js";
45
44
  import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
46
- import { pick } from "../../../../../../../../model/game/util/ScreenGridPicker.js";
47
- import { obtainTerrain } from "../../../../../../../../model/game/scenes/SceneUtils.js";
48
45
  import GUIElement from "../../../../../../ecs/gui/GUIElement.js";
49
46
  import EmptyView from "../../../../../../../view/elements/EmptyView.js";
50
47
  import HeadsUpDisplay from "../../../../../../ecs/gui/hud/HeadsUpDisplay.js";
@@ -78,6 +75,8 @@ import { UnitSphereShape3D } from "../../../../../../../core/geom/3d/shape/UnitS
78
75
  import TopDownCameraController from "../../../../../ecs/camera/topdown/TopDownCameraController.js";
79
76
  import { randomFloatBetween } from "../../../../../../../core/math/random/randomFloatBetween.js";
80
77
  import { MicronRenderPlugin } from "../../../../../micron/plugin/MicronRenderPlugin.js";
78
+ import { obtainTerrain } from "../../../../../../ecs/terrain/util/obtainTerrain.js";
79
+ import { pick } from "../../../../../../../ecs/grid/pick.js";
81
80
 
82
81
  const engineHarness = new EngineHarness();
83
82
 
@@ -99,7 +98,6 @@ function makeConfig(engine) {
99
98
 
100
99
  config.systems.push(
101
100
  new TagSystem(),
102
- new AttachmentSocketsSystem(),
103
101
  new AttachmentSystem(),
104
102
  new SoundEmitterSystem(assetManager, sound.destination, sound.context),
105
103
  new SoundControllerSystem(),
@@ -8,7 +8,6 @@ import PathFollowingSystem from "../../../../navigation/ecs/path_following/PathF
8
8
  import SteeringSystem from "../../../../ecs/systems/SteeringSystem.js";
9
9
  import MotionSystem from "../../../../ecs/systems/MotionSystem.js";
10
10
  import TagSystem from "../../../../ecs/systems/TagSystem.js";
11
- import { AttachmentSocketsSystem } from "../../../../ecs/sockets/AttachmentSocketsSystem.js";
12
11
  import { AttachmentSystem } from "../../../../ecs/attachment/AttachmentSystem.js";
13
12
  import { SoundEmitterSystem } from "../../../../sound/ecs/emitter/SoundEmitterSystem.js";
14
13
  import SoundControllerSystem from "../../../../sound/ecs/SoundControllerSystem.js";
@@ -93,7 +92,6 @@ function makeConfig(engine) {
93
92
  new SteeringSystem(),
94
93
  new MotionSystem(),
95
94
  new TagSystem(),
96
- new AttachmentSocketsSystem(),
97
95
  new AttachmentSystem(),
98
96
  new SoundEmitterSystem(assetManager, sound.destination, sound.context),
99
97
  new SoundControllerSystem(),
@@ -9,7 +9,6 @@ import PathFollowingSystem from "../../../../navigation/ecs/path_following/PathF
9
9
  import SteeringSystem from "../../../../ecs/systems/SteeringSystem.js";
10
10
  import MotionSystem from "../../../../ecs/systems/MotionSystem.js";
11
11
  import TagSystem from "../../../../ecs/systems/TagSystem.js";
12
- import { AttachmentSocketsSystem } from "../../../../ecs/sockets/AttachmentSocketsSystem.js";
13
12
  import { AttachmentSystem } from "../../../../ecs/attachment/AttachmentSystem.js";
14
13
  import { SoundEmitterSystem } from "../../../../sound/ecs/emitter/SoundEmitterSystem.js";
15
14
  import SoundControllerSystem from "../../../../sound/ecs/SoundControllerSystem.js";
@@ -70,7 +69,6 @@ import Renderable from "../../../../ecs/components/Renderable.js";
70
69
  import { makeHelperSphereGeometry } from "../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
71
70
  import TopDownCameraController from "../../../ecs/camera/topdown/TopDownCameraController.js";
72
71
  import ThreeFactory from "../../../three/ThreeFactory.js";
73
- import { obtainTerrain } from "../../../../../../model/game/scenes/SceneUtils.js";
74
72
  import { JsonAssetLoader } from "../../../../asset/loaders/JsonAssetLoader.js";
75
73
  import { TextureAssetLoader } from "../../../../asset/loaders/texture/TextureAssetLoader.js";
76
74
  import { GameAssetType } from "../../../../asset/GameAssetType.js";
@@ -82,8 +80,9 @@ import { ParticleEmitterSystem } from "../../../particles/ecs/ParticleEmitterSys
82
80
  import { ShadedGeometrySystem } from "../../../ecs/mesh-v2/ShadedGeometrySystem.js";
83
81
  import { FogOfWar } from "../../../../ecs/fow/FogOfWar.js";
84
82
  import { FogOfWarRevealer } from "../../../../ecs/fow/FogOfWarRevealer.js";
85
- import Team from "../../../../../../model/game/ecs/component/Team.js";
83
+ import Team from "../../../../ecs/team/Team.js";
86
84
  import { AmbientOcclusionPostProcessEffect } from "../../buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
85
+ import { obtainTerrain } from "../../../../ecs/terrain/util/obtainTerrain.js";
87
86
 
88
87
  const geo_light_center_octahedron = new BoxBufferGeometry(0.1, 0.1, 0.1);
89
88
  const engineHarness = new EngineHarness();
@@ -120,7 +119,6 @@ function makeConfig(engine) {
120
119
  new SteeringSystem(),
121
120
  new MotionSystem(),
122
121
  new TagSystem(),
123
- new AttachmentSocketsSystem(),
124
122
  new AttachmentSystem(),
125
123
  new SoundEmitterSystem(assetManager, sound.destination, sound.context),
126
124
  new SoundControllerSystem(),
@@ -0,0 +1,36 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+
3
+ export class FrameGraphBuilder {
4
+ /**
5
+ *
6
+ * @param {TextureDescriptor} descriptor
7
+ * @returns {Resource}
8
+ */
9
+ createTexture(descriptor) {
10
+ throw new Error('Not Implemented');
11
+ }
12
+
13
+ /**
14
+ *
15
+ * @param {Resource} resource
16
+ * @param {number} flags
17
+ * @returns {ResourceReference}
18
+ */
19
+ read(resource, flags) {
20
+ assert.equal(resource.isResource, true, 'resource.isResource !== true');
21
+
22
+ throw new Error('Not Implemented');
23
+ }
24
+
25
+ /**
26
+ *
27
+ * @param {Resource} resource
28
+ * @param {number} flags
29
+ * @returns {ResourceReference}
30
+ */
31
+ write(resource, flags) {
32
+ assert.equal(resource.isResource, true, 'resource.isResource !== true');
33
+
34
+ throw new Error('Not Implemented');
35
+ }
36
+ }
@@ -0,0 +1,8 @@
1
+ //
2
+
3
+ /**
4
+ * Abstracts rendering context, such as "WebGLRenderer" in THREE.js or WebGL/WebGPU
5
+ */
6
+ export class IRenderContext {
7
+ //TODO implement
8
+ }
@@ -0,0 +1,32 @@
1
+ const DEFAULT_FLAGS = 0;
2
+
3
+ export class RenderPass {
4
+
5
+ constructor() {
6
+ this.ref_count = 0;
7
+ /**
8
+ *
9
+ * @type {number|RenderPassFlags}
10
+ */
11
+ this.flags = DEFAULT_FLAGS;
12
+ }
13
+
14
+ /**
15
+ *
16
+ * @param {FrameGraphBuilder} builder
17
+ * @param {Object<Resource>} inputs
18
+ * @returns {Object<Resource>}
19
+ */
20
+ setup(builder, inputs) {
21
+ throw new Error('Not Implemented');
22
+ }
23
+
24
+ /**
25
+ *
26
+ * @param {RenderPassResources} resources
27
+ * @param {IRenderContext} render_context
28
+ */
29
+ execute(resources, render_context) {
30
+ throw new Error('Not Implemented');
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ export const RenderPassFlags = {
2
+ /**
3
+ * Render pass hidden effects, accessing data from outside
4
+ */
5
+ HasSideEffects: 1
6
+ };
@@ -0,0 +1,15 @@
1
+ //
2
+
3
+ /**
4
+ * Built by FrameGraphBuilder, maps abstract resource handles to concrete, allocated GPU resources
5
+ */
6
+ export class RenderPassResources {
7
+ /**
8
+ *
9
+ * @param {Resource} resource
10
+ * @returns {Texture}
11
+ */
12
+ getTexture(resource) {
13
+ throw new Error('Not Implemented');
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ export class Resource {
2
+ constructor() {
3
+ /**
4
+ *
5
+ * @type {number}
6
+ */
7
+ this.ref_count = 0;
8
+
9
+ /**
10
+ *
11
+ * @type {TextureDescriptor}
12
+ */
13
+ this.descriptor = null;
14
+ }
15
+ }
16
+
17
+ /**
18
+ * @readonly
19
+ * @type {boolean}
20
+ */
21
+ Resource.prototype.isResource = true;
@@ -0,0 +1,14 @@
1
+ export class ResourceReference {
2
+ constructor() {
3
+ /**
4
+ *
5
+ * @type {Resource|null}
6
+ */
7
+ this.resource = null;
8
+ /**
9
+ *
10
+ * @type {number|UsageModeType}
11
+ */
12
+ this.usage = 0;
13
+ }
14
+ }
@@ -0,0 +1,30 @@
1
+ import { FloatType } from "three";
2
+
3
+ const TextureInitialState = {
4
+ /**
5
+ * Clear the texture.
6
+ */
7
+ Clear: 0,
8
+ /**
9
+ * Doesn't matter. No need to clear
10
+ */
11
+ Undefined: 1
12
+ };
13
+
14
+ export class TextureDescriptor {
15
+ constructor() {
16
+ this.height = 0;
17
+ this.width = 0;
18
+ /**
19
+ * Render texture type
20
+ * @type {number}
21
+ */
22
+ this.format = FloatType;
23
+
24
+ /**
25
+ * What should the texture be initialized to
26
+ * @type {number}
27
+ */
28
+ this.initialState = TextureInitialState.Clear;
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ export const UsageModeType = {
2
+ Read: 1,
3
+ Write: 2,
4
+ Create: 4
5
+ }
@@ -0,0 +1,27 @@
1
+ import { RenderPass } from "../../RenderPass.js";
2
+ import { TextureDescriptor } from "../../TextureDescriptor.js";
3
+
4
+ export class GBufferDrawPass extends RenderPass {
5
+ setup(builder, inputs) {
6
+ // ignore inputs
7
+
8
+ const out_albedo = new TextureDescriptor();
9
+ const res_albedo = builder.createTexture(out_albedo);
10
+
11
+ const out_normal = new TextureDescriptor();
12
+ const res_normal = builder.createTexture(out_normal);
13
+
14
+ const out_depth = new TextureDescriptor();
15
+ const res_depth = builder.createTexture(out_depth);
16
+
17
+ return {
18
+ albedo: res_albedo,
19
+ normal: res_normal,
20
+ depth: res_depth
21
+ };
22
+ }
23
+
24
+ execute(resources, render_context) {
25
+
26
+ }
27
+ }
@@ -0,0 +1,17 @@
1
+ import { RenderPass } from "../../RenderPass.js";
2
+
3
+ export class PresentPass extends RenderPass {
4
+ /**
5
+ *
6
+ * @param builder
7
+ * @param {Resource} data
8
+ * @return {{data: ResourceReference}}
9
+ */
10
+ setup(builder, { data }) {
11
+ const input_ref = builder.read(data, 0);
12
+
13
+ return {
14
+ data: input_ref
15
+ };
16
+ }
17
+ }
@@ -8,7 +8,6 @@ import PathFollowingSystem from "../../../../navigation/ecs/path_following/PathF
8
8
  import SteeringSystem from "../../../../ecs/systems/SteeringSystem.js";
9
9
  import MotionSystem from "../../../../ecs/systems/MotionSystem.js";
10
10
  import TagSystem from "../../../../ecs/systems/TagSystem.js";
11
- import { AttachmentSocketsSystem } from "../../../../ecs/sockets/AttachmentSocketsSystem.js";
12
11
  import { AttachmentSystem } from "../../../../ecs/attachment/AttachmentSystem.js";
13
12
  import { SoundEmitterSystem } from "../../../../sound/ecs/emitter/SoundEmitterSystem.js";
14
13
  import SoundControllerSystem from "../../../../sound/ecs/SoundControllerSystem.js";
@@ -97,7 +96,6 @@ function makeConfig(engine) {
97
96
  new SteeringSystem(),
98
97
  new MotionSystem(),
99
98
  new TagSystem(),
100
- new AttachmentSocketsSystem(),
101
99
  new AttachmentSystem(),
102
100
  new SoundEmitterSystem(assetManager, sound.destination, sound.context),
103
101
  new SoundControllerSystem(),