diff --git a/src/EngineSharp.Core/EngineSharp.Core/ECS/GameObject.cs b/src/EngineSharp.Core/EngineSharp.Core/ECS/GameObject.cs new file mode 100644 index 0000000..b8dfa71 --- /dev/null +++ b/src/EngineSharp.Core/EngineSharp.Core/ECS/GameObject.cs @@ -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); +} \ No newline at end of file diff --git a/src/EngineSharp.Core/EngineSharp.Core/OpenGLEngine.cs b/src/EngineSharp.Core/EngineSharp.Core/OpenGLEngine.cs index 58ae652..d0906e7 100644 --- a/src/EngineSharp.Core/EngineSharp.Core/OpenGLEngine.cs +++ b/src/EngineSharp.Core/EngineSharp.Core/OpenGLEngine.cs @@ -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) } diff --git a/src/EngineSharp.Core/EngineSharp.Core/PerspectiveCamera.cs b/src/EngineSharp.Core/EngineSharp.Core/PerspectiveCamera.cs index 601c57b..bf64a86 100644 --- a/src/EngineSharp.Core/EngineSharp.Core/PerspectiveCamera.cs +++ b/src/EngineSharp.Core/EngineSharp.Core/PerspectiveCamera.cs @@ -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 ProjectionMatrix => Matrix4X4.CreatePerspectiveFieldOfView(Fov, _aspectRatio, NearClippingPlane, FarClippingPlane); + public Matrix4X4 ProjectionMatrix => Matrix4X4.CreatePerspectiveFieldOfView(Fov.ToRadians(), _aspectRatio, NearClippingPlane, FarClippingPlane); public PerspectiveCamera(Vector3D position, Vector2D viewportDimensions, float yaw = -90.0f, float pitch = 0, float fov = 45.0f, float nearClippingPlane = 0.1f, float farClippingPlane = 100.0f) {