Fixed ent shader not updating.

This commit is contained in:
2025-03-02 19:43:38 -06:00
parent 7c150a9a7c
commit 3e799eb648
6 changed files with 8 additions and 13 deletions

View File

@ -27,4 +27,5 @@ void playerUpdate(entity_t *ent) {
} else if(inputIsDown(INPUT_DOWN)) {
entityMove(ent, FACING_DIRECTION_SOUTH);
}
}

View File

@ -19,9 +19,6 @@ void entitiesInit() {
}
void entitiesUpdate() {
shaderBufferBind(&ENTITIES_BUFFER);
shaderBufferSetData(&ENTITIES_BUFFER, &OVERWORLD);
for(uint8_t i = 0; i < OVERWORLD.entityCount; i++) {
// Pack the entity data into the buffer
entity_t *src = &OVERWORLD.entities[i];
@ -35,6 +32,9 @@ void entitiesUpdate() {
sizeof(uint_t)
);
}
shaderBufferBind(&ENTITIES_BUFFER);
shaderBufferSetData(&ENTITIES_BUFFER, &OVERWORLD);
}
void entitiesDispose() {

View File

@ -9,7 +9,7 @@
struct Entity {
uint position;
uvec3 _padding0;
uvec3 _p0;
};
layout(std140) uniform b_Entities {

View File

@ -13,7 +13,7 @@
typedef struct {
uint_t position;
uvec3_t _padding0;
uvec3_t _p0;
} entitiesdataent_t;
typedef struct {

View File

@ -37,14 +37,12 @@ void entityShaderInit() {
);
// Uniforms
// Bind
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
shaderBufferBindToBlock(&ENTITIES_BUFFER, ENTITY_SHADER.entitiesBlock);
}
void entityShaderUse() {
shaderUse(&ENTITY_SHADER.shader);
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
shaderBufferBindToBlock(&ENTITIES_BUFFER, ENTITY_SHADER.entitiesBlock);
}
void entityShaderDispose() {

View File

@ -33,10 +33,6 @@ void mapShaderInit() {
&MAP_SHADER.shader,
TRANSFORMS_BLOCK_NAME
);
// Bind
shaderBufferBindToBlock(&MAP_BUFFER, MAP_SHADER.mapBlock);
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, MAP_SHADER.transformsBlock);
}
void mapShaderUse() {