//
// Created by Tristan on 11/24/2025.
//

#ifndef MESH_H
#define MESH_H
#include <stdint.h>

#include "glad/glad.h"
#include "../wmo/wmo_structs.h"


typedef struct {
    C3Vector position;
    C3Vector normal;
    C2Vector texCoord;
} Vertex;

typedef struct {
    uint32_t indexOffset;       // where in the EBO this batch starts
    uint32_t indexCount;        // how many indices to draw
    GLuint textureID;           // the texture to bind to
} RenderBatch;

typedef struct {
    GLuint VAO, VBO, EBO;
    RenderBatch* batches;
    size_t batchCount;
} GroupMesh;

GroupMesh create_mesh_from_group(const WMOGroupData* group, const WMORootData* root_data);
void draw_group_mesh(GroupMesh mesh);
void free_group_mesh(GroupMesh *mesh);

#endif //MESH_H
