ECS rendering

This commit is contained in:
2025-08-22 16:15:42 -05:00
parent 94ad64675d
commit f9385ed233
17 changed files with 161 additions and 215 deletions

View File

@@ -7,18 +7,11 @@
#include "display/display.h"
#include "console/console.h"
#include "display/camera.h"
#include "display/mesh/mesh.h"
#include "display/renderer.h"
#include "ecs/ecssystem.h"
display_t DISPLAY;
mesh_t mesh;
meshvertex_t triangle[3] = {
{{255, 0, 0, 255}, {0.0f, 0.0f}, {0.0f, 1.0f}}, // Vertex 1
{{0, 255, 0, 255}, {1.0f, 0.0f}, {1.0f, 1.0f}}, // Vertex 2
{{0, 0, 255, 255}, {0.5f, 1.0f}, {0.5f, 0.0f}} // Vertex 3
};
errorret_t displayInit(void) {
#if DUSK_DISPLAY_SDL2
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) != 0) {
@@ -61,8 +54,6 @@ errorret_t displayInit(void) {
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
#endif
meshInit(&mesh, MESH_PRIMITIVE_TRIANGLES, 3, triangle);
// For now, we just return an OK error.
errorOk();
@@ -88,11 +79,7 @@ errorret_t displayUpdate(void) {
glViewport(0, 0, windowWidth, windowHeight);
#endif
if(CAMERA_MAIN != -1) {
cameraPush(CAMERA_MAIN);
meshDraw(&mesh, 0, -1);
cameraPop();
}
rendererRender(CAMERA_MAIN);
#if DUSK_DISPLAY_SDL2
SDL_GL_SwapWindow(DISPLAY.window);
@@ -103,8 +90,6 @@ errorret_t displayUpdate(void) {
}
errorret_t displayDispose(void) {
meshDispose(&mesh);
#if DUSK_DISPLAY_SDL2
if(DISPLAY.glContext) {
SDL_GL_DeleteContext(DISPLAY.glContext);