Skip to content

Commit 5ae4816

Browse files
author
Mathew O'Dwyer
committed
Separated concerns for decoding and loading resources as well as switched to immutable record structs for descriptions.
1 parent 51b4256 commit 5ae4816

38 files changed

+653
-579
lines changed

src/Documentation/v0.1.0/README.md

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
<div align="center">
2+
3+
# ✅ Engine MVP Design Document (v0.1.0)
4+
5+
</div>
6+
7+
## ⚙️ Engine
8+
9+
- **OS:** Windows 10+
10+
- **Framework:** .NET 9.0+
11+
12+
### 🧱 Architecture
13+
14+
- Clean/onion-based architecture with clear separation between core logic and platform-specific layers.
15+
- Modular package structure optimized for testability and maintainability.
16+
- Visual Studio templates included to streamline project creation and setup.
17+
18+
---
19+
20+
## ✨ Core Engine Features
21+
22+
## 🖼️ Rendering
23+
24+
### 🎨 Rendering Pipeline
25+
26+
- Abstracted rendering system using **OpenGL 4.6** backend
27+
- Forward rendering pipeline for direct and efficient lighting
28+
29+
---
30+
31+
### 🧩 Geometry and Models
32+
33+
- **Mesh Rendering** for 3D geometry
34+
- **Model Loading** using **Assimp** for importing complex models
35+
- **2D Sprite Batching** to optimize multiple sprite draws into single calls
36+
37+
---
38+
39+
### 🎥 Camera and View
40+
41+
- **Camera System** for scene viewing and transformation
42+
43+
---
44+
45+
### 🧱 Material and Shading
46+
47+
- **Material System** supporting:
48+
- Diffuse mapping
49+
- Specular mapping
50+
- Normal mapping
51+
- Emissive mapping
52+
- Parallax mapping
53+
54+
---
55+
56+
### 💡 Lighting
57+
58+
- **Lighting System** implementing:
59+
- Blinn-Phong lighting model for realistic shading
60+
- **Light Sources**:
61+
- Directional lights
62+
- Point lights
63+
- Spot lights
64+
- **Global Illumination** via ambient lighting to simulate indirect light
65+
66+
---
67+
68+
### ✨ Visual Effects
69+
70+
- **Skyboxes** for immersive environmental backgrounds
71+
- **Blending** support for transparency and visual composition effects
72+
73+
---
74+
75+
### 🖌️ Post-Processing
76+
77+
- **Post-Processing Framework** including:
78+
- Gamma correction for accurate color output
79+
- High Dynamic Range (HDR) rendering for improved lighting realism
80+
- Anti-aliasing to reduce jagged edges
81+
- Fog effects:
82+
- Linear fog
83+
- Exponential fog
84+
- Exponential squared fog
85+
86+
---
87+
88+
### 🎮 Input
89+
90+
- Keyboard and mouse input with:
91+
- Event-based device layer
92+
- Polling-based high-level layer
93+
- Input mapping system with simple action bindings:
94+
- Bind named actions to keys or buttons (e.g., `"Attack"``Space`, `A`, `MouseLeft`)
95+
96+
### 🔊 Audio
97+
98+
- Core audio abstraction with:
99+
- Play, stop, pause, volume, and loop control
100+
- Positional audio (2D simulation via stereo panning and distance attenuation)
101+
- Global/master volume control
102+
103+
### 🧠 Entity Component System (ECS)
104+
105+
- Custom ECS architecture with:
106+
- Support for user-defined components and systems
107+
- Event hooking:
108+
- `Initialize`, `LoadContent`, `Update`, `Render`, `UnloadContent`
109+
- Includes custom event firing
110+
- Built-in systems:
111+
- Sprite rendering
112+
- Text/GUI rendering
113+
- Audio emitters and listeners
114+
- Orthographic camera rendering
115+
- WASD camera movement
116+
117+
### 🌍 Screen Management
118+
119+
- Scene-based structure with:
120+
- Scene loading and unloading
121+
- Support for switching between scenes
122+
- Each scene maintains its own local resource manager
123+
124+
### 📚 Resource Management
125+
126+
- Dual-scope resource handling:
127+
- Global and screen-specific resource managers
128+
- Reference-counting system to manage lifetime and unloading
129+
- Loader registration system to support multiple resource formats
130+
131+
### 🖋️ GUI System
132+
133+
- Basic text-based rendering for GUI
134+
- Features include:
135+
- Font scaling
136+
- Text alignment
137+
- Color customization
138+
- No interactive components (e.g., buttons, sliders) in MVP
139+
140+
### 🎞️ Animation
141+
142+
- Sprite sheet animation support
143+
- Adjustable frame speed per animation
144+
- Integration with ECS (e.g., animated sprite components)
145+
146+
### ➗ Math Utilities
147+
148+
- Uses `System.Numerics` for vector and matrix manipulation.
149+
- Included `MathHelper` for common operations.
150+
151+
---
152+
153+
## 🌐 System Features
154+
155+
### 🪟 Windowing
156+
157+
- Abstracted window system
158+
- Support for:
159+
- Windowed and fullscreen modes
160+
- Title, size, visibility, and window state management
161+
162+
### 🧾 Configuration
163+
164+
- Environment-based configuration system
165+
- Supports standard `appsettings.{Environment}.json` pattern
166+
- Engine auto-detects and applies correct environment settings
167+
168+
### 🪵 Logging
169+
170+
- Built-in structured logging system using `Microsoft.Extensions.Logging`
171+
- Integration with application-level configuration
172+
- Logging levels configurable per category
173+
174+
### ⚠️ Error Handling
175+
176+
- Localized exception handling within individual engine systems
177+
- No global error handler or crash recovery in MVP
178+
179+
---
180+
181+
## 📦 Supported File Formats
182+
183+
- **Texture/Image Formats:**
184+
- Bmp
185+
- Gif
186+
- Jpeg
187+
- Pbm
188+
- Png
189+
- Tiff
190+
- Tga
191+
- WebP
192+
- Qoi
193+
194+
- **Audio Formats:**
195+
- .Ogg
196+
- .Mp3
197+
198+
---
199+
200+
<div align="center">
201+
202+
# ✅ Editor MVP Design Document (v0.1.0)
203+
204+
</div>
205+
206+
## 🎯 Target Platform
207+
208+
- **OS:** Windows 10+
209+
- **Framework:** .NET 9.0+
210+
211+
### 🧱 Architecture
212+
213+
- MVVM-based **Windows Forms** application
214+
- Modular layout with docking/resizable panels
215+
216+
---
217+
218+
## ✨ Core Editor Features
219+
220+
### 🧩 Scene Hierarchy
221+
222+
- Entity listing with **no** parent-child structure
223+
- Simple right-click actions (rename, delete)
224+
225+
### 🧱 Entity & Component Editing
226+
227+
- Add/edit/remove components from entities
228+
- Create/rename/delete entities
229+
- Modify translation, rotation and scale via gizmos.
230+
- Supports editing common types:
231+
- Integers, strings, booleans, tec
232+
- Vectors
233+
- Enumerations
234+
- Colors
235+
236+
### 📁 Resource Management
237+
238+
- Displays all project resources (textures, fonts, audio)
239+
- Assign resources to components via drag-and-drop
240+
- Uses shared `IResourceManager`
241+
- Synchronous loading and display
242+
- Supported asset previews (e.g., texture thumbnails)
243+
244+
### 🪵 Logging & Console
245+
246+
- Displays logs from runtime and editor
247+
- Filter by severity (info, warning, error)
248+
- Scrollable with auto-scroll toggle
249+
250+
### ⚙️ ECS Management
251+
252+
- ECS system listing
253+
- On/off toggle for built-in systems
254+
- Modification of system properties
255+
256+
### ↩️ Undo/Redo
257+
258+
- Basic command pattern with undo stack
259+
- Linear undo/redo (Ctrl+Z / Ctrl+Y)

