28 lines
675 B
C
28 lines
675 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "meshrenderer.h"
|
|
#include "time/time.h"
|
|
|
|
meshrenderer_t MESH_RENDERER_DATA[ECS_ENTITY_COUNT_MAX] = { 0 };
|
|
ecscomponent_t MESH_RENDERER_COMPONENT = ecsComponentInit(
|
|
MESH_RENDERER_DATA,
|
|
((ecscomponentcallbacks_t){
|
|
.init = NULL,
|
|
.entityAdd = NULL,
|
|
.entityRemove = NULL
|
|
})
|
|
);
|
|
|
|
void meshRendererDraw(const ecsid_t id) {
|
|
if(!meshRendererHas(id)) return;
|
|
meshrenderer_t *renderer = &MESH_RENDERER_DATA[id];
|
|
if(!renderer->mesh) return;
|
|
|
|
textureBind(renderer->texture);
|
|
meshDraw(renderer->mesh, 0, -1);
|
|
} |