commit d7eb12f2301685649964c47cb4a9025c5bc8506a
parent 72a62a1f652db5629d3e5590a794a1b9b0c9b63e
Author: amin <dev@aminmesbah.com>
Date: Mon, 10 Jun 2019 05:06:28 +0000
Rename a few things
FossilOrigin-Name: 6dcfc88501472c27508b937579013868320b507436bee8fedaa9dfffc8ccc9fb
Diffstat:
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/game.c b/src/game.c
@@ -99,7 +99,7 @@ internal void game_init(struct GameMemory *game_memory, v2u framebuffer)
}
}
- render_init(&game_state->renderer, &game_state->world_allocator);
+ renderer_init(&game_state->renderer, &game_state->world_allocator);
// game_shader_load
{
@@ -244,7 +244,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga
}
}
- render_job_enqueue(
+ renderer_job_enqueue(
&game_state->renderer,
(struct RenderJob) {
.ebo = game_state->renderer.quad_ebo,
@@ -309,7 +309,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga
// game_detect_collisions
{
-#define RENDER_COLLISION_DEBUG_QUAD(r, c) render_debug_quad(&game_state->renderer, (r), (c));
+#define RENDER_COLLISION_DEBUG_QUAD(r, c) renderer_debug_quad_draw(&game_state->renderer, (r), (c));
v2 player_delta = math_v2f_m(player->velocity, dt);
v2 new_p = math_v2_a(player->pos.local, player_delta);
@@ -531,7 +531,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga
v3 color = (v3) { 1.0f, 0.0f, 1.0f };
- render_job_enqueue(
+ renderer_job_enqueue(
&game_state->renderer,
(struct RenderJob) {
.ebo = game_state->renderer.quad_ebo,
@@ -541,15 +541,15 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga
});
}
- render_jobs_sort(&game_state->renderer, &game_state->world_allocator);
- render_jobs_draw(&game_state->renderer);
+ renderer_jobs_sort(&game_state->renderer, &game_state->world_allocator);
+ renderer_jobs_draw(&game_state->renderer);
}
internal void game_cleanup(struct GameMemory *game_memory)
{
assert(sizeof(struct GameState) <= game_memory->buffer_size);
struct GameState *game_state = (struct GameState *)game_memory->buffer;
- render_cleanup(&game_state->renderer);
+ renderer_cleanup(&game_state->renderer);
}
#ifdef PLATFORM_HOTLOAD_GAME_CODE
diff --git a/src/render.c b/src/render.c
@@ -1,4 +1,4 @@
-internal void render_init(struct RendererState *renderer, struct StackAllocator *allocator)
+internal void renderer_init(struct RendererState *renderer, struct StackAllocator *allocator)
{
GLfloat quad_vertices[] = {
0.5f, 0.5f,
@@ -51,7 +51,7 @@ internal void render_init(struct RendererState *renderer, struct StackAllocator
renderer->queue_count = 0;
}
-internal void render_jobs_draw(struct RendererState *renderer)
+internal void renderer_jobs_draw(struct RendererState *renderer)
{
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
@@ -74,7 +74,7 @@ internal void render_jobs_draw(struct RendererState *renderer)
if (current_ebo != j.ebo)
{
current_ebo = j.ebo;
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, j.ebo);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo);
}
shader_setv3(&renderer->shader, "color", &j.color);
shader_setm4(&renderer->shader, "model", &j.model);
@@ -97,16 +97,16 @@ internal void render_jobs_draw(struct RendererState *renderer)
renderer->queue_count = 0;
}
-internal void render_jobs_sort(struct RendererState *renderer, struct StackAllocator *allocator)
+internal void renderer_jobs_sort(struct RendererState *renderer, struct StackAllocator *allocator)
{
- size_t marker = mem_st_get_marker(allocator);
+ size_t free_marker = mem_st_get_marker(allocator);
- struct RenderJob *queue = renderer->queue;
+ struct RenderJob *job_queue = renderer->queue;
size_t layer_pop_count[NUM_RENDER_LAYERS] = {0};
for (size_t i = 0; i < renderer->queue_count; i++)
{
- struct RenderJob j = queue[i];
+ struct RenderJob j = job_queue[i];
assert(j.layer < NUM_RENDER_LAYERS);
layer_pop_count[j.layer] += 1;
}
@@ -124,7 +124,7 @@ internal void render_jobs_sort(struct RendererState *renderer, struct StackAlloc
size_t layer_pop_count_sorted[NUM_RENDER_LAYERS] = {0};
for (size_t i = 0; i < renderer->queue_count; i++)
{
- struct RenderJob j = queue[i];
+ struct RenderJob j = job_queue[i];
assert(j.layer < NUM_RENDER_LAYERS);
size_t insertion_index = 0;
@@ -139,11 +139,11 @@ internal void render_jobs_sort(struct RendererState *renderer, struct StackAlloc
layer_pop_count_sorted[j.layer] += 1;
}
- mem_move_buffer(queue, sorted, struct RenderJob, renderer->queue_count);
- mem_st_free_to_marker(allocator, marker);
+ mem_move_buffer(job_queue, sorted, struct RenderJob, renderer->queue_count);
+ mem_st_free_to_marker(allocator, free_marker);
}
-internal void render_job_enqueue(struct RendererState *renderer, struct RenderJob job)
+internal void renderer_job_enqueue(struct RendererState *renderer, struct RenderJob job)
{
assert(renderer);
assert(renderer->queue);
@@ -152,7 +152,7 @@ internal void render_job_enqueue(struct RendererState *renderer, struct RenderJo
renderer->queue_count++;
}
-internal void render_debug_quad(struct RendererState *renderer, rect r, v3 color)
+internal void renderer_debug_quad_draw(struct RendererState *renderer, rect r, v3 color)
{
v2 dim = {r.max.x - r.min.x, r.max.y - r.min.y};
@@ -161,7 +161,7 @@ internal void render_debug_quad(struct RendererState *renderer, rect r, v3 color
model = math_translate(model, (v3) {r.min.x, r.min.y, 0.0f});
model = math_scale(model, (v3) {dim.width, dim.height, 1.0f});
- render_job_enqueue(
+ renderer_job_enqueue(
renderer,
(struct RenderJob) {
.ebo = renderer->rect_ebo,
@@ -171,7 +171,7 @@ internal void render_debug_quad(struct RendererState *renderer, rect r, v3 color
});
}
-internal void render_cleanup(struct RendererState *renderer)
+internal void renderer_cleanup(struct RendererState *renderer)
{
glDeleteVertexArrays(1, &renderer->vao);
glDeleteBuffers(1, &renderer->quad_vbo);
diff --git a/src/render.h b/src/render.h
@@ -2,7 +2,7 @@
enum RenderLayer
{
- RENDER_LAYER_TILES = 0,
+ RENDER_LAYER_TILES,
RENDER_LAYER_PLAYER,
RENDER_LAYER_DEBUG,