@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
@@ -191,6 +191,11 @@ export class LightManager {
191
191
  * @private
192
192
  */
193
193
  private __handle_light_dimensions_change;
194
+ /**
195
+ *
196
+ * @private
197
+ */
198
+ private __handle_light_appearance_change;
194
199
  /**
195
200
  *
196
201
  * @param {LightRenderMetadata} data
@@ -1 +1 @@
1
- {"version":3,"file":"LightManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/forward_plus/LightManager.js"],"names":[],"mappings":"AAoIA;IAiBQ;;;;OAIG;IACH,2BAAgD;IAEhD,oCAAoC;IACpC,yCAA4C;IAE5C;;;;;;;;OAQG;IACH,0BAKC;IAaD;;;;;OAKG;IACH,+BAAoD;IAMpD;;;;;OAKG;IACH,8BAAmD;IAMnD;;;;OAIG;IACH,uCAAiF;IAWjF;;;;;OAKG;IACH,+BAEE;IAEF;;;;OAIG;IACH,iCAA8E;IAE9E;;;;OAIG;IACH,2BAAmC;IAEnC;;;;;OAKG;IACH,kCAAoE;IACpE;;;;;OAKG;IACH,kCAAoE;IAEpE;;;;OAIG;IACH,gCAAiC;IAEjC;;;;OAIG;IACH,6BAAiD;IACjD;;;;OAIG;IACH,6BAAiD;IAEjD;;;;OAIG;IACH,uBAAmC;IAEnC;;;;OAIG;IACH,8BAAiD;IAEjD;;;;OAIG;IACH,4BAA+C;IAG/C;;;;OAIG;IACH,yBAA2C;IAE3C;;;;OAIG;IACH,iCAAmD;IAUnD;;;;;OAKG;IACH,kCAAqC;IAErC;;;;OAIG;IACH,mCAAsC;IAK1C,0BAEC;IAED;;;;;;OAMG;IACH,0CAQC;IAED;;;OAGG;IACH,uCAEC;IAED,qCAQC;IAED;;;;;;OAMG;IACH,4CAgBC;IAED,iCAIC;IAED,gCA6BC;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;OAGG;IACH,oBAFa,WAAW,CAIvB;IAED;;;OAGG;IACH,kBAFa,WAAW,CAIvB;IAED;;OAEG;IACH,sBAFa,aAAa,CAIzB;IAED;;OAEG;IACH,wBAFa,WAAW,CAIvB;IAED;;;OAGG;IACH,iBAFa,SAAS,OAAO,CAAC,CAI7B;IAED;;;OAGG;IACH,yCAKC;IAED;;;;OAIG;IACH,qCAyBC;IAED;;;;OAIG;IACH,uCA8BC;IAED;;;;OAIG;IACH,qCAMC;IAED;;;;OAIG;IACH,uCAKC;IAED;;;;;OAKG;IACH,4CAJW,mBAAmB,GACjB,MAAM,CAalB;IAED;;;;;;OAMG;IACH,+BAgCC;IAED;;;OAGG;IACH,6BAoBC;IAED,6BAYC;IAGD;;;;OAIG;IACH,6BAMC;IAED,mCA0EC;IAED,mCAgFC;IAED;;;OAGG;IACH,oCA+IC;IAED;;;OAGG;IACH,uCAUC;IAED;;;OAGG;IACH,oCAOC;IAED;;;OAGG;IACH,uCAWC;IAED;;;OAGG;IACH,mBAFW,SAAO,MAAM,iBAAiB,QAmDxC;IAED,gBAKC;IAED;;;;;OAKG;IACH,wBAJW,MAAM,KACN,MAAM,KACN,MAAM,QA2ChB;IAED;;;;OAIG;IACH,gCAFa,OAAO,CAInB;IAED;;;OAGG;IACH,qCAMC;IAED;;;;OAIG;IACH,mCAFa,OAAO,CAiBnB;;CACJ;4BAvrCM,OAAO;8BAAP,OAAO;oBAkBM,kCAAkC;oCAiBlB,0BAA0B"}
1
+ {"version":3,"file":"LightManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/forward_plus/LightManager.js"],"names":[],"mappings":"AAoIA;IAiBQ;;;;OAIG;IACH,2BAAgD;IAEhD,oCAAoC;IACpC,yCAA4C;IAE5C;;;;;;;;OAQG;IACH,0BAKC;IAaD;;;;;OAKG;IACH,+BAAoD;IAMpD;;;;;OAKG;IACH,8BAAmD;IAMnD;;;;OAIG;IACH,uCAAiF;IAWjF;;;;;OAKG;IACH,+BAEE;IAEF;;;;OAIG;IACH,iCAA8E;IAE9E;;;;OAIG;IACH,2BAAmC;IAEnC;;;;;OAKG;IACH,kCAAoE;IACpE;;;;;OAKG;IACH,kCAAoE;IAEpE;;;;OAIG;IACH,gCAAiC;IAEjC;;;;OAIG;IACH,6BAAiD;IACjD;;;;OAIG;IACH,6BAAiD;IAEjD;;;;OAIG;IACH,uBAAmC;IAEnC;;;;OAIG;IACH,8BAAiD;IAEjD;;;;OAIG;IACH,4BAA+C;IAG/C;;;;OAIG;IACH,yBAA2C;IAE3C;;;;OAIG;IACH,iCAAmD;IAUnD;;;;;OAKG;IACH,kCAAqC;IAErC;;;;OAIG;IACH,mCAAsC;IAK1C,0BAEC;IAED;;;;;;OAMG;IACH,0CAQC;IAED;;;OAGG;IACH,uCAEC;IAED,qCAQC;IAED;;;;;;OAMG;IACH,4CAgBC;IAED,iCAIC;IAED,gCA6BC;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;OAGG;IACH,oBAFa,WAAW,CAIvB;IAED;;;OAGG;IACH,kBAFa,WAAW,CAIvB;IAED;;OAEG;IACH,sBAFa,aAAa,CAIzB;IAED;;OAEG;IACH,wBAFa,WAAW,CAIvB;IAED;;;OAGG;IACH,iBAFa,SAAS,OAAO,CAAC,CAI7B;IAED;;;OAGG;IACH,yCAKC;IAED;;;OAGG;IACH,yCAGC;IAED;;;;OAIG;IACH,qCAyBC;IAED;;;;OAIG;IACH,uCA8BC;IAED;;;;OAIG;IACH,qCAOC;IAED;;;;OAIG;IACH,uCAMC;IAED;;;;;OAKG;IACH,4CAJW,mBAAmB,GACjB,MAAM,CAalB;IAED;;;;;;OAMG;IACH,+BAgCC;IAED;;;OAGG;IACH,6BAoBC;IAED,6BAYC;IAGD;;;;OAIG;IACH,6BAMC;IAED,mCA0EC;IAED,mCAgFC;IAED;;;OAGG;IACH,oCA+IC;IAED;;;OAGG;IACH,uCAUC;IAED;;;OAGG;IACH,oCAOC;IAED;;;OAGG;IACH,uCAWC;IAED;;;OAGG;IACH,mBAFW,SAAO,MAAM,iBAAiB,QAmDxC;IAED,gBAKC;IAED;;;;;OAKG;IACH,wBAJW,MAAM,KACN,MAAM,KACN,MAAM,QA2ChB;IAED;;;;OAIG;IACH,gCAFa,OAAO,CAInB;IAED;;;OAGG;IACH,qCAMC;IAED;;;;OAIG;IACH,mCAFa,OAAO,CAiBnB;;CACJ;4BAlsCM,OAAO;8BAAP,OAAO;oBAkBM,kCAAkC;oCAiBlB,0BAA0B"}
@@ -505,6 +505,15 @@ export class LightManager {
505
505
  this.__light_data_needs_update = true;
506
506
  }
507
507
 
508
+ /**
509
+ *
510
+ * @private
511
+ */
512
+ __handle_light_appearance_change() {
513
+ // appearance changes (such as color or intensity) don't affect bounds, only the encoded data
514
+ this.__light_data_needs_update = true;
515
+ }
516
+
508
517
  /**
509
518
  *
510
519
  * @param {LightRenderMetadata} data
@@ -585,6 +594,7 @@ export class LightManager {
585
594
  const light = data.light;
586
595
 
587
596
  light.onDimensionChanged(this.__handle_light_dimensions_change, this);
597
+ light.onAppearanceChanged(this.__handle_light_appearance_change, this);
588
598
  }
589
599
 
590
600
  /**
@@ -597,6 +607,7 @@ export class LightManager {
597
607
 
598
608
  const light = data.light;
599
609
  light.offDimensionChanged(this.__handle_light_dimensions_change, this);
610
+ light.offAppearanceChanged(this.__handle_light_appearance_change, this);
600
611
  }
601
612
 
602
613
  /**
@@ -2,7 +2,7 @@ export class AbstractLight {
2
2
  id: number;
3
3
  toString(): string;
4
4
  /**
5
- *
5
+ * Dimension changes affect the light's bounds ({@link AbstractLight#getAABB}) as well as its encoded record
6
6
  * @param {function} f
7
7
  * @param {*} [thisArg]
8
8
  * @returns {void}
@@ -15,6 +15,21 @@ export class AbstractLight {
15
15
  * @returns {void}
16
16
  */
17
17
  offDimensionChanged(f: Function, thisArg?: any): void;
18
+ /**
19
+ * Appearance changes affect the light's encoded record ({@link AbstractLight#toArray}) but not its bounds,
20
+ * such as color or intensity
21
+ * @param {function} f
22
+ * @param {*} [thisArg]
23
+ * @returns {void}
24
+ */
25
+ onAppearanceChanged(f: Function, thisArg?: any): void;
26
+ /**
27
+ *
28
+ * @param {function} f
29
+ * @param {*} [thisArg]
30
+ * @returns {void}
31
+ */
32
+ offAppearanceChanged(f: Function, thisArg?: any): void;
18
33
  /**
19
34
  *
20
35
  * @param {number[]} result
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/AbstractLight.js"],"names":[],"mappings":"AAEA;IAEI,WAAkB;IAGlB,mBAEC;IAED;;;;;OAKG;IACH,gDAFa,IAAI,CAIhB;IAED;;;;;OAKG;IACH,iDAFa,IAAI,CAIhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACrC,IAAI,CAIhB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,eAHW,aAAa,GACX,MAAM,CAIlB;IAGL,aAA4B;CAF3B"}
1
+ {"version":3,"file":"AbstractLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/AbstractLight.js"],"names":[],"mappings":"AAEA;IAEI,WAAkB;IAGlB,mBAEC;IAED;;;;;OAKG;IACH,gDAFa,IAAI,CAIhB;IAED;;;;;OAKG;IACH,iDAFa,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,iDAFa,IAAI,CAIhB;IAED;;;;;OAKG;IACH,kDAFa,IAAI,CAIhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACrC,IAAI,CAIhB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,eAHW,aAAa,GACX,MAAM,CAIlB;IAGL,aAA4B;CAF3B"}
@@ -10,7 +10,7 @@ export class AbstractLight {
10
10
  }
11
11
 
12
12
  /**
13
- *
13
+ * Dimension changes affect the light's bounds ({@link AbstractLight#getAABB}) as well as its encoded record
14
14
  * @param {function} f
15
15
  * @param {*} [thisArg]
16
16
  * @returns {void}
@@ -29,6 +29,27 @@ export class AbstractLight {
29
29
  throw new Error('Not Implemented');
30
30
  }
31
31
 
32
+ /**
33
+ * Appearance changes affect the light's encoded record ({@link AbstractLight#toArray}) but not its bounds,
34
+ * such as color or intensity
35
+ * @param {function} f
36
+ * @param {*} [thisArg]
37
+ * @returns {void}
38
+ */
39
+ onAppearanceChanged(f, thisArg) {
40
+ throw new Error('Not Implemented');
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param {function} f
46
+ * @param {*} [thisArg]
47
+ * @returns {void}
48
+ */
49
+ offAppearanceChanged(f, thisArg) {
50
+ throw new Error('Not Implemented');
51
+ }
52
+
32
53
  /**
33
54
  *
34
55
  * @param {number[]} result
@@ -29,6 +29,13 @@ export class Decal extends AbstractLight {
29
29
  compare(other: any): number;
30
30
  onDimensionChanged(f: any, thisArg: any): void;
31
31
  offDimensionChanged(f: any, thisArg: any): void;
32
+ /**
33
+ * Appearance data (color, uv) is stored in raw arrays without change signals; uv only shifts when the
34
+ * texture atlas re-packs, which happens alongside decal addition/removal where the encoded data is
35
+ * invalidated anyway
36
+ */
37
+ onAppearanceChanged(f: any, thisArg: any): void;
38
+ offAppearanceChanged(f: any, thisArg: any): void;
32
39
  getCenter(result: any): void;
33
40
  getAABB(result: any): void;
34
41
  toArray(destination: any, address: any): number;
@@ -1 +1 @@
1
- {"version":3,"file":"Decal.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/Decal.js"],"names":[],"mappings":"AASA;IAIQ;;;OAGG;IACH,WAFU,MAAM,EAAE,GAAC,YAAY,GAAC,MAAM,CAED;IACrC,gCAA6C;IAC7C,iBAA6B;IAE7B,oBAAgC;IAKhC;;;OAGG;IACH,2BAA2B;IAE3B;;;;OAIG;IACH,eAFU,MAAM,CAEM;IAEtB,0EAA6C;IAGjD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,YAAY,GAAC,UAAU,MAAM,CAAC,QAOjD;IAED,6CAGC;IAED,yCAGC;IAED,4BAUC;IAED,+CAGC;IAED,gDAGC;IAED,6BAKC;IAED,2BAIC;IAED,gDAcC;IAGL;;;OAGG;IACH,kBAFU,OAAO,CAEM;IAEvB,2BAAkC;CARjC;8BAjH6B,oBAAoB;mBAK/B,6CAA6C"}
1
+ {"version":3,"file":"Decal.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/Decal.js"],"names":[],"mappings":"AASA;IAIQ;;;OAGG;IACH,WAFU,MAAM,EAAE,GAAC,YAAY,GAAC,MAAM,CAED;IACrC,gCAA6C;IAC7C,iBAA6B;IAE7B,oBAAgC;IAKhC;;;OAGG;IACH,2BAA2B;IAE3B;;;;OAIG;IACH,eAFU,MAAM,CAEM;IAEtB,0EAA6C;IAGjD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,YAAY,GAAC,UAAU,MAAM,CAAC,QAOjD;IAED,6CAGC;IAED,yCAGC;IAED,4BAUC;IAED,+CAGC;IAED,gDAGC;IAED;;;;OAIG;IACH,gDACC;IAED,iDACC;IAED,6BAKC;IAED,2BAIC;IAED,gDAcC;IAGL;;;OAGG;IACH,kBAFU,OAAO,CAEM;IAEvB,2BAAkC;CARjC;8BA5H6B,oBAAoB;mBAK/B,6CAA6C"}
@@ -83,6 +83,17 @@ export class Decal extends AbstractLight {
83
83
  this.__signal_transfom_changed.remove(f, thisArg);
84
84
  }
