@woosh/meep-engine 2.165.4 → 2.165.6

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 (179) hide show
  1. package/editor/Editor.d.ts +65 -65
  2. package/editor/SelectionVisualizer.d.ts +19 -19
  3. package/editor/actions/concrete/ActionUpdateTexture.d.ts +11 -11
  4. package/editor/actions/concrete/ArrayCopyAction.d.ts +19 -19
  5. package/editor/actions/concrete/ComponentAddAction.d.ts +14 -14
  6. package/editor/actions/concrete/ComponentRemoveAction.d.ts +10 -10
  7. package/editor/actions/concrete/EntityCreateAction.d.ts +17 -17
  8. package/editor/actions/concrete/EntityRemoveAction.d.ts +10 -10
  9. package/editor/actions/concrete/ModifyPatchSampler2DAction.d.ts +46 -46
  10. package/editor/actions/concrete/ModifyPatchTextureArray2DAction.d.ts +37 -37
  11. package/editor/actions/concrete/PaintTerrainOverlayAction.d.ts +22 -22
  12. package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +18 -18
  13. package/editor/actions/concrete/SelectionAddAction.d.ts +18 -18
  14. package/editor/actions/concrete/SelectionClearAction.d.ts +8 -8
  15. package/editor/actions/concrete/SelectionRemoveAction.d.ts +9 -9
  16. package/editor/actions/concrete/TransformModifyAction.d.ts +16 -16
  17. package/editor/actions/concrete/WriteGridValueAction.d.ts +14 -14
  18. package/editor/ecs/EditorEntity.d.ts +15 -15
  19. package/editor/ecs/EditorEntitySystem.d.ts +7 -7
  20. package/editor/ecs/component/FieldDescriptor.d.ts +26 -26
  21. package/editor/ecs/component/FieldValueAdapter.d.ts +6 -6
  22. package/editor/ecs/component/TypeEditor.d.ts +24 -24
  23. package/editor/ecs/component/createFieldEditor.d.ts +8 -8
  24. package/editor/ecs/component/createObjectEditor.d.ts +13 -13
  25. package/editor/ecs/component/editors/ColorEditor.d.ts +6 -6
  26. package/editor/ecs/component/editors/HTMLElementEditor.d.ts +6 -6
  27. package/editor/ecs/component/editors/ImagePathEditor.d.ts +6 -6
  28. package/editor/ecs/component/editors/LargeStringEditor.d.ts +15 -15
  29. package/editor/ecs/component/editors/NumericIntervalEditor.d.ts +6 -6
  30. package/editor/ecs/component/editors/ObservedBooleanEditor.d.ts +6 -6
  31. package/editor/ecs/component/editors/ObservedEnumEditor.d.ts +6 -6
  32. package/editor/ecs/component/editors/ObservedIntegerEditor.d.ts +6 -6
  33. package/editor/ecs/component/editors/ObservedStringEditor.d.ts +6 -6
  34. package/editor/ecs/component/editors/Sampler2DEditor.d.ts +6 -6
  35. package/editor/ecs/component/editors/collection/ListEditor.d.ts +7 -7
  36. package/editor/ecs/component/editors/common/BitFlagsEditor.d.ts +11 -11
  37. package/editor/ecs/component/editors/common/EnumEditor.d.ts +7 -7
  38. package/editor/ecs/component/editors/common/makeV3_editor.d.ts +14 -14
  39. package/editor/ecs/component/editors/common/noEditor.d.ts +2 -2
  40. package/editor/ecs/component/editors/ecs/GridObstacleEditor.d.ts +6 -6
  41. package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.d.ts +13 -13
  42. package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.d.ts +66 -66
  43. package/editor/ecs/component/editors/ecs/ParameterTrackEditor.d.ts +11 -11
  44. package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.d.ts +13 -13
  45. package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.d.ts +51 -51
  46. package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.d.ts +47 -47
  47. package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.d.ts +15 -15
  48. package/editor/ecs/component/editors/ecs/Trail2DEditor.d.ts +29 -29
  49. package/editor/ecs/component/editors/ecs/TransformEditor.d.ts +19 -19
  50. package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.d.ts +18 -18
  51. package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.d.ts +38 -38
  52. package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.d.ts +15 -15
  53. package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.d.ts +18 -18
  54. package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.d.ts +17 -17
  55. package/editor/ecs/component/editors/geom/QuaternionEditor.d.ts +5 -5
  56. package/editor/ecs/component/editors/geom/Vector1Editor.d.ts +6 -6
  57. package/editor/ecs/component/editors/geom/Vector2Editor.d.ts +5 -5
  58. package/editor/ecs/component/editors/geom/Vector3Editor.d.ts +5 -5
  59. package/editor/ecs/component/editors/geom/Vector4Editor.d.ts +5 -5
  60. package/editor/ecs/component/editors/primitive/ArrayEditor.d.ts +7 -7
  61. package/editor/ecs/component/editors/primitive/BooleanEditor.d.ts +6 -6
  62. package/editor/ecs/component/editors/primitive/FunctionEditor.d.ts +6 -6
  63. package/editor/ecs/component/editors/primitive/NumberEditor.d.ts +7 -7
  64. package/editor/ecs/component/editors/primitive/ObjectEditor.d.ts +5 -5
  65. package/editor/ecs/component/editors/primitive/StringEditor.d.ts +6 -6
  66. package/editor/ecs/component/editors/three/BufferGeometryEditor.d.ts +6 -6
  67. package/editor/ecs/component/editors/three/MaterialEditor.d.ts +6 -6
  68. package/editor/ecs/component/editors/three/MeshEditor.d.ts +6 -6
  69. package/editor/ecs/component/editors/three/TextureEditor.d.ts +6 -6
  70. package/editor/ecs/component/findNearestRegisteredType.d.ts +7 -7
  71. package/editor/enableEditor.d.ts +13 -13
  72. package/editor/library/MeshLibrary.d.ts +12 -12
  73. package/editor/process/DisableGameUIProcess.d.ts +7 -7
  74. package/editor/process/EditorProcess.d.ts +18 -18
  75. package/editor/process/ObstacleGridDisplayProcess.d.ts +12 -12
  76. package/editor/process/ProcessEngine.d.ts +29 -29
  77. package/editor/process/SymbolicDisplayProcess.d.ts +18 -18
  78. package/editor/process/symbolic/ComponentSymbolicDisplay.d.ts +10 -10
  79. package/editor/process/symbolic/SymbolicDisplayInternalAPI.d.ts +64 -64
  80. package/editor/process/symbolic/buildThreeJSHelperEntity.d.ts +8 -8
  81. package/editor/process/symbolic/make3DSymbolicDisplay.d.ts +9 -9
  82. package/editor/process/symbolic/makeCameraSymbolicDisplay.d.ts +6 -6
  83. package/editor/process/symbolic/makeGridPositionSymbolDisplay.d.ts +5 -5
  84. package/editor/process/symbolic/makeHelperBoxGeometry.d.ts +2 -2
  85. package/editor/process/symbolic/makeHelperSphereGeometry.d.ts +8 -8
  86. package/editor/process/symbolic/makeLightSymbolicDisplay.d.ts +6 -6
  87. package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.d.ts +5 -5
  88. package/editor/process/symbolic/makePathSymbolicDisplay.d.ts +6 -6
  89. package/editor/process/symbolic/makePositionedIconDisplaySymbol.d.ts +8 -8
  90. package/editor/process/symbolic/makeSocketsSymbolicDisplay.d.ts +6 -6
  91. package/editor/process/symbolic/makeSolidArrowGeometry.d.ts +25 -25
  92. package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.d.ts +5 -5
  93. package/editor/process/symbolic/synchronizeTransform.d.ts +11 -11
  94. package/editor/tools/GridPaintTool.d.ts +16 -16
  95. package/editor/tools/SelectionTool.d.ts +26 -26
  96. package/editor/tools/TopDownCameraControlTool.d.ts +12 -12
  97. package/editor/tools/engine/Tool.d.ts +63 -63
  98. package/editor/tools/engine/ToolEngine.d.ts +22 -22
  99. package/editor/tools/engine/ToolState.d.ts +6 -6
  100. package/editor/tools/paint/TerrainHeightPaintTool.d.ts +17 -17
  101. package/editor/tools/paint/TerrainPaintTool.d.ts +30 -30
  102. package/editor/tools/paint/TerrainTexturePaintTool.d.ts +17 -17
  103. package/editor/tools/v2/TransformMode.d.ts +6 -6
  104. package/editor/view/EditorView.d.ts +38 -38
  105. package/editor/view/ecs/ComponentControlFactory.d.ts +18 -18
  106. package/editor/view/ecs/ComponentControlView.d.ts +23 -23
  107. package/editor/view/ecs/EntityEditor.d.ts +29 -29
  108. package/editor/view/ecs/EntityList.d.ts +21 -21
  109. package/editor/view/ecs/HierarchicalEntityListView.d.ts +7 -7
  110. package/editor/view/ecs/components/DatGuiController.d.ts +45 -45
  111. package/editor/view/ecs/components/GridObstacleController.d.ts +13 -13
  112. package/editor/view/ecs/components/color/GaugeView.d.ts +12 -12
  113. package/editor/view/ecs/components/common/AutoCanvasView.d.ts +19 -19
  114. package/editor/view/ecs/components/common/LineView.d.ts +11 -11
  115. package/editor/view/ecs/components/common/NumberController.d.ts +17 -17
  116. package/editor/view/ecs/components/particles/ColorParameterLUTController.d.ts +13 -13
  117. package/editor/view/makeEntityDecorators.d.ts +5 -5
  118. package/editor/view/tools/ToolSettingsView.d.ts +10 -10
  119. package/editor/view/tools/ToolView.d.ts +12 -12
  120. package/editor/view/v2/SplitView.d.ts +16 -16
  121. package/package.json +1 -1
  122. package/samples/generation/grid/GridTags.d.ts +15 -15
  123. package/samples/generation/grid/MirGridLayers.d.ts +7 -7
  124. package/samples/generation/rules/matcher_tag_occupied.d.ts +2 -2
  125. package/samples/generation/rules/matcher_tag_traversable.d.ts +2 -2
  126. package/samples/generation/rules/matcher_tag_unoccupied.d.ts +2 -2
  127. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts.map +1 -1
  128. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +65 -12
  129. package/src/engine/ecs/gui/hud/testHudEdgeStick.d.ts +2 -0
  130. package/src/engine/ecs/gui/hud/testHudEdgeStick.d.ts.map +1 -0
  131. package/src/engine/ecs/gui/hud/testHudEdgeStick.js +134 -0
  132. package/src/engine/ecs/gui/position/ViewportPositionSystem.d.ts.map +1 -1
  133. package/src/engine/ecs/gui/position/ViewportPositionSystem.js +44 -23
  134. package/src/engine/graphics/ecs/light/LightContext.d.ts +8 -0
  135. package/src/engine/graphics/ecs/light/LightContext.d.ts.map +1 -1
  136. package/src/engine/graphics/ecs/light/LightContext.js +33 -3
  137. package/src/engine/graphics/ecs/light/LightSystem.d.ts.map +1 -1
  138. package/src/engine/graphics/ecs/light/LightSystem.js +13 -6
  139. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts +12 -0
  140. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
  141. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +184 -6
  142. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +24 -1
  143. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
  144. package/src/engine/graphics/ecs/trail3d/Trail3D.js +43 -0
  145. package/src/engine/graphics/ecs/trail3d/Trail3DFlags.d.ts +1 -0
  146. package/src/engine/graphics/ecs/trail3d/Trail3DFlags.js +9 -1
  147. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
  148. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +4 -0
  149. package/src/engine/graphics/ecs/trail3d/prototypeTrail3D.js +22 -1
  150. package/src/engine/graphics/render/buffer/simple-fx/ao/SAOShader.js +381 -362
  151. package/src/engine/graphics/render/forward_plus/LightManager.d.ts +5 -0
  152. package/src/engine/graphics/render/forward_plus/LightManager.d.ts.map +1 -1
  153. package/src/engine/graphics/render/forward_plus/LightManager.js +11 -0
  154. package/src/engine/graphics/render/forward_plus/model/AbstractLight.d.ts +16 -1
  155. package/src/engine/graphics/render/forward_plus/model/AbstractLight.d.ts.map +1 -1
  156. package/src/engine/graphics/render/forward_plus/model/AbstractLight.js +22 -1
  157. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +7 -0
  158. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
  159. package/src/engine/graphics/render/forward_plus/model/Decal.js +11 -0
  160. package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts +2 -0
  161. package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts.map +1 -1
  162. package/src/engine/graphics/render/forward_plus/model/PointLight.js +10 -0
  163. package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts +2 -0
  164. package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts.map +1 -1
  165. package/src/engine/graphics/render/forward_plus/model/SpotLight.js +12 -0
  166. package/src/engine/graphics/shadows/ShadowMapRenderer.d.ts +10 -0
  167. package/src/engine/graphics/shadows/ShadowMapRenderer.d.ts.map +1 -1
  168. package/src/engine/graphics/shadows/ShadowMapRenderer.js +83 -10
  169. package/src/engine/graphics/shadows/testPointShadowMapRendering.d.ts +2 -0
  170. package/src/engine/graphics/shadows/testPointShadowMapRendering.d.ts.map +1 -0
  171. package/src/engine/graphics/shadows/testPointShadowMapRendering.js +242 -0
  172. package/src/engine/graphics/trail/tube/TubeMaterialX.d.ts +8 -1
  173. package/src/engine/graphics/trail/tube/TubeMaterialX.d.ts.map +1 -1
  174. package/src/engine/graphics/trail/tube/TubeMaterialX.js +111 -15
  175. package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts +9 -2
  176. package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts.map +1 -1
  177. package/src/engine/graphics/trail/tube/TubeXMaterialSpec.js +15 -4
  178. package/src/engine/graphics/trail/tube/TubeXPlugin.d.ts.map +1 -1
  179. package/src/engine/graphics/trail/tube/TubeXPlugin.js +7 -1