src/FinalEngine.Audio.CASL/CaslSound.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace FinalEngine.Audio;
66

77
using System;
88
using CASL;
9+
using FinalEngine.Audio.Sounds;
910

1011
internal sealed class CaslSound : ISound
1112
{

src/FinalEngine.Audio.CASL/Loaders/CaslSoundResourceLoader.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace FinalEngine.Audio.Loaders;
88
using System.IO;
99
using System.IO.Abstractions;
1010
using FinalEngine.Audio.Factories;
11+
using FinalEngine.Audio.Sounds;
1112
using FinalEngine.Resources;
1213

1314
internal sealed class CaslSoundResourceLoader : ResourceLoaderBase<ISound>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<RootNamespace>FinalEngine.Decoding.Imaging</RootNamespace>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="SixLabors.ImageSharp" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\FinalEngine\FinalEngine.csproj" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// <copyright file="ImageSharpImageDecoder.cs" company="Software Antics">
2+
// Copyright (c) Software Antics. All rights reserved.
3+
// </copyright>
4+
5+
namespace FinalEngine.Decoding.Imaging;
6+
7+
using System.IO.Abstractions;
8+
using SixLabors.ImageSharp;
9+
using SixLabors.ImageSharp.PixelFormats;
10+
11+
internal sealed class ImageSharpImageDecoder : IImageDecoder
12+
{
13+
private readonly IFileSystem fileSystem;
14+
15+
public ImageSharpImageDecoder(IFileSystem fileSystem)
16+
{
17+
this.fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
18+
}
19+
20+
public DecodedImage Decode(string filePath)
21+
{
22+
ArgumentException.ThrowIfNullOrWhiteSpace(filePath);
23+
24+
if (!this.fileSystem.File.Exists(filePath))
25+
{
26+
throw new FileNotFoundException($"The file '{filePath}' does not exist.", filePath);
27+
}
28+
29+
using (var stream = this.fileSystem.File.OpenRead(filePath))
30+
{
31+
var image = Image.Load<Rgba32>(stream);
32+
33+
int width = image.Width;
34+
int height = image.Height;
35+
36+
byte[] pixels = new byte[width * height * 4];
37+
image.CopyPixelDataTo(pixels);
38+
39+
return new DecodedImage(
40+
Width: width,
41+
Height: height,
42+
Format: PixelFormat.Rgba,
43+
InternalFormat: SizedFormat.Rgba8,
44+
PixelType: PixelType.Byte,
45+
Data: pixels);
46+
}
47+
}
48+
}

src/FinalEngine.Rendering.OpenGL/OpenGLRenderResourceFactory.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Copyright (c) Software Antics. All rights reserved.
33
// </copyright>
44

5+
using FinalEngine.Decoding.Imaging;
6+
57
namespace FinalEngine.Rendering;
68

79
using System;
@@ -13,7 +15,7 @@ namespace FinalEngine.Rendering;
1315
using FinalEngine.Rendering.Invocation;
1416
using FinalEngine.Rendering.Pipeline;
1517
using FinalEngine.Rendering.Textures;
16-
using PixelFormat = Textures.PixelFormat;
18+
using PixelFormat = PixelFormat;
1719

1820
internal sealed class OpenGLRenderResourceFactory : IRenderResourceFactory
1921
{

src/FinalEngine.Rendering.OpenGL/Profiles/OpenTKProfile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace FinalEngine.Rendering.Profiles;
66

77
using AutoMapper;
88
using AutoMapper.Extensions.EnumMapping;
9+
using FinalEngine.Decoding.Imaging;
910
using FinalEngine.Rendering.Buffers;
1011
using FinalEngine.Rendering.Pipeline;
1112
using FinalEngine.Rendering.States;

src/FinalEngine.Rendering.OpenGL/Textures/OpenGLTexture2D.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace FinalEngine.Rendering.Textures;
66

77
using System;
88
using AutoMapper;
9+
using FinalEngine.Decoding.Imaging;
910
using FinalEngine.Rendering.Invocation;
1011
using TKPixelForamt = OpenTK.Graphics.OpenGL4.PixelFormat;
1112
using TKPixelType = OpenTK.Graphics.OpenGL4.PixelType;

0 commit comments

Comments
 (0)