mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 05:01:53 +00:00
Added Lights
This commit is contained in:
@@ -303,4 +303,39 @@ namespace GlitchyEngine.World
|
||||
DestroyInstanceFunction(&this);
|
||||
}
|
||||
}
|
||||
|
||||
struct SceneLight
|
||||
{
|
||||
public enum LightType
|
||||
{
|
||||
Directional,
|
||||
Spot,
|
||||
Point
|
||||
}
|
||||
|
||||
private LightType _type = .Directional;
|
||||
|
||||
private float _illuminance = 10.0f;
|
||||
|
||||
private ColorRGB _color = .(1, 1, 1);
|
||||
|
||||
public LightType LightType => _type;
|
||||
|
||||
public ColorRGB Color
|
||||
{
|
||||
get => _color;
|
||||
set mut => _color = value;
|
||||
}
|
||||
|
||||
public float Illuminance
|
||||
{
|
||||
get => _illuminance;
|
||||
set mut => _illuminance = value;
|
||||
}
|
||||
}
|
||||
|
||||
struct LightComponent
|
||||
{
|
||||
public SceneLight SceneLight;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,11 @@ namespace GlitchyEngine.World
|
||||
Renderer.Submit(mesh.Mesh, meshRenderer.Material, transform.WorldTransform);
|
||||
}
|
||||
|
||||
for (var (entity, transform, camera) in _ecsWorld.Enumerate<TransformComponent, LightComponent>())
|
||||
{
|
||||
Renderer.Submit(camera.SceneLight, transform.WorldTransform);
|
||||
}
|
||||
|
||||
Renderer.EndScene();
|
||||
|
||||
// Sprite renderer
|
||||
|
||||
Reference in New Issue
Block a user