@@ -1,20 +1,20 @@
1
- /**
2
- * Automatically tracks size on the screen, including that computed from CSS and - re-renders content when size changes
3
- * @extends View
4
- */
5
- export class AutoCanvasView {
6
- constructor({ classList }?: {
7
- classList?: any[];
8
- });
9
- __sizeObserver: DomSizeObserver;
10
- render(): void;
11
- /**
12
- *
13
- * @param {CanvasRenderingContext2D} ctx
14
- * @param {number} width
15
- * @param {number} height
16
- */
17
- draw(ctx: CanvasRenderingContext2D, width: number, height: number): void;
18
- }
19
- import { DomSizeObserver } from "../../../../../src/view/util/DomSizeObserver.js";
1
+ /**
2
+ * Automatically tracks size on the screen, including that computed from CSS and - re-renders content when size changes
3
+ * @extends View
4
+ */
5
+ export class AutoCanvasView {
6
+ constructor({ classList }?: {
7
+ classList?: any[];
8
+ });
9
+ __sizeObserver: DomSizeObserver;
10
+ render(): void;
11
+ /**
12
+ *
13
+ * @param {CanvasRenderingContext2D} ctx
14
+ * @param {number} width
15
+ * @param {number} height
16
+ */
17
+ draw(ctx: CanvasRenderingContext2D, width: number, height: number): void;
18
+ }
19
+ import { DomSizeObserver } from "../../../../../src/view/util/DomSizeObserver.js";
20
20
  //# sourceMappingURL=AutoCanvasView.d.ts.map
