@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.
- package/editor/Editor.d.ts +65 -65
- package/editor/SelectionVisualizer.d.ts +19 -19
- package/editor/actions/concrete/ActionUpdateTexture.d.ts +11 -11
- package/editor/actions/concrete/ArrayCopyAction.d.ts +19 -19
- package/editor/actions/concrete/ComponentAddAction.d.ts +14 -14
- package/editor/actions/concrete/ComponentRemoveAction.d.ts +10 -10
- package/editor/actions/concrete/EntityCreateAction.d.ts +17 -17
- package/editor/actions/concrete/EntityRemoveAction.d.ts +10 -10
- package/editor/actions/concrete/ModifyPatchSampler2DAction.d.ts +46 -46
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.d.ts +37 -37
- package/editor/actions/concrete/PaintTerrainOverlayAction.d.ts +22 -22
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +18 -18
- package/editor/actions/concrete/SelectionAddAction.d.ts +18 -18
- package/editor/actions/concrete/SelectionClearAction.d.ts +8 -8
- package/editor/actions/concrete/SelectionRemoveAction.d.ts +9 -9
- package/editor/actions/concrete/TransformModifyAction.d.ts +16 -16
- package/editor/actions/concrete/WriteGridValueAction.d.ts +14 -14
- package/editor/ecs/EditorEntity.d.ts +15 -15
- package/editor/ecs/EditorEntitySystem.d.ts +7 -7
- package/editor/ecs/component/FieldDescriptor.d.ts +26 -26
- package/editor/ecs/component/FieldValueAdapter.d.ts +6 -6
- package/editor/ecs/component/TypeEditor.d.ts +24 -24
- package/editor/ecs/component/createFieldEditor.d.ts +8 -8
- package/editor/ecs/component/createObjectEditor.d.ts +13 -13
- package/editor/ecs/component/editors/ColorEditor.d.ts +6 -6
- package/editor/ecs/component/editors/HTMLElementEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ImagePathEditor.d.ts +6 -6
- package/editor/ecs/component/editors/LargeStringEditor.d.ts +15 -15
- package/editor/ecs/component/editors/NumericIntervalEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ObservedBooleanEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ObservedEnumEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ObservedIntegerEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ObservedStringEditor.d.ts +6 -6
- package/editor/ecs/component/editors/Sampler2DEditor.d.ts +6 -6
- package/editor/ecs/component/editors/collection/ListEditor.d.ts +7 -7
- package/editor/ecs/component/editors/common/BitFlagsEditor.d.ts +11 -11
- package/editor/ecs/component/editors/common/EnumEditor.d.ts +7 -7
- package/editor/ecs/component/editors/common/makeV3_editor.d.ts +14 -14
- package/editor/ecs/component/editors/common/noEditor.d.ts +2 -2
- package/editor/ecs/component/editors/ecs/GridObstacleEditor.d.ts +6 -6
- package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.d.ts +13 -13
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.d.ts +66 -66
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.d.ts +11 -11
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.d.ts +13 -13
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.d.ts +51 -51
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.d.ts +47 -47
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.d.ts +15 -15
- package/editor/ecs/component/editors/ecs/Trail2DEditor.d.ts +29 -29
- package/editor/ecs/component/editors/ecs/TransformEditor.d.ts +19 -19
- package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.d.ts +18 -18
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.d.ts +38 -38
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.d.ts +15 -15
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.d.ts +18 -18
- package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.d.ts +17 -17
- package/editor/ecs/component/editors/geom/QuaternionEditor.d.ts +5 -5
- package/editor/ecs/component/editors/geom/Vector1Editor.d.ts +6 -6
- package/editor/ecs/component/editors/geom/Vector2Editor.d.ts +5 -5
- package/editor/ecs/component/editors/geom/Vector3Editor.d.ts +5 -5
- package/editor/ecs/component/editors/geom/Vector4Editor.d.ts +5 -5
- package/editor/ecs/component/editors/primitive/ArrayEditor.d.ts +7 -7
- package/editor/ecs/component/editors/primitive/BooleanEditor.d.ts +6 -6
- package/editor/ecs/component/editors/primitive/FunctionEditor.d.ts +6 -6
- package/editor/ecs/component/editors/primitive/NumberEditor.d.ts +7 -7
- package/editor/ecs/component/editors/primitive/ObjectEditor.d.ts +5 -5
- package/editor/ecs/component/editors/primitive/StringEditor.d.ts +6 -6
- package/editor/ecs/component/editors/three/BufferGeometryEditor.d.ts +6 -6
- package/editor/ecs/component/editors/three/MaterialEditor.d.ts +6 -6
- package/editor/ecs/component/editors/three/MeshEditor.d.ts +6 -6
- package/editor/ecs/component/editors/three/TextureEditor.d.ts +6 -6
- package/editor/ecs/component/findNearestRegisteredType.d.ts +7 -7
- package/editor/enableEditor.d.ts +13 -13
- package/editor/library/MeshLibrary.d.ts +12 -12
- package/editor/process/DisableGameUIProcess.d.ts +7 -7
- package/editor/process/EditorProcess.d.ts +18 -18
- package/editor/process/ObstacleGridDisplayProcess.d.ts +12 -12
- package/editor/process/ProcessEngine.d.ts +29 -29
- package/editor/process/SymbolicDisplayProcess.d.ts +18 -18
- package/editor/process/symbolic/ComponentSymbolicDisplay.d.ts +10 -10
- package/editor/process/symbolic/SymbolicDisplayInternalAPI.d.ts +64 -64
- package/editor/process/symbolic/buildThreeJSHelperEntity.d.ts +8 -8
- package/editor/process/symbolic/make3DSymbolicDisplay.d.ts +9 -9
- package/editor/process/symbolic/makeCameraSymbolicDisplay.d.ts +6 -6
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.d.ts +5 -5
- package/editor/process/symbolic/makeHelperBoxGeometry.d.ts +2 -2
- package/editor/process/symbolic/makeHelperSphereGeometry.d.ts +8 -8
- package/editor/process/symbolic/makeLightSymbolicDisplay.d.ts +6 -6
- package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.d.ts +5 -5
- package/editor/process/symbolic/makePathSymbolicDisplay.d.ts +6 -6
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.d.ts +8 -8
- package/editor/process/symbolic/makeSocketsSymbolicDisplay.d.ts +6 -6
- package/editor/process/symbolic/makeSolidArrowGeometry.d.ts +25 -25
- package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.d.ts +5 -5
- package/editor/process/symbolic/synchronizeTransform.d.ts +11 -11
- package/editor/tools/GridPaintTool.d.ts +16 -16
- package/editor/tools/SelectionTool.d.ts +26 -26
- package/editor/tools/TopDownCameraControlTool.d.ts +12 -12
- package/editor/tools/engine/Tool.d.ts +63 -63
- package/editor/tools/engine/ToolEngine.d.ts +22 -22
- package/editor/tools/engine/ToolState.d.ts +6 -6
- package/editor/tools/paint/TerrainHeightPaintTool.d.ts +17 -17
- package/editor/tools/paint/TerrainPaintTool.d.ts +30 -30
- package/editor/tools/paint/TerrainTexturePaintTool.d.ts +17 -17
- package/editor/tools/v2/TransformMode.d.ts +6 -6
- package/editor/view/EditorView.d.ts +38 -38
- package/editor/view/ecs/ComponentControlFactory.d.ts +18 -18
- package/editor/view/ecs/ComponentControlView.d.ts +23 -23
- package/editor/view/ecs/EntityEditor.d.ts +29 -29
- package/editor/view/ecs/EntityList.d.ts +21 -21
- package/editor/view/ecs/HierarchicalEntityListView.d.ts +7 -7
- package/editor/view/ecs/components/DatGuiController.d.ts +45 -45
- package/editor/view/ecs/components/GridObstacleController.d.ts +13 -13
- package/editor/view/ecs/components/color/GaugeView.d.ts +12 -12
- package/editor/view/ecs/components/common/AutoCanvasView.d.ts +19 -19
- package/editor/view/ecs/components/common/LineView.d.ts +11 -11
- package/editor/view/ecs/components/common/NumberController.d.ts +17 -17
- package/editor/view/ecs/components/particles/ColorParameterLUTController.d.ts +13 -13
- package/editor/view/makeEntityDecorators.d.ts +5 -5
- package/editor/view/tools/ToolSettingsView.d.ts +10 -10
- package/editor/view/tools/ToolView.d.ts +12 -12
- package/editor/view/v2/SplitView.d.ts +16 -16
- package/package.json +1 -1
- package/samples/generation/grid/GridTags.d.ts +15 -15
- package/samples/generation/grid/MirGridLayers.d.ts +7 -7
- package/samples/generation/rules/matcher_tag_occupied.d.ts +2 -2
- package/samples/generation/rules/matcher_tag_traversable.d.ts +2 -2
- package/samples/generation/rules/matcher_tag_unoccupied.d.ts +2 -2
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts.map +1 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +65 -12
- package/src/engine/ecs/gui/hud/testHudEdgeStick.d.ts +2 -0
- package/src/engine/ecs/gui/hud/testHudEdgeStick.d.ts.map +1 -0
- package/src/engine/ecs/gui/hud/testHudEdgeStick.js +134 -0
- package/src/engine/ecs/gui/position/ViewportPositionSystem.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPositionSystem.js +44 -23
- package/src/engine/graphics/ecs/light/LightContext.d.ts +8 -0
- package/src/engine/graphics/ecs/light/LightContext.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightContext.js +33 -3
- package/src/engine/graphics/ecs/light/LightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSystem.js +13 -6
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts +12 -0
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +184 -6
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +24 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.js +43 -0
- package/src/engine/graphics/ecs/trail3d/Trail3DFlags.d.ts +1 -0
- package/src/engine/graphics/ecs/trail3d/Trail3DFlags.js +9 -1
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +4 -0
- package/src/engine/graphics/ecs/trail3d/prototypeTrail3D.js +22 -1
- package/src/engine/graphics/render/buffer/simple-fx/ao/SAOShader.js +381 -362
- package/src/engine/graphics/render/forward_plus/LightManager.d.ts +5 -0
- package/src/engine/graphics/render/forward_plus/LightManager.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +11 -0
- package/src/engine/graphics/render/forward_plus/model/AbstractLight.d.ts +16 -1
- package/src/engine/graphics/render/forward_plus/model/AbstractLight.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/AbstractLight.js +22 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +7 -0
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +11 -0
- package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts +2 -0
- package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/PointLight.js +10 -0
- package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts +2 -0
- package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/SpotLight.js +12 -0
- package/src/engine/graphics/shadows/ShadowMapRenderer.d.ts +10 -0
- package/src/engine/graphics/shadows/ShadowMapRenderer.d.ts.map +1 -1
- package/src/engine/graphics/shadows/ShadowMapRenderer.js +83 -10
- package/src/engine/graphics/shadows/testPointShadowMapRendering.d.ts +2 -0
- package/src/engine/graphics/shadows/testPointShadowMapRendering.d.ts.map +1 -0
- package/src/engine/graphics/shadows/testPointShadowMapRendering.js +242 -0
- package/src/engine/graphics/trail/tube/TubeMaterialX.d.ts +8 -1
- package/src/engine/graphics/trail/tube/TubeMaterialX.d.ts.map +1 -1
- package/src/engine/graphics/trail/tube/TubeMaterialX.js +111 -15
- package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts +9 -2
- package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts.map +1 -1
- package/src/engine/graphics/trail/tube/TubeXMaterialSpec.js +15 -4
- package/src/engine/graphics/trail/tube/TubeXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/tube/TubeXPlugin.js +7 -1
|
@@ -16,6 +16,14 @@ export class LightContext extends SystemEntityContext {
|
|
|
16
16
|
*/
|
|
17
17
|
getTransform(): Transform;
|
|
18
18
|
__rebuild(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Forward+ point lights have no shadow support; a shadow-casting point
|
|
21
|
+
* light falls through to a real three.js light instead
|
|
22
|
+
* @return {boolean}
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private __use_fp_binding;
|
|
26
|
+
__handleCastShadowChanged(): void;
|
|
19
27
|
__build(): void;
|
|
20
28
|
applySettings(): void;
|
|
21
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/LightContext.js"],"names":[],"mappings":"AAKA;IAEI;;;;OAIG;IACH,kBAAiB;IAEjB;;;OAGG;IACH,kBAEC;IAED;;;OAGG;IACH,0BAEC;IAED,kBAIC;IAED,gBASC;IAED,sBAEC;
|
|
1
|
+
{"version":3,"file":"LightContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/LightContext.js"],"names":[],"mappings":"AAKA;IAEI;;;;OAIG;IACH,kBAAiB;IAEjB;;;OAGG;IACH,kBAEC;IAED;;;OAGG;IACH,0BAEC;IAED,kBAIC;IAED;;;;;OAKG;IACH,yBAMC;IAED,kCAQC;IAED,gBASC;IAED,sBAEC;CAsBJ;oCA/FmC,4CAA4C"}
|
|
@@ -34,8 +34,32 @@ export class LightContext extends SystemEntityContext {
|
|
|
34
34
|
this.__binding.link(this);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Forward+ point lights have no shadow support; a shadow-casting point
|
|
39
|
+
* light falls through to a real three.js light instead
|
|
40
|
+
* @return {boolean}
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
__use_fp_binding() {
|
|
44
|
+
const light = this.getLight();
|
|
45
|
+
|
|
46
|
+
return light.type.getValue() === LightType.POINT
|
|
47
|
+
&& this.system.__use_forward_plus
|
|
48
|
+
&& !light.castShadow.getValue();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
__handleCastShadowChanged() {
|
|
52
|
+
if ((this.__binding instanceof FPLightBinding) === this.__use_fp_binding()) {
|
|
53
|
+
// routing is unchanged; a three.js-bound light reacts to castShadow
|
|
54
|
+
// through its own binding, no rebuild needed
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.__rebuild();
|
|
59
|
+
}
|
|
60
|
+
|
|
37
61
|
__build() {
|
|
38
|
-
if (this.
|
|
62
|
+
if (this.__use_fp_binding()) {
|
|
39
63
|
this.__binding = new FPLightBinding();
|
|
40
64
|
} else {
|
|
41
65
|
this.__binding = new ThreeLightBinding();
|
|
@@ -53,12 +77,18 @@ export class LightContext extends SystemEntityContext {
|
|
|
53
77
|
this.__build();
|
|
54
78
|
this.__binding.link(this);
|
|
55
79
|
|
|
56
|
-
this.getLight()
|
|
80
|
+
const light = this.getLight();
|
|
81
|
+
|
|
82
|
+
light.type.onChanged.add(this.__rebuild, this);
|
|
83
|
+
light.castShadow.onChanged.add(this.__handleCastShadowChanged, this);
|
|
57
84
|
}
|
|
58
85
|
|
|
59
86
|
unlink() {
|
|
60
87
|
|
|
61
|
-
this.getLight()
|
|
88
|
+
const light = this.getLight();
|
|
89
|
+
|
|
90
|
+
light.type.onChanged.remove(this.__rebuild, this);
|
|
91
|
+
light.castShadow.onChanged.remove(this.__handleCastShadowChanged, this);
|
|
62
92
|
|
|
63
93
|
this.__binding.unlink(this);
|
|
64
94
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/LightSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/light/LightSystem.js"],"names":[],"mappings":"AAoRA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,2DARW,YAAY,SACZ,WAAW,oBACX,MAAM,qCA6EhB;;uBApXsB,qBAAqB;sBAEtB,YAAY;AASlC;IACI;;;;;OAKG;IACH,2CAsFC;IA1EG,kDAAsC;IAGtC,6DAEC;IAGD,eAAoB;IACpB,WAA2B;IAC3B,aAAwB;IAExB;;;;OAIG;IACH,mBAA0B;IAE1B;;;;OAIG;IACH,wBAA2B;IAE3B,gBAAkB;IAElB;;;;OAIG;IACH,kBAAoC;IAGpC;;;;OAIG;IACH,2BAA8B;IAC9B;;;;OAIG;IACH,iBAAoB;IAGpB;;;;OAIG;IACH,4BAAgD;IAqBpD,mCAEC;IAED;;;;OAIG;IACH,uBAHW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,OAAO,QAkB/B;IAED;;;;OAIG;IACH,4BAHW,KAAK,UACL,MAAM,QAMhB;IAED,2CAOC;IAED,4CASC;IAGD,4CAOC;IAED;;;;;OAKG;IACH,wCA+CC;IAED;;;;;;OAMG;IACH,sCAwBC;CACJ;sCAxQqC,8CAA8C;0BAC1D,qCAAqC;4CAFnB,uDAAuD"}
|
|
@@ -213,12 +213,19 @@ class LightSystem extends AbstractContextSystem {
|
|
|
213
213
|
|
|
214
214
|
l.castShadow = true;
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
light
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
if (light.type.getValue() === LightType.DIRECTION) {
|
|
217
|
+
// the orthographic view-frustum fit only makes sense for
|
|
218
|
+
// directional lights; applying it to the perspective
|
|
219
|
+
// shadow camera of a point/spot light corrupts its
|
|
220
|
+
// projection (those cameras are driven by
|
|
221
|
+
// LightShadow.updateMatrices instead)
|
|
222
|
+
three_update_shadow_camera_extents(
|
|
223
|
+
this.__camera_object,
|
|
224
|
+
l,
|
|
225
|
+
light.maxShadowDistance.getValue(),
|
|
226
|
+
this.__graphics.layers
|
|
227
|
+
);
|
|
228
|
+
}
|
|
222
229
|
|
|
223
230
|
} else {
|
|
224
231
|
|
|
@@ -35,6 +35,18 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
35
35
|
__shadowmap_link(): void;
|
|
36
36
|
__shadowmap_unlink(): void;
|
|
37
37
|
__shadowmap_prepare_view(): void;
|
|
38
|
+
/**
|
|
39
|
+
* A point light shadow renders six cube faces, a single camera frustum
|
|
40
|
+
* would only cull correctly for one of them. Instead, cull by the
|
|
41
|
+
* axis-aligned box bounding the light's sphere of influence: every caster
|
|
42
|
+
* that can shadow any face lies within `distance` of the light. The box is
|
|
43
|
+
* written directly as six inward-facing "frustum" planes and the resulting
|
|
44
|
+
* visible set is shared by all six face renders.
|
|
45
|
+
* @param {CameraView} cameraView
|
|
46
|
+
* @param {THREE.PointLight} light
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
private __shadowmap_prepare_view_point;
|
|
38
50
|
__shadowmap_render(): void;
|
|
39
51
|
applySettings(settings: any): void;
|
|
40
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeLightBinding.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThreeLightBinding.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js"],"names":[],"mappings":"AA2JA;;;;GAIG;AACH,6EAFW,MAAM,QAqBhB;AAED;IAGI;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,qBAAoB;IAEpB;;;;OAIG;IACH,qBAA6B;IAG7B,qBAYC;IAED,uBAeC;IAED;;;;OAIG;IACH,yBAEC;IAYD,+BAEC;IAUD,yBAuBC;IAED,2BAmCC;IAED,iCA+BC;IAED;;;;;;;;;;OAUG;IACH,uCA8CC;IAGD,2BAkDC;IA8CD,mCAsCC;CAEJ;6BAxiB4B,oBAAoB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DoubleSide, Mesh, MeshDepthMaterial, RGBADepthPacking, Scene } from "three";
|
|
1
|
+
import { DoubleSide, Mesh, MeshDepthMaterial, MeshDistanceMaterial, RGBADepthPacking, Scene, Vector3 } from "three";
|
|
2
2
|
import { ThreeBypassRenderer } from "../../../../render/utils/ThreeBypassRenderer.js";
|
|
3
3
|
import { CameraView } from "../../../../render/view/CameraView.js";
|
|
4
4
|
import { three_setSceneAutoUpdate } from "../../../../three/three_setSceneAutoUpdate.js";
|
|
@@ -59,6 +59,68 @@ function __getDepthMaterial(object) {
|
|
|
59
59
|
return result;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
const __distance_material = new MeshDistanceMaterial({
|
|
63
|
+
side: DoubleSide
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Reference values for point light shadow casting, set per render in
|
|
68
|
+
* {@link ThreeLightBinding.__shadowmap_render} before the shadow scene is
|
|
69
|
+
* built. Shadow renders are sequential, so shared state is safe here.
|
|
70
|
+
*/
|
|
71
|
+
const __distance_params = {
|
|
72
|
+
reference_position: new Vector3(),
|
|
73
|
+
near_distance: 0,
|
|
74
|
+
far_distance: 0
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Point light shadows compare world-space distance to the light rather than
|
|
79
|
+
* projected depth (three.js getPointShadow), which requires
|
|
80
|
+
* MeshDistanceMaterial instead of MeshDepthMaterial
|
|
81
|
+
* @param {Mesh} object
|
|
82
|
+
* @returns {Material}
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
function __getDistanceMaterial(object) {
|
|
86
|
+
let result;
|
|
87
|
+
|
|
88
|
+
const customDistanceMaterial = object.customDistanceMaterial;
|
|
89
|
+
|
|
90
|
+
if (customDistanceMaterial !== undefined) {
|
|
91
|
+
result = customDistanceMaterial;
|
|
92
|
+
} else {
|
|
93
|
+
|
|
94
|
+
const source_material = object.material;
|
|
95
|
+
if (
|
|
96
|
+
typeof source_material.alphaTest === "number"
|
|
97
|
+
&& source_material.alphaTest > 0
|
|
98
|
+
&& source_material.alphaTest < 1
|
|
99
|
+
&& source_material.map !== null
|
|
100
|
+
&& source_material.map !== undefined
|
|
101
|
+
) {
|
|
102
|
+
// alpha-tested
|
|
103
|
+
result = new MeshDistanceMaterial({
|
|
104
|
+
side: DoubleSide,
|
|
105
|
+
map: source_material.map,
|
|
106
|
+
alphaTest: source_material.alphaTest
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
} else {
|
|
110
|
+
// generic
|
|
111
|
+
result = __distance_material;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (result.isMeshDistanceMaterial === true) {
|
|
116
|
+
result.referencePosition.copy(__distance_params.reference_position);
|
|
117
|
+
result.nearDistance = __distance_params.near_distance;
|
|
118
|
+
result.farDistance = __distance_params.far_distance;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
|
|
62
124
|
/**
|
|
63
125
|
*
|
|
64
126
|
* @param {THREE.Object3D} object3D
|
|
@@ -109,6 +171,11 @@ export function three_set_shadow_resolution(shadow, resolution) {
|
|
|
109
171
|
shadow.map = null;
|
|
110
172
|
}
|
|
111
173
|
|
|
174
|
+
if (shadow.mapPass !== null) {
|
|
175
|
+
shadow.mapPass.dispose();
|
|
176
|
+
shadow.mapPass = null;
|
|
177
|
+
}
|
|
178
|
+
|
|
112
179
|
}
|
|
113
180
|
}
|
|
114
181
|
|
|
@@ -157,13 +224,14 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
157
224
|
*/
|
|
158
225
|
const cache = this.__system.__three_light_cache;
|
|
159
226
|
|
|
227
|
+
// tear down shadow state while the light is still bound
|
|
228
|
+
this.__shadowmap_unlink();
|
|
229
|
+
|
|
160
230
|
cache.release(this.__three_getLight());
|
|
161
231
|
|
|
162
232
|
// clear bound light
|
|
163
233
|
this.__c_light.__threeObject = null;
|
|
164
234
|
|
|
165
|
-
this.__shadowmap_unlink();
|
|
166
|
-
|
|
167
235
|
super.unlink(ctx);
|
|
168
236
|
}
|
|
169
237
|
|
|
@@ -239,6 +307,25 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
239
307
|
shadows.remove(this.__shadow_map);
|
|
240
308
|
|
|
241
309
|
this.__shadow_map = null;
|
|
310
|
+
|
|
311
|
+
// release GPU resources of the shadow render targets, they are
|
|
312
|
+
// re-created on demand if shadow casting is enabled again
|
|
313
|
+
const light = this.__three_getLight();
|
|
314
|
+
|
|
315
|
+
const shadow = light === null ? undefined : light.shadow;
|
|
316
|
+
|
|
317
|
+
if (shadow !== undefined) {
|
|
318
|
+
|
|
319
|
+
if (shadow.map !== null) {
|
|
320
|
+
shadow.map.dispose();
|
|
321
|
+
shadow.map = null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (shadow.mapPass !== null) {
|
|
325
|
+
shadow.mapPass.dispose();
|
|
326
|
+
shadow.mapPass = null;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
242
329
|
}
|
|
243
330
|
|
|
244
331
|
__shadowmap_prepare_view() {
|
|
@@ -250,6 +337,11 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
250
337
|
*/
|
|
251
338
|
const light = this.__three_getLight();
|
|
252
339
|
|
|
340
|
+
if (light.isPointLight === true) {
|
|
341
|
+
this.__shadowmap_prepare_view_point(cameraView, light);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
|
|
253
345
|
/**
|
|
254
346
|
*
|
|
255
347
|
* @type {LightShadow}
|
|
@@ -269,6 +361,65 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
269
361
|
|
|
270
362
|
}
|
|
271
363
|
|
|
364
|
+
/**
|
|
365
|
+
* A point light shadow renders six cube faces, a single camera frustum
|
|
366
|
+
* would only cull correctly for one of them. Instead, cull by the
|
|
367
|
+
* axis-aligned box bounding the light's sphere of influence: every caster
|
|
368
|
+
* that can shadow any face lies within `distance` of the light. The box is
|
|
369
|
+
* written directly as six inward-facing "frustum" planes and the resulting
|
|
370
|
+
* visible set is shared by all six face renders.
|
|
371
|
+
* @param {CameraView} cameraView
|
|
372
|
+
* @param {THREE.PointLight} light
|
|
373
|
+
* @private
|
|
374
|
+
*/
|
|
375
|
+
__shadowmap_prepare_view_point(cameraView, light) {
|
|
376
|
+
const p = this.__c_transform.position;
|
|
377
|
+
|
|
378
|
+
// mirrors PointLightShadow.updateMatrices: distance of 0 means unbounded
|
|
379
|
+
const r = light.distance || light.shadow.camera.far;
|
|
380
|
+
|
|
381
|
+
const f = cameraView.frustum;
|
|
382
|
+
|
|
383
|
+
// plane format: nx, ny, nz, constant; a point is inside a plane when
|
|
384
|
+
// dot(normal, point) + constant >= 0
|
|
385
|
+
|
|
386
|
+
// x >= p.x - r
|
|
387
|
+
f[0] = 1;
|
|
388
|
+
f[1] = 0;
|
|
389
|
+
f[2] = 0;
|
|
390
|
+
f[3] = r - p.x;
|
|
391
|
+
|
|
392
|
+
// x <= p.x + r
|
|
393
|
+
f[4] = -1;
|
|
394
|
+
f[5] = 0;
|
|
395
|
+
f[6] = 0;
|
|
396
|
+
f[7] = r + p.x;
|
|
397
|
+
|
|
398
|
+
// y >= p.y - r
|
|
399
|
+
f[8] = 0;
|
|
400
|
+
f[9] = 1;
|
|
401
|
+
f[10] = 0;
|
|
402
|
+
f[11] = r - p.y;
|
|
403
|
+
|
|
404
|
+
// y <= p.y + r
|
|
405
|
+
f[12] = 0;
|
|
406
|
+
f[13] = -1;
|
|
407
|
+
f[14] = 0;
|
|
408
|
+
f[15] = r + p.y;
|
|
409
|
+
|
|
410
|
+
// z >= p.z - r
|
|
411
|
+
f[16] = 0;
|
|
412
|
+
f[17] = 0;
|
|
413
|
+
f[18] = 1;
|
|
414
|
+
f[19] = r - p.z;
|
|
415
|
+
|
|
416
|
+
// z <= p.z + r
|
|
417
|
+
f[20] = 0;
|
|
418
|
+
f[21] = 0;
|
|
419
|
+
f[22] = -1;
|
|
420
|
+
f[23] = r + p.z;
|
|
421
|
+
}
|
|
422
|
+
|
|
272
423
|
|
|
273
424
|
__shadowmap_render() {
|
|
274
425
|
|
|
@@ -297,6 +448,14 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
297
448
|
|
|
298
449
|
const shadow = threeLight.shadow;
|
|
299
450
|
|
|
451
|
+
const is_point_light = threeLight.isPointLight === true;
|
|
452
|
+
|
|
453
|
+
if (is_point_light) {
|
|
454
|
+
__distance_params.reference_position.setFromMatrixPosition(threeLight.matrixWorld);
|
|
455
|
+
__distance_params.near_distance = shadow.camera.near;
|
|
456
|
+
// mirrors PointLightShadow.updateMatrices
|
|
457
|
+
__distance_params.far_distance = threeLight.distance || shadow.camera.far;
|
|
458
|
+
}
|
|
300
459
|
|
|
301
460
|
// prepare shadow scene
|
|
302
461
|
const visible_objects = cameraView.visible_objects;
|
|
@@ -306,7 +465,7 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
306
465
|
scene: shadow_scene,
|
|
307
466
|
input: visible_objects.elements,
|
|
308
467
|
input_size: visible_object_count,
|
|
309
|
-
material_extractor: __getDepthMaterial,
|
|
468
|
+
material_extractor: is_point_light ? __getDistanceMaterial : __getDepthMaterial,
|
|
310
469
|
object_filter: scene_object_filter
|
|
311
470
|
})
|
|
312
471
|
|
|
@@ -367,9 +526,28 @@ export class ThreeLightBinding extends LightBinding {
|
|
|
367
526
|
|
|
368
527
|
// disable automatic shadowmap rendering in three.js
|
|
369
528
|
shadow.autoUpdate = false;
|
|
370
|
-
shadow.camera.matrixAutoUpdate = false;
|
|
371
529
|
|
|
372
|
-
|
|
530
|
+
let resolution = parseInt(settings.shadowResolution);
|
|
531
|
+
|
|
532
|
+
if (shadow.isPointLightShadow === true) {
|
|
533
|
+
// PointLightShadow.updateMatrices re-orients the camera for
|
|
534
|
+
// every cube face and relies on updateMatrixWorld() to
|
|
535
|
+
// re-compose the matrix, so matrixAutoUpdate must stay enabled
|
|
536
|
+
shadow.camera.matrixAutoUpdate = true;
|
|
537
|
+
|
|
538
|
+
// small offset in normalized [near..far] distance units to
|
|
539
|
+
// suppress acne, casters render double-sided so front faces
|
|
540
|
+
// would otherwise compare against their own stored distance
|
|
541
|
+
shadow.bias = -0.002;
|
|
542
|
+
|
|
543
|
+
// resolution is per cube face and the shadow map allocates a
|
|
544
|
+
// 4x2 face atlas, cap the default to keep memory use sane
|
|
545
|
+
resolution = settings.shadowResolutionPoint !== undefined
|
|
546
|
+
? parseInt(settings.shadowResolutionPoint)
|
|
547
|
+
: Math.min(resolution, 1024);
|
|
548
|
+
} else {
|
|
549
|
+
shadow.camera.matrixAutoUpdate = false;
|
|
550
|
+
}
|
|
373
551
|
|
|
374
552
|
shadow.radius = 1;
|
|
375
553
|
shadow.blurSamples = 8;
|
|
@@ -96,6 +96,27 @@ declare class Trail3D {
|
|
|
96
96
|
get textureURL(): string;
|
|
97
97
|
set depthWrite(arg: boolean);
|
|
98
98
|
get depthWrite(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @param {boolean} v
|
|
101
|
+
*/
|
|
102
|
+
set lightingEnabled(arg: boolean);
|
|
103
|
+
/**
|
|
104
|
+
* Whether the trail's tube processes standard scene lighting. When enabled the
|
|
105
|
+
* tube shades as a matte (Lambert) surface under the scene's ambient /
|
|
106
|
+
* hemisphere / light-probe / directional / point / spot lights and receives
|
|
107
|
+
* shadows; it never casts them. Under the Forward+ pipeline the material is
|
|
108
|
+
* additionally rewritten by the renderer's material manager, so clustered
|
|
109
|
+
* point lights and decals apply as well. When disabled (default) the tube
|
|
110
|
+
* renders unlit.
|
|
111
|
+
*
|
|
112
|
+
* Stored in {@link Trail3DFlags.Lit}. This is a build-time option — it selects
|
|
113
|
+
* the compiled material and the mesh's shadow settings — so it must be set
|
|
114
|
+
* before the trail is built / registered with the system, and cannot change
|
|
115
|
+
* afterwards.
|
|
116
|
+
*
|
|
117
|
+
* @returns {boolean}
|
|
118
|
+
*/
|
|
119
|
+
get lightingEnabled(): boolean;
|
|
99
120
|
/**
|
|
100
121
|
* @param {number|Trail3DFlags} flag
|
|
101
122
|
* @returns {void}
|
|
@@ -124,7 +145,7 @@ declare class Trail3D {
|
|
|
124
145
|
* Clear the trail's geometry and reset its state.
|
|
125
146
|
*/
|
|
126
147
|
clear(): void;
|
|
127
|
-
fromJSON({ maxAge, width, radialSegments, spawnMode, spawnDistance, textureURL, depthWrite, offset, color }: {
|
|
148
|
+
fromJSON({ maxAge, width, radialSegments, spawnMode, spawnDistance, textureURL, depthWrite, lightingEnabled, offset, color }: {
|
|
128
149
|
maxAge?: number;
|
|
129
150
|
width?: number;
|
|
130
151
|
radialSegments?: number;
|
|
@@ -132,6 +153,7 @@ declare class Trail3D {
|
|
|
132
153
|
spawnDistance?: number;
|
|
133
154
|
textureURL: any;
|
|
134
155
|
depthWrite?: boolean;
|
|
156
|
+
lightingEnabled?: boolean;
|
|
135
157
|
offset?: Vector3;
|
|
136
158
|
color?: {
|
|
137
159
|
r: number;
|
|
@@ -154,6 +176,7 @@ declare class Trail3D {
|
|
|
154
176
|
};
|
|
155
177
|
textureURL: string;
|
|
156
178
|
depthWrite: boolean;
|
|
179
|
+
lightingEnabled: boolean;
|
|
157
180
|
offset: {
|
|
158
181
|
x: number;
|
|
159
182
|
y: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trail3D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail3d/Trail3D.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Trail3D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail3d/Trail3D.js"],"names":[],"mappings":";AAiCA;;;;;GAKG;AACH;IAoPI,oCAMC;IAxPD;;;OAGG;IACH,QAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;;OAIG;IACH,gBAFU,MAAM,CAEyB;IAEzC;;;OAGG;IACH,WAFU,cAAc,GAAC,MAAM,CAEC;IAEhC;;;;OAIG;IACH,eAFU,MAAM,CAEuB;IAEvC;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;OAEG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,qBAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,yBAFU,MAAM,CAEY;IAE5B;;;;;OAKG;IACH,gBAFU,KAAK,CAEe;IAE9B;;;;OAIG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,MAFU,KAAK,GAAC,IAAI,CAER;IAEZ;;;OAGG;IACH,MAFU,OAAK,IAAI,CAEP;IAEZ;;;OAGG;IACH,UAFU,iBAAiB,CAEQ;IAEnC;;;OAGG;IACH,cAFU,SAAS,CAEG;IAEtB;;;OAGG;IACH,cAAsB;IAEtB,gBAQC;IAMD,4BAEC;IAND,yBAEC;IAUD,6BAEC;IAND,0BAEC;IA0BD;;OAEG;IACH,kCAQC;IA/BD;;;;;;;;;;;;;;;OAeG;IACH,+BAEC;IAeD;;;OAGG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;OAGG;IACH,gBAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;OAGG;IACH,gBAHW,MAAM,GAAC,YAAY,SACnB,OAAO,QAQjB;IAED;;;OAGG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,OAAO,CAInB;IAED;;OAEG;IACH,qBAFW,MAAM,QAoBhB;IAED;;OAEG;IACH,cAmBC;IAUD;;;;;;;;;;;;;;;;aAwBC;IAED;;;;;;;;;;;;;;;;;;;;MAaC;IAED;;OAEG;IACH,cAFW,OAAO,WAcjB;IAkDD;;;;;;OAMG;IACH,cANW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,GACJ,OAAO,CAiEnB;;CAEJ;;;;;+BA3c8B,+BAA+B;sBAPxC,iCAAiC;oBACnC,kCAAkC;sBAShC,2BAA2B;kCACf,uCAAuC;0BAZ/C,yCAAyC;6BAatC,mBAAmB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
1
2
|
import { FLOAT32_MAX } from "../../../../core/binary/FLOAT32_MAX.js";
|
|
2
3
|
import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
|
|
3
4
|
import { Color } from "../../../../core/color/Color.js";
|
|
@@ -164,6 +165,39 @@ class Trail3D {
|
|
|
164
165
|
this.material.depthWrite = v;
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Whether the trail's tube processes standard scene lighting. When enabled the
|
|
170
|
+
* tube shades as a matte (Lambert) surface under the scene's ambient /
|
|
171
|
+
* hemisphere / light-probe / directional / point / spot lights and receives
|
|
172
|
+
* shadows; it never casts them. Under the Forward+ pipeline the material is
|
|
173
|
+
* additionally rewritten by the renderer's material manager, so clustered
|
|
174
|
+
* point lights and decals apply as well. When disabled (default) the tube
|
|
175
|
+
* renders unlit.
|
|
176
|
+
*
|
|
177
|
+
* Stored in {@link Trail3DFlags.Lit}. This is a build-time option — it selects
|
|
178
|
+
* the compiled material and the mesh's shadow settings — so it must be set
|
|
179
|
+
* before the trail is built / registered with the system, and cannot change
|
|
180
|
+
* afterwards.
|
|
181
|
+
*
|
|
182
|
+
* @returns {boolean}
|
|
183
|
+
*/
|
|
184
|
+
get lightingEnabled() {
|
|
185
|
+
return this.getFlag(Trail3DFlags.Lit);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @param {boolean} v
|
|
190
|
+
*/
|
|
191
|
+
set lightingEnabled(v) {
|
|
192
|
+
if (v === this.lightingEnabled) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
assert.notOk(this.getFlag(Trail3DFlags.Built), "lightingEnabled cannot change after the trail is built");
|
|
197
|
+
|
|
198
|
+
this.writeFlag(Trail3DFlags.Lit, v);
|
|
199
|
+
}
|
|
200
|
+
|
|
167
201
|
/**
|
|
168
202
|
* @param {number|Trail3DFlags} flag
|
|
169
203
|
* @returns {void}
|
|
@@ -214,6 +248,11 @@ class Trail3D {
|
|
|
214
248
|
|
|
215
249
|
const mesh = ThreeFactory.createMesh(geometry, null);
|
|
216
250
|
|
|
251
|
+
// receive-only lighting: castShadow stays false. The geometry's `position`
|
|
252
|
+
// attribute holds ring CENTRES (the surface is extruded in the material's
|
|
253
|
+
// vertex stage), so a stock depth pass would render a degenerate line anyway.
|
|
254
|
+
mesh.receiveShadow = this.getFlag(Trail3DFlags.Lit);
|
|
255
|
+
|
|
217
256
|
this.tube = tube;
|
|
218
257
|
this.mesh = mesh;
|
|
219
258
|
}
|
|
@@ -258,6 +297,7 @@ class Trail3D {
|
|
|
258
297
|
spawnDistance = DEFAULT_SPAWN_DISTANCE,
|
|
259
298
|
textureURL,
|
|
260
299
|
depthWrite = false,
|
|
300
|
+
lightingEnabled = false,
|
|
261
301
|
offset = Vector3.zero,
|
|
262
302
|
color = { r: 1, g: 1, b: 1, a: 1 }
|
|
263
303
|
}) {
|
|
@@ -269,6 +309,7 @@ class Trail3D {
|
|
|
269
309
|
this.spawnDistance = spawnDistance;
|
|
270
310
|
this.textureURL = textureURL;
|
|
271
311
|
this.depthWrite = depthWrite;
|
|
312
|
+
this.lightingEnabled = lightingEnabled;
|
|
272
313
|
|
|
273
314
|
this.offset.fromJSON(offset);
|
|
274
315
|
this.color.fromJSON(color);
|
|
@@ -284,6 +325,7 @@ class Trail3D {
|
|
|
284
325
|
color: this.color.toJSON(),
|
|
285
326
|
textureURL: this.textureURL,
|
|
286
327
|
depthWrite: this.depthWrite,
|
|
328
|
+
lightingEnabled: this.lightingEnabled,
|
|
287
329
|
offset: this.offset.toJSON()
|
|
288
330
|
};
|
|
289
331
|
}
|
|
@@ -294,6 +336,7 @@ class Trail3D {
|
|
|
294
336
|
equals(other) {
|
|
295
337
|
return this.textureURL === other.textureURL
|
|
296
338
|
&& this.depthWrite === other.depthWrite
|
|
339
|
+
&& this.lightingEnabled === other.lightingEnabled
|
|
297
340
|
&& this.width === other.width
|
|
298
341
|
&& this.radialSegments === other.radialSegments
|
|
299
342
|
&& this.maxAge === other.maxAge
|
|
@@ -14,5 +14,13 @@ export const Trail3DFlags = {
|
|
|
14
14
|
* segment can bridge post-clear geometry to pre-clear history (e.g. a long
|
|
15
15
|
* streak after teleporting the entity).
|
|
16
16
|
*/
|
|
17
|
-
Reseed: 16
|
|
17
|
+
Reseed: 16,
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The tube processes standard scene lighting (receive-only — it never casts
|
|
21
|
+
* shadows). Build-time flag: it selects the compiled material and the mesh's
|
|
22
|
+
* shadow settings, so it must be set before the trail is built / registered
|
|
23
|
+
* with the system; changing it afterwards has no effect.
|
|
24
|
+
*/
|
|
25
|
+
Lit: 32
|
|
18
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trail3DSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail3d/Trail3DSystem.js"],"names":[],"mappings":";AAyBA;IAiCI;;;OAGG;IACH,4BAkBC;IAtDD,oDAAoC;IAEpC,+DAEE;IAEF;;OAEG;IACH,WAFU,0BAA0B,CAES;IAiB7C;;;OAGG;IACH,YAAgB;IAeZ;;OAEG;IACH,UAFU,cAAc,CAEO;IAE/B;;OAEG;IACH,aAFU,cAAY,IAAI,CAEH;IAG3B,2CAmBC;IAED,4CAIC;IA2DD;;;;OAIG;IACH,YAJW,OAAO,aACP,SAAS,YACT,MAAM,
|
|
1
|
+
{"version":3,"file":"Trail3DSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail3d/Trail3DSystem.js"],"names":[],"mappings":";AAyBA;IAiCI;;;OAGG;IACH,4BAkBC;IAtDD,oDAAoC;IAEpC,+DAEE;IAEF;;OAEG;IACH,WAFU,0BAA0B,CAES;IAiB7C;;;OAGG;IACH,YAAgB;IAeZ;;OAEG;IACH,UAFU,cAAc,CAEO;IAE/B;;OAEG;IACH,aAFU,cAAY,IAAI,CAEH;IAG3B,2CAmBC;IAED,4CAIC;IA2DD;;;;OAIG;IACH,YAJW,OAAO,aACP,SAAS,YACT,MAAM,QAgBhB;IAED;;;;OAIG;IACH,kBAJW,OAAO,aACP,SAAS,UACT,MAAM,QAQhB;IAED;;;OAGG;IACH,yBAHW,OAAO,aACP,SAAS,QAkCnB;IAED,6BAWC;;CACJ;uBAlPsB,wBAAwB;0BACrB,qCAAqC;oBAW3C,cAAc;4CAbU,uDAAuD;2CAUxD,0DAA0D;+BANtE,yBAAyB"}
|
|
@@ -170,6 +170,10 @@ class Trail3DSystem extends System {
|
|
|
170
170
|
* @param {number} entityId
|
|
171
171
|
*/
|
|
172
172
|
link(trail, transform, entityId) {
|
|
173
|
+
// Trail3DFlags.Lit is final by link time — bake it into the material spec
|
|
174
|
+
// (the material cache key) so lit and unlit trails obtain distinct materials
|
|
175
|
+
trail.material.lit = trail.getFlag(Trail3DFlags.Lit);
|
|
176
|
+
|
|
173
177
|
if (!trail.getFlag(Trail3DFlags.Built)) {
|
|
174
178
|
this.#build_trail(trail, transform);
|
|
175
179
|
} else {
|
|
@@ -6,6 +6,8 @@ import { EngineHarness } from "../../../EngineHarness.js";
|
|
|
6
6
|
import { BehaviorComponent } from "../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
7
7
|
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
8
8
|
import { OrbitingBehavior } from "../../../intelligence/behavior/ecs/OrbitingBehavior.js";
|
|
9
|
+
import { Light } from "../light/Light.js";
|
|
10
|
+
import { LightType } from "../light/LightType.js";
|
|
9
11
|
import { TrailSpawnMode } from "../../trail/TrailSpawnMode.js";
|
|
10
12
|
import Trail3D from "./Trail3D.js";
|
|
11
13
|
import Trail3DSystem from "./Trail3DSystem.js";
|
|
@@ -44,6 +46,9 @@ async function main(engine) {
|
|
|
44
46
|
// exercise the distance-based spawning path too
|
|
45
47
|
spawnMode: TrailSpawnMode.Distance,
|
|
46
48
|
spawnDistance: 0.15,
|
|
49
|
+
// alternate unlit / lit around the ring: lit tubes shade under the
|
|
50
|
+
// harness sun + ambient fill and receive (never cast) shadows
|
|
51
|
+
lightingEnabled: i % 2 === 1,
|
|
47
52
|
color: { r: 1, g: 1, b: 1, a: 1 }
|
|
48
53
|
}));
|
|
49
54
|
|
|
@@ -59,7 +64,23 @@ async function main(engine) {
|
|
|
59
64
|
entity.build(ecd);
|
|
60
65
|
}
|
|
61
66
|
|
|
62
|
-
|
|
67
|
+
// a strong green point light in the middle of the ring. Non-shadow-casting
|
|
68
|
+
// POINT lights route through the Forward+ clustered path, so it only shows
|
|
69
|
+
// on materials that went through the FP material transformer — including
|
|
70
|
+
// the lit tubes.
|
|
71
|
+
new Entity()
|
|
72
|
+
.add(Light.fromJSON({
|
|
73
|
+
type: LightType.POINT,
|
|
74
|
+
color: { r: 0.1, g: 1, b: 0.1 },
|
|
75
|
+
intensity: 4,
|
|
76
|
+
distance: 8
|
|
77
|
+
}))
|
|
78
|
+
.add(Transform.fromJSON({
|
|
79
|
+
position: { x: 9, y: 2, z: 9 }
|
|
80
|
+
}))
|
|
81
|
+
.build(ecd);
|
|
82
|
+
|
|
83
|
+
console.log("Trail3D prototype: spawned", emitter_count, "orbiting tube emitters (odd indices lit) + clustered point light");
|
|
63
84
|
}
|
|
64
85
|
|
|
65
86
|
harness.initialize({
|