Map shader base, add memory util.

This commit is contained in:
2025-03-02 17:29:00 -06:00
parent 639da129f6
commit 122997c58c
35 changed files with 511 additions and 75 deletions

View File

@ -82,43 +82,43 @@ void assertDeprecatedImpl(
assertUnreachableImpl(file, line, message);
}
void assertMemoryRangeMatchesImpl(
const char *file,
const int32_t line,
const void *start,
const void *end,
const size_t size,
const char *message
) {
assertTrueImpl(
file,
line,
start != NULL,
"Start pointer is NULL"
);
assertTrueImpl(
file,
line,
end != NULL,
"End pointer is NULL"
);
assertTrueImpl(
file,
line,
size > 0,
"Size is 0"
);
assertTrueImpl(
file,
line,
start < end,
"Start pointer is not before end pointer"
);
// void assertMemoryRangeMatchesImpl(
// const char *file,
// const int32_t line,
// const void *start,
// const void *end,
// const size_t size,
// const char *message
// ) {
// assertTrueImpl(
// file,
// line,
// start != NULL,
// "Start pointer is NULL"
// );
// assertTrueImpl(
// file,
// line,
// end != NULL,
// "End pointer is NULL"
// );
// assertTrueImpl(
// file,
// line,
// size > 0,
// "Size is 0"
// );
// assertTrueImpl(
// file,
// line,
// start < end,
// "Start pointer is not before end pointer"
// );
assertTrueImpl(
file,
line,
((uintptr_t)end - (uintptr_t)start) == size,
message
);
}
// assertTrueImpl(
// file,
// line,
// ((uintptr_t)end - (uintptr_t)start) == size,
// message
// );
// }

View File