@@ -1,12 +1,12 @@
1
- /**
2
- * @extends {View}
3
- */
4
- export class LineView extends View<HTMLElement> {
5
- constructor({ elements, classList }: {
6
- elements?: any[];
7
- classList?: any[];
8
- });
9
- el: HTMLDivElement;
10
- }
11
- import View from "../../../../../src/view/View.js";
1
+ /**
2
+ * @extends {View}
3
+ */
4
+ export class LineView extends View<HTMLElement> {
5
+ constructor({ elements, classList }: {
6
+ elements?: any[];
7
+ classList?: any[];
8
+ });
9
+ el: HTMLDivElement;
10
+ }
11
+ import View from "../../../../../src/view/View.js";
12
12
  //# sourceMappingURL=LineView.d.ts.map
@@ -1,18 +1,18 @@
1
- export class NumberController extends View<HTMLElement> {
2
- /**
3
- *
4
- * @param {string[]} [classList]
5
- * @param {number} [value]
6
- * @param figures
7
- */
8
- constructor({ classList, value, figures }?: string[]);
9
- /**
10
- *
11
- * @type {Vector1}
12
- */
13
- value: Vector1;
14
- el: HTMLInputElement;
15
- }
16
- import View from "../../../../../src/view/View.js";
17
- import Vector1 from "../../../../../src/core/geom/Vector1.js";
1
+ export class NumberController extends View<HTMLElement> {
2
+ /**
3
+ *
4
+ * @param {string[]} [classList]
5
+ * @param {number} [value]
6
+ * @param figures
7
+ */
8
+ constructor({ classList, value, figures }?: string[]);
9
+ /**
10
+ *
11
+ * @type {Vector1}
12
+ */
13
+ value: Vector1;
14
+ el: HTMLInputElement;
15
+ }
16
+ import View from "../../../../../src/view/View.js";
17
+ import Vector1 from "../../../../../src/core/geom/Vector1.js";
18
18
  //# sourceMappingURL=NumberController.d.ts.map
