This commit is contained in:
2025-11-11 15:50:57 -06:00
parent 5adf8a0773
commit 9953d7d388
11 changed files with 135 additions and 86 deletions

View File

@@ -46,10 +46,10 @@ void meshDraw(
const GLsizei stride = sizeof(meshvertex_t);
glColorPointer(
MESH_VERTEX_COLOR_SIZE,
sizeof(color4b_t),
GL_UNSIGNED_BYTE,
stride,
(const GLvoid*)&mesh->vertices[offset].color[0]
(const GLvoid*)&mesh->vertices[offset].color
);
glTexCoordPointer(
MESH_VERTEX_UV_SIZE,

View File

@@ -5,6 +5,7 @@
#pragma once
#include "display/display.h"
#include "display/color.h"
typedef enum {
#if DISPLAY_SDL2
@@ -14,13 +15,12 @@ typedef enum {
#endif
} meshprimitivetype_t;
#define MESH_VERTEX_COLOR_SIZE 4
#define MESH_VERTEX_UV_SIZE 2
#define MESH_VERTEX_POS_SIZE 3
typedef struct {
#if DISPLAY_SDL2
GLubyte color[MESH_VERTEX_COLOR_SIZE];
color4b_t color;
GLfloat uv[MESH_VERTEX_UV_SIZE];
GLfloat pos[MESH_VERTEX_POS_SIZE];
#endif

View File

@@ -10,13 +10,13 @@
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 } },
{ COLOR_WHITE_4B, { 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } },
{ COLOR_WHITE_4B, { 1.0f, 0.0f }, { 1.0f, 0.0f, 0.0f } },
{ COLOR_WHITE_4B, { 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 } }
{ COLOR_WHITE_4B, { 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } },
{ COLOR_WHITE_4B, { 1.0f, 1.0f }, { 1.0f, 1.0f, 0.0f } },
{ COLOR_WHITE_4B, { 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } }
};
void quadInit() {