@ -126,7 +126,4 @@ void assertMemoryRangeMatchesImpl(
assertTrue(strlen(str) <= len, message)
#define assertStrLenMin(str, len, message) \
assertTrue(strlen(str) >= len, message)
#define assertMemoryRangeMatches(start, end, size, message) \
assertMemoryRangeMatchesImpl(__FILE__, __LINE__, start, end, size, message)
assertTrue(strlen(str) >= len, message)

View File

@ -7,6 +7,7 @@
#include "scene.h"
#include "assert/assert.h"
#include "util/memory.h"
#include "overworld/overworld.h"
scenetypecallback_t SCENE_CALLBACKS[] = {
@ -26,7 +27,7 @@ scenetypecallback_t SCENE_CALLBACKS[] = {
scene_t SCENE;
void sceneInit() {
memset(&SCENE, 0, sizeof(scene_t));
memoryZero(&SCENE, sizeof(scene_t));
for(uint8_t i = 0; i < SCENE_TYPE_COUNT; i++) {
if(SCENE_CALLBACKS[i].onInit) SCENE_CALLBACKS[i].onInit();

View File

@ -8,11 +8,12 @@
#include "game.h"
#include "input.h"
#include "display/scene.h"
#include "util/memory.h"
game_t GAME;
void gameInit() {
memset(&GAME, 0, sizeof(game_t));
memoryZero(&GAME, sizeof(game_t));
inputInit();
sceneInit();

View File

@ -7,6 +7,7 @@
#include "entity.h"
#include "assert/assert.h"
#include "util/memory.h"
#include "overworlddefs.h"
entitycallback_t ENTITY_CALLBACKS[ENTITY_TYPE_COUNT] = {
@ -24,7 +25,7 @@ void entityInit(
assertTrue(type < ENTITY_TYPE_COUNT, "Invalid entity type");
// Init values
memset(ent, 0, sizeof(entity_t));
memoryZero(ent, sizeof(entity_t));
ent->type = type;
// Call init
@ -35,7 +36,6 @@ void entityInit(
void entityUpdate(entity_t *ent) {
assertNotNull(ent, "Entity cannot be NULL");
assertTrue(ent->type < ENTITY_TYPE_COUNT, "Invalid entity type");
assertNotNull(ENTITY_CALLBACKS[ent->type].update, "Entity type update err.");
ENTITY_CALLBACKS[ent->type].update(ent);
@ -64,6 +64,7 @@ void entityTurn(entity_t *ent, const facingdir_t dir) {
void entityMove(entity_t *ent, const facingdir_t dir) {
assertNotNull(ent, "Entity cannot be NULL");
if(entityIsMoving(ent)) return;
entityTurn(ent, dir);

View File

@ -39,7 +39,7 @@ typedef struct _entity_t {
};
} entity_t;
#define ENTITY_MOVE_SPEED 4
#define ENTITY_MOVE_SPEED 3
/**
* Initializes an entity.

View File

@ -6,13 +6,22 @@
*/
#include "overworld.h"
#include "util/memory.h"
#include "assert/assert.h"
overworld_t OVERWORLD;
void overworldInit() {
memset(&OVERWORLD, 0, sizeof(overworld_t));
memoryZero(&OVERWORLD, sizeof(overworld_t));
// Test
OVERWORLD.mapWidth = 16;
OVERWORLD.mapHeight = 16;
assertTrue(
OVERWORLD.mapWidth * OVERWORLD.mapHeight <= OVERWORLD_TILE_COUNT_MAX,
"Map size exceeds tile count."
);
entityInit(OVERWORLD.entities + OVERWORLD.entityCount++, ENTITY_TYPE_PLAYER);
}

View File

@ -6,12 +6,17 @@
*/
#pragma once
#include "entity.h"
#include "overworlddefs.h"
#include "entity.h"
#include "tile.h"
typedef struct {
entity_t entities[OVERWORLD_ENTITY_COUNT_MAX];
uint8_t entityCount;
tileid_t tileIds[OVERWORLD_TILE_COUNT_MAX];
tiledata_t tileData[OVERWORLD_TILE_COUNT_MAX];
uint8_t mapWidth, mapHeight;
} overworld_t;
extern overworld_t OVERWORLD;

View File

@ -5,7 +5,10 @@
* https://opensource.org/licenses/MIT
*/
#define OVERWORLD_ENTITY_COUNT_MAX 32
#define OVERWORLD_ENTITY_WIDTH 32
#define OVERWORLD_ENTITY_HEIGHT 32
#define OVERWORLD_ENTITY_COUNT_MAX 32
#define OVERWORLD_TILE_COUNT_MAX 256
#define OVERWORLD_TILE_WIDTH OVERWORLD_ENTITY_WIDTH
#define OVERWORLD_TILE_HEIGHT OVERWORLD_ENTITY_HEIGHT

View File

@ -17,14 +17,14 @@ void playerInit(entity_t *ent) {
void playerUpdate(entity_t *ent) {
assertNotNull(ent, "Entity cannot be NULL");
if(inputWasPressed(INPUT_RIGHT)) {
if(inputIsDown(INPUT_RIGHT)) {
entityMove(ent, FACING_DIRECTION_EAST);
} else if(inputWasPressed(INPUT_LEFT)) {
} else if(inputIsDown(INPUT_LEFT)) {
entityMove(ent, FACING_DIRECTION_WEST);
} else if(inputWasPressed(INPUT_UP)) {
} else if(inputIsDown(INPUT_UP)) {
entityMove(ent, FACING_DIRECTION_NORTH);
} else if(inputWasPressed(INPUT_DOWN)) {
} else if(inputIsDown(INPUT_DOWN)) {
entityMove(ent, FACING_DIRECTION_SOUTH);
}
}

15
src/dusk/overworld/tile.h Normal file
View File

@ -0,0 +1,15 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
typedef uint8_t tileid_t;
typedef struct {
uint32_t nothing;
} tiledata_t;

View File

@ -8,4 +8,5 @@ target_sources(${DUSK_TARGET_NAME}
PRIVATE
math.c
random.c
memory.c
)

52
src/dusk/util/memory.c Normal file
View File

@ -0,0 +1,52 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "memory.h"
#include "assert/assert.h"
void * memoryAllocate(const size_t size) {
void *ptr = malloc(size);
assertNotNull(ptr, "Failed to allocate memory.");
return ptr;
}
void memoryFree(void *ptr) {
assertNotNull(ptr, "Cannot free NULL memory.");
free(ptr);
}
void memoryCopy(void *dest, const void *src, const size_t size) {
assertNotNull(dest, "Cannot copy to NULL memory.");
assertNotNull(src, "Cannot copy from NULL memory.");
assertTrue(size > 0, "Cannot copy 0 bytes of memory.");
assertTrue(dest != src, "Cannot copy memory to itself.");
memcpy(dest, src, size);
}
void memorySet(void *dest, const uint8_t value, const size_t size) {
assertNotNull(dest, "Cannot set NULL memory.");
assertTrue(size > 0, "Cannot set 0 bytes of memory.");
memset(dest, value, size);
}
void memoryZero(void *dest, const size_t size) {
memorySet(dest, 0, size);
}
void memoryCopyRangeSafe(
void *dest,
const void *start,
const void *end,
const size_t sizeMax
) {
assertFalse(start == end, "Start and end pointers are the same.");
assertTrue(end > start, "End pointer is not after start pointer.");
size_t copy = (size_t)end - (size_t)start;
assertTrue(copy <= sizeMax, "Size of memory to copy is too large.");
memoryCopy(dest, start, copy);
}

67
src/dusk/util/memory.h Normal file
View File

@ -0,0 +1,67 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
/**
* Allocates memory.
*
* @param size The size of the memory to allocate.
* @return The allocated memory.
*/
void * memoryAllocate(const size_t size);
/**
* Frees memory.
*
* @param ptr The memory to free.
*/
void memoryFree(void *ptr);
/**
* Copies memory.
*
* @param dest The destination to copy to.
* @param src The source to copy from.
* @param size The size of the memory to copy.
*/
void memoryCopy(void *dest, const void *src, const size_t size);
/**
* Sets memory.
*
* @param dest The destination to set.
* @param value The value to set.
* @param size The size of the memory to set.
*/
void memorySet(void *dest, const uint8_t value, const size_t size);
/**
* Zeroes memory.
*
* @param dest The destination to zero.
* @param size The size of the memory to zero.
*/
void memoryZero(void *dest, const size_t size);
/**
* Copies memory, ensuring that the memory range is as expected, typically this
* is done if you're trying to reshape data in a buffer. Extremely useful in
* copying data to a shader buffer.
*
* @param dest The destination to copy to.
* @param start The start of the source to copy from.
* @param end The end of the source to copy from.
* @param sizeMax The maximum size of the memory to copy.
*/
void memoryCopyRangeSafe(
void *dest,
const void *start,
const void *end,
const size_t sizeMax
);

View File

@ -7,6 +7,7 @@
#include "assert/assertgl.h"
#include "assert/assert.h"
#include "util/memory.h"
void assertNotGLErrorCheck(const char_t *file, const int32_t line) {
assertNotNull(file, "File is an invlaid string");
@ -18,7 +19,7 @@ void assertNotGLErrorCheck(const char_t *file, const int32_t line) {
while((errorCode = glGetError()) != GL_NO_ERROR) {
if(errorCount == 0) {
buffer = malloc(sizeof(char_t) * 4096);
buffer = memoryAllocate(sizeof(char_t) * 4096);
sprintf(buffer, "assertNotGLErrorCheck: %s:%d\n", file, line);
}

View File

@ -8,6 +8,7 @@
#include "asset.h"
#include "assert/assert.h"
#include "util/math.h"
#include "util/memory.h"
asset_t ASSET;
@ -18,7 +19,7 @@ void assetInit() {
EXECUTABLE_DIRECTORY
};
memset(&ASSET, 0, sizeof(asset_t));
memoryZero(&ASSET, sizeof(asset_t));
// Try and find the asset file.
for(int32_t i = 0; i < sizeof(scanLocations) / sizeof(char_t*); i++) {
@ -171,7 +172,7 @@ void assetDispose() {
assertNotNull(ASSET.file, "Asset disposing but file is NULL?");
fclose(ASSET.file);
memset(&ASSET, 0, sizeof(asset_t));
memoryZero(&ASSET, sizeof(asset_t));
}
// Libarchive callbacks

View File

@ -6,7 +6,6 @@
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
framebuffer.c
render.c
quad.c
texture.c

View File

@ -6,6 +6,7 @@
*/
#include "assert/assertgl.h"
#include "util/memory.h"
#include "render.h"
#include "display/scene.h"
#include "display/shader/shadermanager.h"
@ -15,7 +16,7 @@
render_t RENDER;
void renderInit() {
memset(&RENDER, 0, sizeof(render_t));
memoryZero(&RENDER, sizeof(render_t));
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
assertNoGLError();
@ -26,6 +27,7 @@ void renderInit() {
void renderUpdate() {
glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
assertNoGLError();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
assertNoGLError();

View File

@ -14,4 +14,5 @@ target_sources(${DUSK_TARGET_NAME}
# Subdirs
add_subdirectory(data)
add_subdirectory(entityshader)
add_subdirectory(mapshader)
add_subdirectory(fragments)

View File

@ -8,4 +8,5 @@ target_sources(${DUSK_TARGET_NAME}
PRIVATE
transforms.c
entities.c
map.c
)

View File

@ -8,6 +8,7 @@
#include "entities.h"
#include "overworld/overworld.h"
#include "assert/assert.h"
#include "util/memory.h"
shaderbuffer_t ENTITIES_BUFFER;
entitiesdata_t ENTITIES_DATA;
@ -27,13 +28,12 @@ void entitiesUpdate() {
entitiesdataent_t *dst = &ENTITIES_DATA.entities[i];
// Copy position data.
assertMemoryRangeMatches(
memoryCopyRangeSafe(
&dst->position,
&src->x,
&src->direction,
sizeof(uint_t),
"Entity data is not packed correctly any more."
&src->subY + sizeof(uint8_t),
sizeof(uint_t)
);
memcpy(&dst->position, &src->x, sizeof(uint_t));
}
}

View File

@ -0,0 +1,43 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "map.h"
#include "util/memory.h"
shaderbuffer_t MAP_BUFFER;
mapdata_t MAP_DATA;
void mapInit() {
memset(&MAP_DATA, 0, sizeof(mapdata_t));
shaderBufferInit(&MAP_BUFFER, sizeof(mapdata_t));
}
void mapUpdate() {
// Copy map size.
memoryCopyRangeSafe(
&MAP_DATA.mapSize,
&OVERWORLD.mapWidth,
&OVERWORLD.mapHeight + sizeof(uint8_t),
sizeof(uint_t)
);
// Copy tile ids.
memoryCopyRangeSafe(
&MAP_DATA.tileIds,
&OVERWORLD.tileIds[0],
&OVERWORLD.tileIds[OVERWORLD.mapWidth * OVERWORLD.mapHeight],
OVERWORLD_TILE_COUNT_MAX * sizeof(tileid_t)
);
shaderBufferBind(&MAP_BUFFER);
shaderBufferSetData(&MAP_BUFFER, &MAP_DATA);
}
void mapDispose() {
shaderBufferDispose(&MAP_BUFFER);
}

View File

@ -0,0 +1,42 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../../../../dusk/overworld/overworlddefs.h"
#include "../fragments/packed.glsl"
#include "../fragments/quad.glsl"
#define MAP_PACKED_SIZE 4
struct TileData {
uint nothing;
uvec3 _padding0;
};
layout(std140) uniform b_Map {
uint mapSize;
uint mapTileIds[OVERWORLD_TILE_COUNT_MAX / MAP_PACKED_SIZE];
TileData mapTileData[OVERWORLD_TILE_COUNT_MAX];
uvec3 _padding0;
};
vec2 mapTileGetSize() {
return vec2(float(OVERWORLD_TILE_WIDTH), float(OVERWORLD_TILE_HEIGHT));
}
vec2 mapGetVertice(uint instanceIndex, uint indiceIndex) {
vec2 quad = quadGetVertice(indiceIndex);
uint mapWidth = packedGetU8(0u, mapSize);
uint mapHeight = packedGetU8(1u, mapSize);
quad += vec2(
float(instanceIndex % mapWidth),
float(instanceIndex / mapWidth)
);
quad *= mapTileGetSize();
return quad;
}

View File

@ -0,0 +1,44 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma ocne
#include "display/shader/shaderbuffer.h"
#include "overworld/overworld.h"
#define MAP_BLOCK_NAME "b_Map"
#define MAP_PACKED_SIZE 4
typedef struct {
uint32_t nothing;
uvec3_t _padding0;
} maptiledata_t;
typedef struct {
uint_t mapSize;
uvec3_t _padding0;
uint32_t tileIds[OVERWORLD_TILE_COUNT_MAX / MAP_PACKED_SIZE];
maptiledata_t tileData[OVERWORLD_TILE_COUNT_MAX];
} mapdata_t;
extern shaderbuffer_t MAP_BUFFER;
extern mapdata_t MAP_DATA;
/**
* Initializes the map buffer and data.
*/
void mapInit();
/**
* Updates the map buffer with the current data.
*/
void mapUpdate();
/**
* Destroys the map buffer.
*/
void mapDispose();

View File

@ -12,7 +12,7 @@ out vec2 v_TextureCoord;
void main() {
uint instanceIndex = uint(gl_InstanceID);
uint indiceIndex = uint(gl_VertexID % 6);
uint indiceIndex = quadGetIndiceIndex(gl_VertexID);
vec2 vert = entityGetVertice(instanceIndex, indiceIndex);
vec2 uv = quadGetTextureCoordinate(indiceIndex);

View File

@ -7,6 +7,7 @@
#include "assert/assert.h"
#include "assert/assertgl.h"
#include "util/memory.h"
#include "entityshader.h"
#include "entity_vert.glsl.h"
#include "entity_frag.glsl.h"
@ -16,7 +17,7 @@
entityshader_t ENTITY_SHADER;
void entityShaderInit() {
memset(&ENTITY_SHADER, 0, sizeof(entityshader_t));
memoryZero(&ENTITY_SHADER, sizeof(entityshader_t));
shaderInit(
&ENTITY_SHADER.shader,

View File

@ -3,6 +3,14 @@
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
uint quadGetIndiceIndex(uint vertexId) {
return vertexId % 6u;
}
uint quadGetIndiceIndex(int vertexId) {
return quadGetIndiceIndex(uint(vertexId));
}
vec2 quadGetVertice(uint indiceIndex) {
vec2 vert = vec2(0, 0);

View File

@ -0,0 +1,14 @@
# Copyright (c) 2025 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Shaders
glsltool(map_vert.glsl)
glsltool(map_frag.glsl)
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
mapshader.c
)

View File

@ -0,0 +1,16 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../fragments/header.glsl"
// Inputs from vertex shader
in vec2 v_TextureCoord;
// Frag pixel color
out vec4 FragColor;
void main() {
FragColor = vec4(1, 0, 0, 1);
}

View File

@ -0,0 +1,22 @@
// Copyright (c) 2025 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../fragments/header.glsl"
#include "../data/transforms.glsl"
#include "../data/map.glsl"
// Outputs to fragment shader
out vec2 v_TextureCoord;
void main() {
uint instanceIndex = uint(gl_InstanceID);
uint indiceIndex = quadGetIndiceIndex(gl_VertexID);
vec2 vert = mapGetVertice(instanceIndex, indiceIndex);
vec2 uv = quadGetTextureCoordinate(indiceIndex);
gl_Position = transforms.projection * transforms.view * vec4(vert, 0.0, 1.0);
v_TextureCoord = uv;
}

View File

@ -0,0 +1,50 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "mapshader.h"
#include "util/memory.h"
#include "display/shader/data/map.h"
#include "display/shader/data/transforms.h"
#include "map_vert.glsl.h"
#include "map_frag.glsl.h"
mapshader_t MAP_SHADER;
void mapShaderInit() {
memoryZero(&MAP_SHADER, sizeof(mapshader_t));
shaderInit(
&MAP_SHADER.shader,
map_vertShaderSource,
map_fragShaderSource
);
// Uniform blocks
MAP_SHADER.mapBlock = shaderGetBlock(
&MAP_SHADER.shader,
MAP_BLOCK_NAME
);
MAP_SHADER.transformsBlock = shaderGetBlock(
&MAP_SHADER.shader,
TRANSFORMS_BLOCK_NAME
);
// Bind
shaderBufferBindToBlock(&MAP_BUFFER, MAP_SHADER.mapBlock);
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, MAP_SHADER.transformsBlock);
}
void mapShaderUse() {
shaderUse(&MAP_SHADER.shader);
shaderBufferBindToBlock(&MAP_BUFFER, MAP_SHADER.mapBlock);
shaderBufferBindToBlock(&TRANSFORMS_BUFFER, MAP_SHADER.transformsBlock);
}
void mapShaderDispose() {
shaderDispose(&MAP_SHADER.shader);
}

View File

@ -0,0 +1,32 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "display/shader/shader.h"
typedef struct {
shader_t shader;
GLuint mapBlock;
GLuint transformsBlock;
} mapshader_t;
extern mapshader_t MAP_SHADER;
/**
* Initializes the map shader.
*/
void mapShaderInit();
/**
* Uses the map shader.
*/
void mapShaderUse();
/**
* Destroys the map shader.
*/
void mapShaderDispose();

View File

@ -9,16 +9,20 @@
#include "assert/assert.h"
#include "display/shader/data/transforms.h"
#include "display/shader/data/entities.h"
#include "display/shader/data/map.h"
#include "display/shader/entityshader/entityshader.h"
#include "display/shader/mapshader/mapshader.h"
shadermanagerdatacallback_t SHADER_MANAGER_DATA_CALLBACKS[] = {
{ transformsInit, transformsUpdate, transformsDispose },
{ entitiesInit, entitiesUpdate, entitiesDispose }
{ entitiesInit, entitiesUpdate, entitiesDispose },
{ mapInit, mapUpdate, mapDispose }
};
shadermanagershadercallback_t SHADER_MANAGER_SHADER_CALLBACKS[] = {
{ entityShaderInit, entityShaderDispose }
{ entityShaderInit, entityShaderDispose },
{ mapShaderInit, mapShaderDispose }
};
void shaderManagerInit() {

View File

@ -10,6 +10,7 @@
#include "assert/assertgl.h"
#include "asset.h"
#include "util/math.h"
#include "util/memory.h"
#define TEXTURE_BUFFER_SIZE 32768
@ -37,7 +38,7 @@ void textureLoad(
// Decode the image. I can probably stream this in the future.
size_t dataSize = ihdr.width * ihdr.height * 4;// 4 for RGBA
uint8_t *data = (uint8_t *)malloc(dataSize);
uint8_t *data = (uint8_t *)memoryAllocate(dataSize);
assertNotNull(data, "Failed to allocate memory for texture data.");
spng_decode_image(ctx, data, dataSize, SPNG_FMT_RGBA8, 0);
@ -59,7 +60,7 @@ void textureLoad(
0, GL_RGBA, GL_UNSIGNED_BYTE, data
);
assertNoGLError();
free(data);
memoryFree(data);
// Setup texture parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@ -8,10 +8,12 @@
#include "overworld/overworld.h"
#include "display/quad.h"
#include "display/shader/entityshader/entityshader.h"
#include "display/shader/mapshader/mapshader.h"
void overworldRender() {
entityShaderUse();
mapShaderUse();
quadRender(OVERWORLD.mapWidth * OVERWORLD.mapHeight);
// Set entity data.
quadRender(1);
// entityShaderUse();
// quadRender(OVERWORLD.entityCount);
}