Small improvements to performance
This commit is contained in:
@@ -26,7 +26,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
typedef union {
|
typedef union {
|
||||||
const cutscene_t *cutscene;
|
const cutscene_t *cutscene;
|
||||||
char_t message[32];
|
const char_t *message;
|
||||||
} entityinteractdata_t;
|
} entityinteractdata_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "display/spritebatch/spritebatch.h"
|
#include "display/spritebatch/spritebatch.h"
|
||||||
|
|
||||||
// #define CHUNK_MESH_COUNT_MAX 3
|
// #define CHUNK_MESH_COUNT_MAX 3
|
||||||
#define CHUNK_VERTEX_COUNT (QUAD_VERTEX_COUNT * CHUNK_TILE_COUNT)
|
#define CHUNK_VERTEX_COUNT (QUAD_VERTEX_COUNT * CHUNK_WIDTH * CHUNK_HEIGHT * 2)
|
||||||
#define CHUNK_ENTITY_COUNT_MAX 10
|
#define CHUNK_ENTITY_COUNT_MAX 10
|
||||||
|
|
||||||
typedef struct chunk_s {
|
typedef struct chunk_s {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#define MAP_CHUNK_DEPTH 3
|
#define MAP_CHUNK_DEPTH 3
|
||||||
#define MAP_CHUNK_COUNT (MAP_CHUNK_WIDTH * MAP_CHUNK_HEIGHT * MAP_CHUNK_DEPTH)
|
#define MAP_CHUNK_COUNT (MAP_CHUNK_WIDTH * MAP_CHUNK_HEIGHT * MAP_CHUNK_DEPTH)
|
||||||
|
|
||||||
#define ENTITY_COUNT 64
|
#define ENTITY_COUNT 32
|
||||||
|
|
||||||
typedef int16_t worldunit_t;
|
typedef int16_t worldunit_t;
|
||||||
typedef int16_t chunkunit_t;
|
typedef int16_t chunkunit_t;
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ errorret_t rpgInit(void) {
|
|||||||
entityInit(npc, ENTITY_TYPE_NPC);
|
entityInit(npc, ENTITY_TYPE_NPC);
|
||||||
npc->position = (worldpos_t){ 3, 3, 0 };
|
npc->position = (worldpos_t){ 3, 3, 0 };
|
||||||
npc->interact.type = ENTITY_INTERACT_PRINT;
|
npc->interact.type = ENTITY_INTERACT_PRINT;
|
||||||
stringCopy(npc->interact.data.message, "hello world", 32);
|
npc->interact.data.message = "hello world";
|
||||||
|
|
||||||
// All Good!
|
// All Good!
|
||||||
errorOk();
|
errorOk();
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "error/error.h"
|
#include "error/error.h"
|
||||||
|
|
||||||
#define UI_BUTTON_LABEL_MAX 32
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char_t *label;
|
const char_t *label;
|
||||||
bool_t highlighted;
|
bool_t highlighted;
|
||||||
|
|||||||
@@ -223,23 +223,24 @@ errorret_t shaderSetTextureGL(
|
|||||||
"Only one texture supported in legacy opengl."
|
"Only one texture supported in legacy opengl."
|
||||||
);
|
);
|
||||||
|
|
||||||
// glActiveTexture(GL_TEXTURE0);
|
|
||||||
errorChain(errorGLCheck());
|
|
||||||
|
|
||||||
if(texture == NULL) {
|
if(texture == NULL) {
|
||||||
glDisable(GL_TEXTURE_2D);
|
if(SHADER_LEGACY.boundTextureId != 0) {
|
||||||
errorChain(errorGLCheck());
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
errorChain(errorGLCheck());
|
||||||
|
SHADER_LEGACY.boundTextureId = 0;
|
||||||
|
}
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
if(texture->id != SHADER_LEGACY.boundTextureId) {
|
||||||
errorChain(errorGLCheck());
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture->id);
|
errorChain(errorGLCheck());
|
||||||
errorChain(errorGLCheck());
|
glBindTexture(GL_TEXTURE_2D, texture->id);
|
||||||
|
errorChain(errorGLCheck());
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
errorChain(errorGLCheck());
|
errorChain(errorGLCheck());
|
||||||
|
SHADER_LEGACY.boundTextureId = texture->id;
|
||||||
|
}
|
||||||
|
|
||||||
// glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
// glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||||
// errorChain(errorGLCheck());
|
// errorChain(errorGLCheck());
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ typedef struct shadergl_s {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
shadergl_t *boundShader;
|
shadergl_t *boundShader;
|
||||||
uint_fast8_t dirty;
|
uint_fast8_t dirty;
|
||||||
|
GLuint boundTextureId;
|
||||||
} shaderlegacygl_t;
|
} shaderlegacygl_t;
|
||||||
|
|
||||||
extern shaderlegacygl_t SHADER_LEGACY;
|
extern shaderlegacygl_t SHADER_LEGACY;
|
||||||
|
|||||||
Reference in New Issue
Block a user