|
@@ -10,7 +10,7 @@ namespace Xenko.Rendering.Lights |
|
|
/// <summary> |
|
|
/// Process <see cref="LightComponent"/> stored in an <see cref="EntityManager"/> by providing grouped lights per types/shadows. |
|
|
/// </summary> |
|
|
public class LightProcessor : EntityProcessor<LightComponent, RenderLight> |
|
|
public class LightProcessor : EntityProcessor<LightComponent, RenderLight>, IEntityComponentRenderProcessor |
|
|
{ |
|
|
/// <summary> |
|
|
/// The default direction of a light vector is (x,y,z) = (0,0,-1) |
|
@@ -26,6 +26,9 @@ public LightProcessor() |
|
|
{ |
|
|
} |
|
|
|
|
|
/// <inheritdoc/> |
|
|
public VisibilityGroup VisibilityGroup { get; set; } |
|
|
|
|
|
/// <summary> |
|
|
/// Gets the active lights. |
|
|
/// </summary> |
|
@@ -38,18 +41,22 @@ public RenderLight GetRenderLight(LightComponent lightComponent) |
|
|
return renderLight; |
|
|
} |
|
|
|
|
|
protected override void OnEntityComponentAdding(Entity entity, LightComponent component, RenderLight state) |
|
|
protected override RenderLight GenerateComponentData(Entity entity, LightComponent component) => new RenderLight(); |
|
|
|
|
|
protected override bool IsAssociatedDataValid(Entity entity, LightComponent component, RenderLight associatedData) => true; |
|
|
|
|
|
protected internal override void OnSystemAdd() |
|
|
{ |
|
|
base.OnSystemAdd(); |
|
|
VisibilityGroup.Tags.Set(ForwardLightingRenderFeature.CurrentLights, Lights); |
|
|
} |
|
|
|
|
|
protected override void OnEntityComponentRemoved(Entity entity, LightComponent component, RenderLight state) |
|
|
protected internal override void OnSystemRemove() |
|
|
{ |
|
|
VisibilityGroup.Tags.Set(ForwardLightingRenderFeature.CurrentLights, null); |
|
|
base.OnSystemRemove(); |
|
|
} |
|
|
|
|
|
protected override RenderLight GenerateComponentData(Entity entity, LightComponent component) => new RenderLight(); |
|
|
|
|
|
protected override bool IsAssociatedDataValid(Entity entity, LightComponent component, RenderLight associatedData) => true; |
|
|
|
|
|
public override void Draw(RenderContext context) |
|
|
{ |
|
|
// 1) Clear the cache of current lights (without destroying collections but keeping previously allocated ones) |
|
|
0 comments on commit
9eceed0