Fixed time.

This commit is contained in:
2025-08-22 22:42:38 -05:00
parent 1fb9485ee8
commit 995bbe1acd
9 changed files with 68 additions and 63 deletions

View File

@@ -10,6 +10,8 @@
#include "display/renderer.h"
#include "ecs/ecssystem.h"
#include "display/mesh/quad.h"
display_t DISPLAY;
errorret_t displayInit(void) {
@@ -55,7 +57,8 @@ errorret_t displayInit(void) {
glEnableClientState(GL_VERTEX_ARRAY);
#endif
// For now, we just return an OK error.
quadInit();
errorOk();
}
@@ -73,9 +76,9 @@ errorret_t displayUpdate(void) {
}
}
// Set viewport size.
// TODO: move to framebuffer component
int32_t windowWidth, windowHeight;
// SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
glViewport(0, 0, windowWidth, windowHeight);
#endif

View File

@@ -6,7 +6,7 @@
*/
#include "meshrenderer.h"
#include "scene/node.h"
#include "time/time.h"
meshrenderer_t MESH_RENDERER_DATA[ECS_ENTITY_COUNT_MAX] = { 0 };
ecscomponent_t MESH_RENDERER_COMPONENT = ecsComponentInit(
@@ -20,12 +20,7 @@ ecscomponent_t MESH_RENDERER_COMPONENT = ecsComponentInit(
void meshRendererDraw(const ecsid_t id) {
if(!meshRendererHas(id)) return;
meshrenderer_t *renderer = &MESH_RENDERER_DATA[id];
if(!renderer->mesh) return;
node_t *node = nodeGet(id);
nodeMatrixUpdate(id);
meshDraw(renderer->mesh, 0, -1);
}

View File

@@ -8,6 +8,26 @@
#include "quad.h"
#include "assert/assert.h"
mesh_t QUAD_MESH_SIMPLE;
meshvertex_t QUAD_MESH_SIMPLE_VERTICES[QUAD_VERTEX_COUNT] = {
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 1.0f, 0.0f }, { 1.0f, 0.0f, 0.0f } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 1.0f, 1.0f }, { 1.0f, 1.0f, 0.0f } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 1.0f, 1.0f }, { 1.0f, 1.0f, 0.0f } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } }
};
void quadInit() {
meshInit(
&QUAD_MESH_SIMPLE,
QUAD_PRIMITIVE_TYPE,
QUAD_VERTEX_COUNT,
QUAD_MESH_SIMPLE_VERTICES
);
}
void quadBuffer(
meshvertex_t *vertices,
const float_t minX,

View File

@@ -11,6 +11,14 @@
#define QUAD_VERTEX_COUNT 6
#define QUAD_PRIMITIVE_TYPE MESH_PRIMITIVE_TRIANGLES
extern mesh_t QUAD_MESH_SIMPLE;
extern meshvertex_t QUAD_MESH_SIMPLE_VERTICES[QUAD_VERTEX_COUNT];
/**
* Initializes the quad mesh.
*/
void quadInit();
/**
* Buffers a quad into the provided vertex array.
*