@@ -1,14 +1,14 @@
1
- /**
2
- *
3
- * @param {CanvasRenderingContext2D} context
4
- * @param {number} width
5
- * @param {number} height
6
- * @param {number}cellSize
7
- * @param {string} color1
8
- * @param {string} color2
9
- */
10
- export function drawCheckers(context: CanvasRenderingContext2D, width: number, height: number, cellSize: number, color1: string, color2: string): void;
11
- export class ColorParameterLUTController extends GuiControl {
12
- }
13
- import GuiControl from "../../../../../src/view/controller/controls/GuiControl.js";
1
+ /**
2
+ *
3
+ * @param {CanvasRenderingContext2D} context
4
+ * @param {number} width
5
+ * @param {number} height
6
+ * @param {number}cellSize
7
+ * @param {string} color1
8
+ * @param {string} color2
9
+ */
10
+ export function drawCheckers(context: CanvasRenderingContext2D, width: number, height: number, cellSize: number, color1: string, color2: string): void;
11
+ export class ColorParameterLUTController extends GuiControl {
12
+ }
13
+ import GuiControl from "../../../../../src/view/controller/controls/GuiControl.js";
14
14
  //# sourceMappingURL=ColorParameterLUTController.d.ts.map
@@ -1,6 +1,6 @@
1
- /**
2
- *
3
- * @return {(function(entity:number, ecd:EntityComponentDataset, view:View):void)[]}
4
- */
5
- export function makeEntityDecorators(): ((arg0: entity) => number);
1
+ /**
2
+ *
3
+ * @return {(function(entity:number, ecd:EntityComponentDataset, view:View):void)[]}
4
+ */
5
+ export function makeEntityDecorators(): ((arg0: entity) => number);
6
6
  //# sourceMappingURL=makeEntityDecorators.d.ts.map
@@ -1,11 +1,11 @@
1
- export default ToolSettingsView;
2
- declare class ToolSettingsView extends View<HTMLElement> {
3
- constructor(tool: any);
4
- model: any;
5
- gui: any;
6
- el: any;
7
- setTool(tool: any): void;
8
- build(): void;
9
- }
10
- import View from "../../../src/view/View.js";
1
+ export default ToolSettingsView;
2
+ declare class ToolSettingsView extends View<HTMLElement> {
3
+ constructor(tool: any);
4
+ model: any;
5
+ gui: any;
6
+ el: any;
7
+ setTool(tool: any): void;
8
+ build(): void;
9
+ }
10
+ import View from "../../../src/view/View.js";
11
11
  //# sourceMappingURL=ToolSettingsView.d.ts.map
@@ -1,13 +1,13 @@
1
- export default ToolView;
2
- declare class ToolView extends View<HTMLElement> {
3
- /**
4
- *
5
- * @param {Tool} tool
6
- * @param {Editor} editor
7
- * @constructor
8
- */
9
- constructor({ tool, editor }: Tool);
10
- el: Element;
11
- }
12
- import View from "../../../src/view/View.js";
1
+ export default ToolView;
2
+ declare class ToolView extends View<HTMLElement> {
3
+ /**
4
+ *
5
+ * @param {Tool} tool
6
+ * @param {Editor} editor
7
+ * @constructor
8
+ */
9
+ constructor({ tool, editor }: Tool);
10
+ el: Element;
11
+ }
12
+ import View from "../../../src/view/View.js";
13
13
  //# sourceMappingURL=ToolView.d.ts.map