85
85
 
86
+ /**
87
+ * Appearance data (color, uv) is stored in raw arrays without change signals; uv only shifts when the
88
+ * texture atlas re-packs, which happens alongside decal addition/removal where the encoded data is
89
+ * invalidated anyway
90
+ */
91
+ onAppearanceChanged(f, thisArg) {
92
+ }
93
+
94
+ offAppearanceChanged(f, thisArg) {
95
+ }
96
+
86
97
  getCenter(result) {
87
98
  // extract translation portion of the matrix
88
99
  result[0] = this.transform[12];
@@ -23,6 +23,8 @@ export class PointLight extends AbstractLight {
23
23
  getAABB(result: any): void;
24
24
  onDimensionChanged(listener: any, context: any): void;
25
25
  offDimensionChanged(listener: any, context: any): void;
26
+ onAppearanceChanged(listener: any, context: any): void;
27
+ offAppearanceChanged(listener: any, context: any): void;
26
28
  /**
27
29
  * @readonly
28
30
  * @type {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"PointLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/PointLight.js"],"names":[],"mappings":"AAKA;IAEI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,iBAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAG3B,6BAEC;IAED,2BAeC;IAED,sDAGC;IAED,uDAGC;IA6BL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;IAEjC,2BAAuC;CARtC;8BArF6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBADnC,oCAAoC"}
1
+ {"version":3,"file":"PointLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/PointLight.js"],"names":[],"mappings":"AAKA;IAEI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,iBAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAG3B,6BAEC;IAED,2BAeC;IAED,sDAGC;IAED,uDAGC;IAED,uDAGC;IAED,wDAGC;IA6BL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;IAEjC,2BAAuC;CARtC;8BA/F6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBADnC,oCAAoC"}
@@ -61,6 +61,16 @@ export class PointLight extends AbstractLight {
61
61
  this.radius.onChanged.remove(listener, context);
62
62
  }
63
63
 
64
+ onAppearanceChanged(listener, context) {
65
+ this.color.onChanged.add(listener, context);
66
+ this.intensity.onChanged.add(listener, context);
67
+ }
68
+
69
+ offAppearanceChanged(listener, context) {
70
+ this.color.onChanged.remove(listener, context);
71
+ this.intensity.onChanged.remove(listener, context);
72
+ }
73
+
64
74
  /**
65
75
  *
66
76
  * @param {number[]|Float32Array|Float64Array} destination
@@ -38,6 +38,8 @@ export class SpotLight extends AbstractLight {
38
38
  getAABB(result: any): void;
39
39
  onDimensionChanged(listener: any, context: any): void;
40
40
  offDimensionChanged(listener: any, context: any): void;
41
+ onAppearanceChanged(listener: any, context: any): void;
42
+ offAppearanceChanged(listener: any, context: any): void;
41
43
  /**
42
44
  * @readonly
43
45
  * @type {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/SpotLight.js"],"names":[],"mappings":"AAMA;IAGI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,oBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAE3B;;;OAGG;IACH,mBAFU,OAAO,CAEW;IAG5B,6BAYC;IAED,2BAcC;IAED,sDAKC;IAED,uDAKC;IAuCL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;8BA/H6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBAFnC,oCAAoC"}
1
+ {"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/SpotLight.js"],"names":[],"mappings":"AAMA;IAGI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,oBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAE3B;;;OAGG;IACH,mBAFU,OAAO,CAEW;IAG5B,6BAYC;IAED,2BAcC;IAED,sDAKC;IAED,uDAKC;IAED,uDAIC;IAED,wDAIC;IAuCL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;8BA3I6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBAFnC,oCAAoC"}
@@ -94,6 +94,18 @@ export class SpotLight extends AbstractLight {
94
94
  this.direction.onChanged.remove(listener, context);
95
95
  }
96
96
 
97
+ onAppearanceChanged(listener, context) {
98
+ this.color.onChanged.add(listener, context);
99
+ this.intensity.onChanged.add(listener, context);
100
+ this.penumbra.onChanged.add(listener, context);
101
+ }
102
+
103
+ offAppearanceChanged(listener, context) {
104
+ this.color.onChanged.remove(listener, context);
105
+ this.intensity.onChanged.remove(listener, context);
106
+ this.penumbra.onChanged.remove(listener, context);
107
+ }
108
+
97
109
  /**
98
110
  *
99
111
  * @param {number[]|Float32Array|Float64Array} destination
@@ -18,6 +18,16 @@ export class ShadowMapRenderer {
18
18
  * @param {Light} light
19
19
  */
20
20
  update(renderer: THREE.WebGLRenderer, shadow: LightShadow, scene: Scene, light: Light): void;
21
+ /**
22
+ * Render each cube face of a point light shadow into its own viewport of
23
+ * the shadow map atlas (4x2 face grid, matching three.js cubeToUV layout)
24
+ * @param {THREE.WebGLRenderer} renderer
25
+ * @param {PointLightShadow} shadow
26
+ * @param {Scene} scene
27
+ * @param {THREE.PointLight} light
28
+ * @private
29
+ */
30
+ private __render_cube_faces;
21
31
  /**
22
32
  *
23
33
  * @param {LightShadow} shadow
@@ -1 +1 @@
1
- {"version":3,"file":"ShadowMapRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shadows/ShadowMapRenderer.js"],"names":[],"mappings":"AAuCA;IAGQ;;;;OAIG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,gBAFU,MAAM,CAEkB;IAItC;;;;;;OAMG;IACH,iBALW,MAAM,aAAa,8BAEnB,KAAK,sBAuEf;IAED;;;;OAIG;IACH,sBAyCC;IAED;;;;;OAKG;IACH,qBA8BC;CACJ;mBAhNkB,uCAAuC;sBADnD,OAAO"}
1
+ {"version":3,"file":"ShadowMapRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shadows/ShadowMapRenderer.js"],"names":[],"mappings":"AAuCA;IAGQ;;;;OAIG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,gBAFU,MAAM,CAEkB;IAItC;;;;;;OAMG;IACH,iBALW,MAAM,aAAa,8BAEnB,KAAK,sBAoFf;IAED;;;;;;;;OAQG;IACH,4BA8BC;IAED;;;;OAIG;IACH,sBAyCC;IAED;;;;;OAKG;IACH,qBAiDC;CACJ;mBAzRkB,uCAAuC;sBADnD,OAAO"}
@@ -102,18 +102,31 @@ export class ShadowMapRenderer {
102
102
 
103
103
  renderer.clear(true, true, false);
104
104
 
105
- shadow.updateMatrices(light, 0);
105
+ if (shadow.isPointLightShadow === true) {
106
106
 
107
- this.onBeforeRender.send3(renderer, shadow_camera, scene);
107
+ if (target.width > 0 && target.height > 0) {
108
+
109
+ this.__render_cube_faces(renderer, shadow, scene, light);
110
+
111
+ // no VSM pass: three.js point shadow sampling (getPointShadow)
112
+ // reads plain RGBA-packed distance regardless of shadow map type
113
+ }
108
114
 
109
- if (target.width <= 0 || target.height <= 0) {
110
- // no point in rendering
111
115
  } else {
112
- // do the draw
113
- renderer.render(scene, shadow_camera);
114
116
 
115
- if (renderer.shadowMap.type === VSMShadowMap) {
116
- this.__do_vsm_pass(shadow);
117
+ shadow.updateMatrices(light, 0);
118
+
119
+ this.onBeforeRender.send3(renderer, shadow_camera, scene);
120
+
121
+ if (target.width <= 0 || target.height <= 0) {
122
+ // no point in rendering
123
+ } else {
124
+ // do the draw
125
+ renderer.render(scene, shadow_camera);
126
+
127
+ if (renderer.shadowMap.type === VSMShadowMap) {
128
+ this.__do_vsm_pass(shadow);
129
+ }
117
130
  }
118
131
  }
119
132
 
@@ -132,6 +145,47 @@ export class ShadowMapRenderer {
132
145
  renderer.info.render.frame++;
133
146
  }
134
147
 
148
+ /**
149
+ * Render each cube face of a point light shadow into its own viewport of
150
+ * the shadow map atlas (4x2 face grid, matching three.js cubeToUV layout)
151
+ * @param {THREE.WebGLRenderer} renderer
152
+ * @param {PointLightShadow} shadow
153
+ * @param {Scene} scene
154
+ * @param {THREE.PointLight} light
155
+ * @private
156
+ */
157
+ __render_cube_faces(renderer, shadow, scene, light) {
158
+ const target = shadow.map;
159
+ const shadow_camera = shadow.camera;
160
+ const map_size = shadow.mapSize;
161
+
162
+ const viewport_count = shadow.getViewportCount();
163
+
164
+ for (let i = 0; i < viewport_count; i++) {
165
+ // orient the shadow camera along the face direction
166
+ shadow.updateMatrices(light, i);
167
+
168
+ const viewport = shadow.getViewport(i);
169
+
170
+ target.viewport.set(
171
+ map_size.x * viewport.x,
172
+ map_size.y * viewport.y,
173
+ map_size.x * viewport.z,
174
+ map_size.y * viewport.w
175
+ );
176
+
177
+ // re-bind to apply the updated viewport
178
+ renderer.setRenderTarget(target);
179
+
180
+ this.onBeforeRender.send3(renderer, shadow_camera, scene);
181
+
182
+ renderer.render(scene, shadow_camera);
183
+ }
184
+
185
+ // leave the target with a full-size viewport to keep other consumers unaffected
186
+ target.viewport.set(0, 0, target.width, target.height);
187
+ }
188
+
135
189
  /**
136
190
  *
137
191
  * @param {LightShadow} shadow
@@ -191,6 +245,25 @@ export class ShadowMapRenderer {
191
245
 
192
246
  if (shadow.map === null) {
193
247
 
248
+ // point light shadows pack six cube faces into a 4x2 viewport
249
+ // atlas, other shadow types occupy the full target (extents 1x1)
250
+ const frame_extents = shadow.getFrameExtents();
251
+
252
+ // clamp so the atlas fits into a single texture, shrinking the
253
+ // per-face resolution if necessary (mirrors THREE.WebGLShadowMap)
254
+ const max_texture_size = renderer.capabilities.maxTextureSize;
255
+
256
+ if (_shadowMapSize.x * frame_extents.x > max_texture_size) {
257
+ _shadowMapSize.x = Math.floor(max_texture_size / frame_extents.x);
258
+ }
259
+
260
+ if (_shadowMapSize.y * frame_extents.y > max_texture_size) {
261
+ _shadowMapSize.y = Math.floor(max_texture_size / frame_extents.y);
262
+ }
263
+
264
+ const target_width = _shadowMapSize.x * frame_extents.x;
265
+ const target_height = _shadowMapSize.y * frame_extents.y;
266
+
194
267
  const pars = {
195
268
  format: RGBAFormat,
196
269
  scissorTest: false,
@@ -201,7 +274,7 @@ export class ShadowMapRenderer {
201
274
  pars.minFilter = LinearFilter;
202
275
  pars.magFilter = LinearFilter;
203
276
 
204
- shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, Object.assign({
277
+ shadow.mapPass = new WebGLRenderTarget(target_width, target_height, Object.assign({
205
278
  depthBuffer: false
206
279
  }, pars));
207
280
 
@@ -211,7 +284,7 @@ export class ShadowMapRenderer {
211
284
 
212
285
  }
213
286
 
214
- shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
287
+ shadow.map = new WebGLRenderTarget(target_width, target_height, pars);
215
288
  shadow.map.texture.name = '.shadowMap';
216
289
 
217
290
  shadow.camera.updateProjectionMatrix();
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=testPointShadowMapRendering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testPointShadowMapRendering.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shadows/testPointShadowMapRendering.js"],"names":[],"mappings":""}
@@ -0,0 +1,242 @@
1
+ import {
2
+ initializeGameBinarySerializationRegistry
3
+ } from "../../../../../model/game/GameBinarySerializationRegistry.js";
4
+ import { enableEditor } from "../../../../editor/enableEditor.js";
5
+ import Vector2 from "../../../core/geom/Vector2.js";
6
+ import Vector3 from "../../../core/geom/Vector3.js";
7
+ import { ArrayBufferLoader } from "../../asset/loaders/ArrayBufferLoader.js";
8
+ import { AttachmentSystem } from "../../ecs/attachment/AttachmentSystem.js";
9
+ import { SerializationMetadata } from "../../ecs/components/SerializationMetadata.js";
10
+ import Entity from "../../ecs/Entity.js";
11
+ import GUIElement from "../../ecs/gui/GUIElement.js";
12
+ import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
13
+ import HeadsUpDisplaySystem from "../../ecs/gui/hud/HeadsUpDisplaySystem.js";
14
+ import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
15
+ import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSystem.js";
16
+ import AnimationSystem from "../../ecs/systems/AnimationSystem.js";
17
+ import ClingToTerrainSystem from "../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
18
+ import TerrainSystem from "../../ecs/terrain/ecs/TerrainSystem.js";
19
+ import { Transform } from "../../ecs/transform/Transform.js";
20
+ import { EngineConfiguration } from "../../EngineConfiguration.js";
21
+ import { EngineHarness } from "../../EngineHarness.js";
22
+ import InputControllerSystem from "../../input/ecs/systems/InputControllerSystem.js";
23
+ import { InputSystem } from "../../input/ecs/systems/InputSystem.js";
24
+ import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
25
+ import { loadSerializedScene } from "../../scene/SerializedScene.js";
26
+ import { SoundEmitterSystem } from "../../sound/ecs/emitter/SoundEmitterSystem.js";
27
+ import SoundControllerSystem from "../../sound/ecs/SoundControllerSystem.js";
28
+ import SoundListenerSystem from "../../sound/ecs/SoundListenerSystem.js";
29
+ import { CameraSystem } from "../ecs/camera/CameraSystem.js";
30
+ import TopDownCameraControllerSystem from "../ecs/camera/topdown/TopDownCameraControllerSystem.js";
31
+ import MeshHighlightSystem from "../ecs/highlight/system/MeshHighlightSystem.js";
32
+ import { Light } from "../ecs/light/Light.js";
33
+ import LightSystem from "../ecs/light/LightSystem.js";
34
+ import { LightType } from "../ecs/light/LightType.js";
35
+ import { ShadedGeometrySystem } from "../ecs/mesh-v2/ShadedGeometrySystem.js";
36
+ import Mesh from "../ecs/mesh/Mesh.js";
37
+ import { MeshSystem } from "../ecs/mesh/MeshSystem.js";
38
+ import { PathDisplaySystem } from "../ecs/path/PathDisplaySystem.js";
39
+ import Trail2DSystem from "../ecs/trail2d/Trail2DSystem.js";
40
+ import WaterSystem from "../ecs/water/WaterSystem.js";
41
+ import { ParticleEmitterSystem } from "../particles/ecs/ParticleEmitterSystem.js";
42
+ import { buildCanvasViewFromTexture } from "../render/visibility/hiz/buildCanvasViewFromTexture.js";
43
+
44
+ const eh = new EngineHarness();
45
+
46
+ /**
47
+ *
48
+ * @param {Engine} engine
49
+ * @returns {EngineConfiguration}
50
+ */
51
+ function makeConfig(engine) {
52
+
53
+ const config = new EngineConfiguration();
54
+
55
+ /**
56
+ *
57
+ * @type {SoundEngine}
58
+ */
59
+ const sound = engine.sound;
60
+ const graphics = engine.graphics;
61
+ const assetManager = engine.assetManager;
62
+ const devices = engine.devices;
63
+
64
+ const guiSystem = new GUIElementSystem(engine.gui.view, engine);
65
+ const headsUpDisplaySystem = new HeadsUpDisplaySystem(graphics);
66
+
67
+ config.addLoader('arraybuffer', new ArrayBufferLoader());
68
+
69
+ initializeGameBinarySerializationRegistry(engine.binarySerializationRegistry);
70
+
71
+ config.addManySystems(
72
+ new AttachmentSystem(),
73
+ new SoundEmitterSystem(assetManager, sound),
74
+ new SoundControllerSystem(),
75
+ new SoundListenerSystem(sound.context),
76
+ guiSystem,
77
+ new AnimationSystem(graphics.viewport.size),
78
+ new TopDownCameraControllerSystem(graphics),
79
+ new CameraSystem(engine.graphics),
80
+ new MeshSystem(engine),
81
+ new ClingToTerrainSystem(),
82
+ new TerrainSystem(graphics, assetManager),
83
+ new Trail2DSystem(engine),
84
+ new ViewportPositionSystem(graphics.viewport.size),
85
+ new InputControllerSystem(devices),
86
+ new InputSystem(devices),
87
+ new MeshHighlightSystem(engine),
88
+ new LightSystem(engine, {
89
+ shadowResolution: 2048
90
+ }),
91
+ headsUpDisplaySystem,
92
+ new BehaviorSystem(engine),
93
+ new PathDisplaySystem(engine),
94
+ new ParticleEmitterSystem(engine),
95
+ new ShadedGeometrySystem(engine),
96
+ new WaterSystem(graphics)
97
+ );
98
+
99
+ return config;
100
+ }
101
+
102
+ /**
103
+ *
104
+ * @param {Engine} engine
105
+ */
106
+ function get_three_light(engine) {
107
+
108
+ return engine.graphics.scene.children.find(l => l.isPointLight && l.castShadow);
109
+ }
110
+
111
+ /**
112
+ * Preview the 4x2 cube face atlas of the point light's shadow map
113
+ * @param {Engine} engine
114
+ */
115
+ function init_shadowmap_preview(engine) {
116
+ const ecd = engine.entityManager.dataset;
117
+
118
+ const graphics = engine.graphics;
119
+ const preview = buildCanvasViewFromTexture({
120
+ width: 1024,
121
+ height: 512,
122
+ renderer: graphics.renderer,
123
+ texture: null
124
+ });
125
+
126
+ graphics.on.postOpaquePass.add(() => {
127
+
128
+ const light = get_three_light(engine);
129
+
130
+ if (light !== undefined && light.shadow.map !== null) {
131
+ preview.texture = light.shadow.map.texture;
132
+
133
+ preview.render();
134
+ }
135
+ });
136
+
137
+
138
+ new Entity()
139
+ .add(ViewportPosition.fromJSON({
140
+ offset: new Vector2(10, 10)
141
+ }))
142
+ .add(GUIElement.fromView(preview.view))
143
+ .add(SerializationMetadata.Transient)
144
+ .build(ecd);
145
+ }
146
+
147
+ /**
148
+ * Point light above the character, casters placed on every axis so all six
149
+ * cube faces receive geometry
150
+ * @param {Engine} engine
151
+ * @param {Vector3} center
152
+ */
153
+ function build_point_light_scene(engine, center) {
154
+ const ecd = engine.entityManager.dataset;
155
+
156
+ const CASTER_URL = "data/models/Conqueror Mech/Conqueror Mech.gltf";
157
+ const LIGHT_HEIGHT = 3;
158
+ const RING_RADIUS = 4;
159
+
160
+ // light itself
161
+ const light = new Light();
162
+ light.type.set(LightType.POINT);
163
+ light.color.setRGB(1.0, 0.85, 0.6);
164
+ light.intensity.set(2);
165
+ light.distance.set(20);
166
+ light.castShadow.set(true);
167
+
168
+ const light_transform = new Transform();
169
+ light_transform.position.set(center.x, center.y + LIGHT_HEIGHT, center.z);
170
+
171
+ new Entity()
172
+ .add(light)
173
+ .add(light_transform)
174
+ .add(SerializationMetadata.Transient)
175
+ .build(ecd);
176
+
177
+ // casters on +X/-X/+Z/-Z of the light; the ground receives -Y, the caster
178
+ // hovering above the light exercises the +Y face
179
+ const positions = [
180
+ [RING_RADIUS, 0, 0],
181
+ [-RING_RADIUS, 0, 0],
182
+ [0, 0, RING_RADIUS],
183
+ [0, 0, -RING_RADIUS],
184
+ [0, LIGHT_HEIGHT + 2, 0]
185
+ ];
186
+
187
+ for (const [x, y, z] of positions) {
188
+ const transform = new Transform();
189
+ transform.position.set(center.x + x, center.y + y, center.z + z);
190
+
191
+ new Entity()
192
+ .add(Mesh.fromURL(CASTER_URL))
193
+ .add(transform)
194
+ .add(SerializationMetadata.Transient)
195
+ .build(ecd);
196
+ }
197
+ }
198
+
199
+ /**
200
+ *
201
+ * @param {Engine} engine
202
+ * @returns {Promise<void>}
203
+ */
204
+ async function main(engine) {
205
+
206
+ const ecd = engine.entityManager.dataset;
207
+ await loadSerializedScene('data/levels/character_creation/level.bin', ecd, engine);
208
+
209
+
210
+ // center the test scene on any placed mesh, fall back to the origin
211
+ let center = new Vector3(0, 0, 0);
212
+
213
+ ecd.traverseComponents(Mesh, (mesh, entity) => {
214
+ const transform = ecd.getComponent(entity, Transform);
215
+
216
+ if (transform !== undefined) {
217
+ center = transform.position;
218
+ return false;
219
+ }
220
+ });
221
+
222
+ build_point_light_scene(engine, center);
223
+
224
+ init_shadowmap_preview(engine);
225
+
226
+ window.light = get_three_light(engine);
227
+ }
228
+
229
+ async function init(engineHarness) {
230
+
231
+ const engine = await engineHarness.initialize();
232
+
233
+ const config = makeConfig(engine);
234
+
235
+ await config.apply(engine);
236
+
237
+ enableEditor(engine);
238
+
239
+ main(engine).catch(e => console.error('testPointShadowMapRendering failed:', e));
240
+ }
241
+
242
+ init(eh);
@@ -1,5 +1,12 @@
1
1
  export class TubeMaterialX extends ShaderMaterial {
2
- constructor(params: any);
2
+ /**
3
+ * @param {Object} params three.js material parameters, plus:
4
+ * @param {boolean} [params.lit=false] compile the lit variant — standard light
5
+ * chain, receive-only shadows — instead of the unlit one
6
+ */
7
+ constructor({ lit, ...params }?: {
8
+ lit?: boolean;
9
+ });
3
10
  }
4
11
  import { ShaderMaterial } from "three";
5
12
  //# sourceMappingURL=TubeMaterialX.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TubeMaterialX.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/tube/TubeMaterialX.js"],"names":[],"mappings":"AAsDA;IACI,yBAuBC;CACJ;+BA/E0D,OAAO"}
1
+ {"version":3,"file":"TubeMaterialX.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/tube/TubeMaterialX.js"],"names":[],"mappings":"AAuIA;IACI;;;;OAIG;IACH;QAH4B,GAAG,GAApB,OAAO;OAoCjB;CACJ;+BA/KsF,OAAO"}