fixed bug and "started" ECS

This commit is contained in:
2025-09-06 11:31:10 +02:00
parent c8d588aeff
commit 94ca0f046a
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,12 @@
namespace EngineSharp.Core.ECS;
// TODO: A GameObject would have a list of Components. A GameObject is basically what will be stored in the scene graph and all components of all GameObjects will have their Update methods etc. be called
// Maybe look at this C# ECS to get an idea of how to implement one myself
// https://github.com/friflo/Friflo.Engine.ECS/tree/main
public abstract class GameObject
{
private long Id { get; set; }
public abstract void OnUpdate(double deltaTime);
}

View File

@ -58,7 +58,7 @@ internal class OpenGLEngine : IEngine
var viewMatrix = _camera.ViewMatrix;
// TODO: Here render all meshes etc.
// On constructing a MeshRenderer, register it somewhere so it can be rendered here (MeshRenderer would then be a component while Mesh would be a normal C# object in the context of a ECS)
// On constructing a MeshRenderer, register it somewhere so it can be rendered here (MeshRenderer would then be a component while Mesh would be a normal C# object in the context of an ECS)
// MeshRenderer contains a mesh; Mesh contains a material; Material contains a shader and the values for all uniforms of the shader (apart from the matrices; I am not sure how to best handle the model matrix with this approach)
}

View File

@ -48,7 +48,7 @@ public class PerspectiveCamera
return Matrix4X4.CreateLookAt(_position, _position + _intrinsicCoordinates.Column3, _worldUp); // TODO: I hope this is Left-Handed. If not I need to update the readme
}
}
public Matrix4X4<float> ProjectionMatrix => Matrix4X4.CreatePerspectiveFieldOfView(Fov, _aspectRatio, NearClippingPlane, FarClippingPlane);
public Matrix4X4<float> ProjectionMatrix => Matrix4X4.CreatePerspectiveFieldOfView(Fov.ToRadians(), _aspectRatio, NearClippingPlane, FarClippingPlane);
public PerspectiveCamera(Vector3D<float> position, Vector2D<int> viewportDimensions, float yaw = -90.0f, float pitch = 0, float fov = 45.0f, float nearClippingPlane = 0.1f, float farClippingPlane = 100.0f)
{