Fixed ent shader not updating.
This commit is contained in:
@ -27,4 +27,5 @@ void playerUpdate(entity_t *ent) {
|
|||||||
} else if(inputIsDown(INPUT_DOWN)) {
|
} else if(inputIsDown(INPUT_DOWN)) {
|
||||||
entityMove(ent, FACING_DIRECTION_SOUTH);
|
entityMove(ent, FACING_DIRECTION_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -19,9 +19,6 @@ void entitiesInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void entitiesUpdate() {
|
void entitiesUpdate() {
|
||||||
shaderBufferBind(&ENTITIES_BUFFER);
|
|
||||||
shaderBufferSetData(&ENTITIES_BUFFER, &OVERWORLD);
|
|
||||||
|
|
||||||
for(uint8_t i = 0; i < OVERWORLD.entityCount; i++) {
|
for(uint8_t i = 0; i < OVERWORLD.entityCount; i++) {
|
||||||
// Pack the entity data into the buffer
|
// Pack the entity data into the buffer
|
||||||
entity_t *src = &OVERWORLD.entities[i];
|
entity_t *src = &OVERWORLD.entities[i];
|
||||||
@ -35,6 +32,9 @@ void entitiesUpdate() {
|
|||||||
sizeof(uint_t)
|
sizeof(uint_t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shaderBufferBind(&ENTITIES_BUFFER);
|
||||||
|
shaderBufferSetData(&ENTITIES_BUFFER, &OVERWORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void entitiesDispose() {
|
void entitiesDispose() {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
struct Entity {
|
struct Entity {
|
||||||
uint position;
|
uint position;
|
||||||
uvec3 _padding0;
|
uvec3 _p0;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(std140) uniform b_Entities {
|
layout(std140) uniform b_Entities {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_t position;
|
uint_t position;
|
||||||
uvec3_t _padding0;
|
uvec3_t _p0;
|
||||||
} entitiesdataent_t;
|
} entitiesdataent_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -37,14 +37,12 @@ void entityShaderInit() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
|
|
||||||
// Bind
|
|
||||||
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
|
|
||||||
shaderBufferBindToBlock(&ENTITIES_BUFFER, ENTITY_SHADER.entitiesBlock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void entityShaderUse() {
|
void entityShaderUse() {
|
||||||
shaderUse(&ENTITY_SHADER.shader);
|
shaderUse(&ENTITY_SHADER.shader);
|
||||||
|
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, ENTITY_SHADER.transformsBlock);
|
||||||
|
shaderBufferBindToBlock(&ENTITIES_BUFFER, ENTITY_SHADER.entitiesBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void entityShaderDispose() {
|
void entityShaderDispose() {
|
||||||
|
@ -33,10 +33,6 @@ void mapShaderInit() {
|
|||||||
&MAP_SHADER.shader,
|
&MAP_SHADER.shader,
|
||||||
TRANSFORMS_BLOCK_NAME
|
TRANSFORMS_BLOCK_NAME
|
||||||
);
|
);
|
||||||
|
|
||||||
// Bind
|
|
||||||
shaderBufferBindToBlock(&MAP_BUFFER, MAP_SHADER.mapBlock);
|
|
||||||
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, MAP_SHADER.transformsBlock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapShaderUse() {
|
void mapShaderUse() {
|
||||||
|
Reference in New Issue
Block a user