@@ -1,17 +1,17 @@
1
- export class SplitView extends EmptyView {
2
- static from({ a, b, type, fraction }: {
3
- a: any;
4
- b: any;
5
- type?: string;
6
- fraction?: number;
7
- }): SplitView;
8
- constructor();
9
- set fraction(arg: any);
10
- set direction(arg: any);
11
- set childA(arg: any);
12
- set childB(arg: any);
13
- layout(): void;
14
- #private;
15
- }
16
- import EmptyView from "../../../src/view/elements/EmptyView.js";
1
+ export class SplitView extends EmptyView {
2
+ static from({ a, b, type, fraction }: {
3
+ a: any;
4
+ b: any;
5
+ type?: string;
6
+ fraction?: number;
7
+ }): SplitView;
8
+ constructor();
9
+ set fraction(arg: any);
10
+ set direction(arg: any);
11
+ set childA(arg: any);
12
+ set childB(arg: any);
13
+ layout(): void;
14
+ #private;
15
+ }
16
+ import EmptyView from "../../../src/view/elements/EmptyView.js";
17
17
  //# sourceMappingURL=SplitView.d.ts.map
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "2.165.4",
9
+ "version": "2.165.6",
10
10
  "main": "build/meep.module.js",
11
11
  "module": "build/meep.module.js",
12
12
  "exports": {
@@ -1,16 +1,16 @@
1
- /**
2
- * Tags
3
- */
4
- export type GridTags = number;
5
- export namespace GridTags {
6
- let Traversable: number;
7
- let Enemy: number;
8
- let Base: number;
9
- let Treasure: number;
10
- let StartingPoint: number;
11
- let Occupied: number;
12
- let Road: number;
13
- let PlayArea: number;
14
- let Objective: number;
15
- }
1
+ /**
2
+ * Tags
3
+ */
4
+ export type GridTags = number;
5
+ export namespace GridTags {
6
+ let Traversable: number;
7
+ let Enemy: number;
8
+ let Base: number;
9
+ let Treasure: number;
10
+ let StartingPoint: number;
11
+ let Occupied: number;
12
+ let Road: number;
13
+ let PlayArea: number;
14
+ let Objective: number;
15
+ }
16
16
  //# sourceMappingURL=GridTags.d.ts.map
@@ -1,8 +1,8 @@
1
- export namespace MirGridLayers {
2
- let Tags: string;
3
- let DistanceFromStart: string;
4
- let DistanceFromPlayArea: string;
5
- let Heights: string;
6
- let Moisture: string;
7
- }
1
+ export namespace MirGridLayers {
2
+ let Tags: string;
3
+ let DistanceFromStart: string;
4
+ let DistanceFromPlayArea: string;
5
+ let Heights: string;
6
+ let Moisture: string;
7
+ }
8
8
  //# sourceMappingURL=MirGridLayers.d.ts.map
@@ -1,3 +1,3 @@
1
- export const matcher_tag_occupied: CellMatcherLayerBitMaskTest;
2
- import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
1
+ export const matcher_tag_occupied: CellMatcherLayerBitMaskTest;
2
+ import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
3
3
  //# sourceMappingURL=matcher_tag_occupied.d.ts.map
@@ -1,3 +1,3 @@
1
- export const matcher_tag_traversable: CellMatcherLayerBitMaskTest;
2
- import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
1
+ export const matcher_tag_traversable: CellMatcherLayerBitMaskTest;
2
+ import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
3
3
  //# sourceMappingURL=matcher_tag_traversable.d.ts.map
@@ -1,3 +1,3 @@
1
- export const matcher_tag_unoccupied: CellMatcherNot;
2
- import { CellMatcherNot } from "../../../src/generation/rules/logic/CellMatcherNot.js";
1
+ export const matcher_tag_unoccupied: CellMatcherNot;
2
+ import { CellMatcherNot } from "../../../src/generation/rules/logic/CellMatcherNot.js";
3
3
  //# sourceMappingURL=matcher_tag_unoccupied.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeadsUpDisplaySystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js"],"names":[],"mappings":";AAeA;;;;;GAKG;AACH;IASI;;;OAGG;IACH,4BAFW,cAAc,EAqBxB;IA/BD,wCAAgC;IAGhC,2HAGE;IAaE,yBAA8B;IAM9B;;;;OAIG;IACH,+BAAiD;IAGrD,iCAGC;IAED,gCAIC;IAED;;;;;;;OAOG;IACH,sCAwGC;IAED,6BAsBC;CACJ;uBAtMsB,iBAAiB;2BAIb,qBAAqB;uBAFzB,kBAAkB;4CALG,uDAAuD;6BAMtE,iCAAiC;+BAL/B,qCAAqC"}
1
+ {"version":3,"file":"HeadsUpDisplaySystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js"],"names":[],"mappings":";AAeA;;;;;GAKG;AACH;IASI;;;OAGG;IACH,4BAFW,cAAc,EAqBxB;IA/BD,wCAAgC;IAGhC,2HAGE;IAaE,yBAA8B;IAM9B;;;;OAIG;IACH,+BAAiD;IAGrD,iCAGC;IAED,gCAIC;IAED;;;;;;;OAOG;IACH,sCA6JC;IAED,6BAsBC;CACJ;uBA3PsB,iBAAiB;2BAIb,qBAAqB;uBAFzB,kBAAkB;4CALG,uDAAuD;6BAMtE,iCAAiC;+BAL/B,qCAAqC"}
@@ -118,26 +118,79 @@ class HeadsUpDisplaySystem extends System {
118
118
  const worldPositionY = y;
119
119
  const worldPositionZ = z;
120
120
 
121
- // Convert the [-1, 1] screen coordinate into a world coordinate on the near plane
122
-
123
- // apply projection matrix
121
+ // project world position into clip space
124
122
  const _x = projection[0] * x + projection[4] * y + projection[8] * z + projection[12];
125
123
  const _y = projection[1] * x + projection[5] * y + projection[9] * z + projection[13];
126
124
  const _z = projection[2] * x + projection[6] * y + projection[10] * z + projection[14];
127
125
  const _w = projection[3] * x + projection[7] * y + projection[11] * z + projection[15];
128
126
 
129
- // apply perspective transform
130
- const d = 1 / Math.abs(_w);
131
- x = _x * d;
132
- y = _y * d;
133
- z = _z * d;
127
+ let ndcX;
128
+ let ndcY;
129
+ let trackedPositionOutOfBounds;
134
130
 
135
- const ndcX = (x + 1) / 2;
136
- const ndcY = (1 - y) / 2;
131
+ if (_w > 0) {
132
+ // point is in front of the camera plane, apply perspective transform
133
+ const d = 1 / _w;
137
134
 
138
- vp.position.set(ndcX, ndcY);
135
+ x = _x * d;
136
+ y = _y * d;
137
+ z = _z * d;
138
+
139
+ trackedPositionOutOfBounds = z > 1 || z < -1;
140
+
141
+ let dx = x * 0.5;
142
+ let dy = y * -0.5;
143
+
144
+ /*
145
+ Near the camera plane the projected position grows without bound while carrying no more
146
+ information than its direction from the viewport center. Cap it to the boundary of a doubled
147
+ viewport rect: edge-stick placement depends only on that direction, and unbounded coordinates
148
+ wreck float precision downstream (element extents cancel to zero next to values around 1e15).
149
+ */
150
+ const m = Math.max(Math.abs(dx), Math.abs(dy));
151
+
152
+ if (m > 1) {
153
+ const s = 1 / m;
154
+
155
+ dx *= s;
156
+ dy *= s;
157
+ }
158
+
159
+ ndcX = 0.5 + dx;
160
+ ndcY = 0.5 + dy;
161
+ } else {
162
+ /*
163
+ Point is on or behind the camera plane. Perspective division inverts through the projection
164
+ center, which would place the point on the opposite side of the screen from where it actually is.
165
+ Only the direction from the viewport center remains meaningful: clip-space (_x, -_y), the limit of
166
+ the in-front projection as a point approaches the camera plane.
139
167
 
140
- const trackedPositionOutOfBounds = z > 1 || z < -1;
168
+ Push the position out along that direction to the boundary of a doubled viewport rect. That is
169
+ guaranteed to be off-screen, letting stick-to-edge placement resolve it to the correct point on
170
+ the screen edge; without stick-to-edge the element is hidden anyway.
171
+ */
172
+ trackedPositionOutOfBounds = true;
173
+
174
+ let dx = _x;
175
+ let dy = -_y;
176
+
177
+ const m = Math.max(Math.abs(dx), Math.abs(dy));
178
+
179
+ if (m > 0) {
180
+ const s = 1 / m;
181
+
182
+ dx *= s;
183
+ dy *= s;
184
+ } else {
185
+ // point lies exactly on the camera's view axis, direction is undefined; push down
186
+ dy = 1;
187
+ }
188
+
189
+ ndcX = 0.5 + dx;
190
+ ndcY = 0.5 + dy;
191
+ }
192
+
193
+ vp.position.set(ndcX, ndcY);
141
194
 
142
195
  const visible = (!trackedPositionOutOfBounds || vp.stickToScreenEdge) && this.__visibility_predicate.test(worldPositionX, worldPositionY, worldPositionZ);
143
196
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=testHudEdgeStick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testHudEdgeStick.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/hud/testHudEdgeStick.js"],"names":[],"mappings":""}
@@ -0,0 +1,134 @@
1
+ import { EngineHarness } from "../../../EngineHarness.js";
2
+ import Entity from "../../Entity.js";
3
+ import { Transform } from "../../transform/Transform.js";
4
+ import EmptyView from "../../../../view/elements/EmptyView.js";
5
+ import GUIElement from "../GUIElement.js";
6
+ import GUIElementSystem from "../GUIElementSystem.js";
7
+ import ViewportPosition from "../position/ViewportPosition.js";
8
+ import ViewportPositionSystem from "../position/ViewportPositionSystem.js";
9
+ import HeadsUpDisplay from "./HeadsUpDisplay.js";
10
+ import HeadsUpDisplaySystem from "./HeadsUpDisplaySystem.js";
11
+ import { EngineConfiguration } from "../../../EngineConfiguration.js";
12
+ import { AttachmentSystem } from "../../attachment/AttachmentSystem.js";
13
+ import { CameraSystem } from "../../../graphics/ecs/camera/CameraSystem.js";
14
+ import TopDownCameraController from "../../../graphics/ecs/camera/topdown/TopDownCameraController.js";
15
+
16
+ const eh = new EngineHarness();
17
+
18
+ /**
19
+ *
20
+ * @param {Engine} engine
21
+ * @return {EngineConfiguration}
22
+ */
23
+ function makeConfig(engine) {
24
+ const r = new EngineConfiguration();
25
+
26
+ r.addSystem(new AttachmentSystem());
27
+ r.addSystem(new HeadsUpDisplaySystem(engine.graphics));
28
+ r.addSystem(new ViewportPositionSystem(engine.gameView.size));
29
+ r.addSystem(new GUIElementSystem(engine.gui.view, engine));
30
+
31
+ return r;
32
+ }
33
+
34
+ const RING_RADIUS = 25;
35
+ const BADGE_COUNT = 12;
36
+
37
+ /**
38
+ *
39
+ * @param {Engine} engine
40
+ */
41
+ async function main(engine) {
42
+
43
+ await EngineHarness.buildBasics({
44
+ engine,
45
+ enableWater: false,
46
+ enableShadows: false,
47
+ pitch: 0.7,
48
+ distance: 10
49
+ });
50
+
51
+ // highlight stuck badges
52
+ const style = document.createElement('style');
53
+ style.textContent = `
54
+ .hud-edge-stick-badge {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ font: bold 12px sans-serif;
59
+ color: white;
60
+ border-radius: 50%;
61
+ border: 2px solid white;
62
+ box-sizing: border-box;
63
+ }
64
+ .hud-edge-stick-badge.hud-system-sticky-flag {
65
+ border-color: black;
66
+ }
67
+ `;
68
+ document.head.appendChild(style);
69
+
70
+ const ecd = engine.entityManager.dataset;
71
+
72
+ const tracked = [];
73
+
74
+ for (let i = 0; i < BADGE_COUNT; i++) {
75
+ const angle = (i / BADGE_COUNT) * Math.PI * 2;
76
+
77
+ const x = 5 + Math.cos(angle) * RING_RADIUS;
78
+ const z = 5 + Math.sin(angle) * RING_RADIUS;
79
+
80
+ const view = new EmptyView({
81
+ classList: ['hud-edge-stick-badge'],
82
+ css: {
83
+ background: `hsl(${(i / BADGE_COUNT) * 360}, 80%, 45%)`
84
+ }
85
+ });
86
+
87
+ view.size.set(28, 28);
88
+ view.el.textContent = String(i);
89
+
90
+ const transform = new Transform();
91
+ transform.position.set(x, 0.5, z);
92
+
93
+ const vp = new ViewportPosition();
94
+ vp.anchor.set(0.5, 0.5);
95
+ vp.stickToScreenEdge = true;
96
+ vp.screenEdgeWidth = 8;
97
+
98
+ const entity = new Entity()
99
+ .add(transform)
100
+ .add(new HeadsUpDisplay())
101
+ .add(vp)
102
+ .add(GUIElement.fromView(view))
103
+ .build(ecd);
104
+
105
+ tracked.push({ entity, transform, vp, view, index: i });
106
+ }
107
+
108
+ const active_camera = CameraSystem.getFirstActiveCamera(ecd);
109
+ const controller = ecd.getComponent(active_camera.entity, TopDownCameraController);
110
+
111
+ window.__hud_edge_stick_test = {
112
+ engine,
113
+ ecd,
114
+ tracked,
115
+ camera: active_camera.component,
116
+ controller
117
+ };
118
+ }
119
+
120
+ /**
121
+ *
122
+ * @param {EngineHarness} harness
123
+ */
124
+ async function init(harness) {
125
+ const engine = eh.engine;
126
+
127
+ await makeConfig(engine).apply(engine);
128
+
129
+ await eh.initialize();
130
+
131
+ main(engine);
132
+ }
133
+
134
+ init(eh);
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportPositionSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPositionSystem.js"],"names":[],"mappings":";AAuBA;IACI,+BAoBC;IAjBG,8DAAkD;IAElD,kEAEC;IAED,kBAAgC;IAEhC,yCAME;IAEF,SAAc;IAGlB,2CAEC;IAED,4CAEC;IAED;;;OAGG;IACH,sBAHW,UAAU,MACV,gBAAgB,QAkE1B;IAED;;;;;OAKG;IACH,SAJW,gBAAgB,MAChB,UAAU,qBA8BpB;IAED;;;;;OAKG;IACH,WAJW,gBAAgB,MAChB,UAAU,qBAmBpB;IA4EL;;;OAGG;IACH,mCAFU,OAAO,CAEwC;CA7ExD;uBAlLsB,iBAAiB;uBACjB,kBAAkB;6BAEZ,uBAAuB;4CAJR,uDAAuD;8BAJrE,iDAAiD"}
1
+ {"version":3,"file":"ViewportPositionSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPositionSystem.js"],"names":[],"mappings":";AAwBA;IACI,+BAoBC;IAjBG,8DAAkD;IAElD,kEAEC;IAED,kBAAgC;IAEhC,yCAME;IAEF,SAAc;IAGlB,2CAEC;IAED,4CAEC;IAED;;;OAGG;IACH,sBAHW,UAAU,MACV,gBAAgB,QAkE1B;IAED;;;;;OAKG;IACH,SAJW,gBAAgB,MAChB,UAAU,qBA8BpB;IAED;;;;;OAKG;IACH,WAJW,gBAAgB,MAChB,UAAU,qBAmBpB;IAgGL;;;OAGG;IACH,mCAFU,OAAO,CAEwC;CAjGxD;uBAlLsB,iBAAiB;uBACjB,kBAAkB;6BAEZ,uBAAuB;4CAJR,uDAAuD;8BALrE,iDAAiD"}
@@ -1,6 +1,7 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
2
  import { SignalBinding } from "../../../../core/events/signal/SignalBinding.js";
3
3
  import AABB2 from "../../../../core/geom/2d/aabb/AABB2.js";
4
+ import { clamp } from "../../../../core/math/clamp.js";
4
5
  import { EPSILON } from "../../../../core/math/EPSILON.js";
5
6
  import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
6
7
  import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
@@ -186,9 +187,6 @@ class ViewportPositionSystem extends System {
186
187
 
187
188
  const STICKY_FLAG_CLASS_NAME = 'hud-system-sticky-flag';
188
189
 
189
-
190
- const stickyBounds = new AABB2();
191
-
192
190
  /**
193
191
  *
194
192
  * @param {View} view
@@ -202,37 +200,60 @@ function setElementPosition(view, bounds, viewportSize, vp) {
202
200
 
203
201
  if (vp.stickToScreenEdge) {
204
202
 
205
-
206
203
  const screenEdgeWidth = vp.screenEdgeWidth;
207
204
  const clipEdgeX = screenEdgeWidth / viewportSize.x;
208
205
  const clipEdgeY = screenEdgeWidth / viewportSize.y;
209
206
 
207
+ const width = bounds.width;
208
+ const height = bounds.height;
210
209
 
211
- stickyBounds.set(clipEdgeX, clipEdgeY, 1 - clipEdgeX, 1 - clipEdgeY);
210
+ const anchorX = vp.anchor.x;
211
+ const anchorY = vp.anchor.y;
212
212
 
213
- let stickFlag = false;
213
+ // tracked point that the element hangs off, in normalized viewport coordinates
214
+ const px = bounds.x0 + width * anchorX;
215
+ const py = bounds.y0 + height * anchorY;
216
+
217
+ // rect of anchor positions for which the element stays fully on screen, inset by the edge margin
218
+ const ax0 = clipEdgeX + width * anchorX;
219
+ const ay0 = clipEdgeY + height * anchorY;
220
+ const ax1 = 1 - clipEdgeX - width * (1 - anchorX);
221
+ const ay1 = 1 - clipEdgeY - height * (1 - anchorY);
222
+
223
+ const stickFlag = px < ax0 || px > ax1 || py < ay0 || py > ay1;
224
+
225
+ if (stickFlag) {
226
+ /*
227
+ Tracked point is off-screen. Place the element on the line from the viewport center towards the
228
+ tracked point, at the point where that line leaves the valid rect. This keeps the element on the
229
+ invisible line leading to the tracked position, instead of clamping each axis independently,
230
+ which piles far-away directions into the corners.
231
+ */
232
+ const dx = px - 0.5;
233
+ const dy = py - 0.5;
234
+
235
+ let t = 1;
236
+
237
+ if (dx > 0) {
238
+ t = Math.min(t, (ax1 - 0.5) / dx);
239
+ } else if (dx < 0) {
240
+ t = Math.min(t, (ax0 - 0.5) / dx);
241
+ }
214
242
 
215
- if (bounds.x0 < stickyBounds.x0) {
216
- x = stickyBounds.x0;
243
+ if (dy > 0) {
244
+ t = Math.min(t, (ay1 - 0.5) / dy);
245
+ } else if (dy < 0) {
246
+ t = Math.min(t, (ay0 - 0.5) / dy);
247
+ }
217
248
 
218
- stickFlag = true;
219
- } else if (bounds.x1 > stickyBounds.x1) {
220
- x = stickyBounds.x1 - bounds.width;
249
+ // clamp covers rects that do not contain the viewport center, such as for oversized elements
250
+ const sx = clamp(0.5 + dx * t, ax0, ax1);
251
+ const sy = clamp(0.5 + dy * t, ay0, ay1);
221
252
 
222
- stickFlag = true;
253
+ x = sx - width * anchorX;
254
+ y = sy - height * anchorY;
223
255
  } else {
224
256
  x = bounds.x0;
225
- }
226
-
227
- if (bounds.y0 < stickyBounds.y0) {
228
- y = stickyBounds.y0;
229
-
230
- stickFlag = true;
231
- } else if (bounds.y1 > stickyBounds.y1) {
232
- y = stickyBounds.y1 - bounds.height;
233
-
234
- stickFlag = true;
235
- } else {
236
257
  y = bounds.y0;
237
258
  }
238
259