aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gfx/llr/llr.h6
-rw-r--r--include/gfx/llr/material.h1
-rw-r--r--src/core/shader_program.h2
-rw-r--r--src/llr/llr.c12
-rw-r--r--src/llr/mesh_impl.h2
5 files changed, 19 insertions, 4 deletions
diff --git a/include/gfx/llr/llr.h b/include/gfx/llr/llr.h
index 098374d..f84b3fb 100644
--- a/include/gfx/llr/llr.h
+++ b/include/gfx/llr/llr.h
@@ -14,6 +14,9 @@ typedef struct Skeleton Skeleton;
14 14
15typedef struct LLR LLR; 15typedef struct LLR LLR;
16 16
17// -----------------------------------------------------------------------------
18// Low-level rendering.
19
17/// Set the shader to be used for subsequent draw calls. 20/// Set the shader to be used for subsequent draw calls.
18/// The shader is not yet activated at this point. 21/// The shader is not yet activated at this point.
19void gfx_llr_set_shader(LLR*, ShaderProgram*); 22void gfx_llr_set_shader(LLR*, ShaderProgram*);
@@ -44,6 +47,9 @@ void gfx_llr_set_material(LLR*, const Material*);
44/// Set the camera. 47/// Set the camera.
45void gfx_llr_set_camera(LLR*, const Camera*); 48void gfx_llr_set_camera(LLR*, const Camera*);
46 49
50/// Set the projection matrix.
51void gfx_llr_set_projection_matrix(LLR* renderer, const mat4* projection);
52
47/// Set the aspect ratio. 53/// Set the aspect ratio.
48void gfx_llr_set_aspect(LLR*, float aspect); 54void gfx_llr_set_aspect(LLR*, float aspect);
49 55
diff --git a/include/gfx/llr/material.h b/include/gfx/llr/material.h
index bca664e..9ebf9b3 100644
--- a/include/gfx/llr/material.h
+++ b/include/gfx/llr/material.h
@@ -7,6 +7,7 @@ typedef struct Material Material;
7 7
8/// Describes a material. 8/// Describes a material.
9/// 9///
10/// TODO: It doesn't hold the shader program anymore...It's in the Mesh.
10/// A material holds a shader program and a set of shader-specific uniform 11/// A material holds a shader program and a set of shader-specific uniform
11/// variables. Two materials can share the same shader, but shader parameters 12/// variables. Two materials can share the same shader, but shader parameters
12/// generally give two materials a different appearance. 13/// generally give two materials a different appearance.
diff --git a/src/core/shader_program.h b/src/core/shader_program.h
index 1443663..521118d 100644
--- a/src/core/shader_program.h
+++ b/src/core/shader_program.h
@@ -5,8 +5,6 @@
5 5
6#include "gl_util.h" 6#include "gl_util.h"
7 7
8#include <math/fwd.h>
9
10#include <stdbool.h> 8#include <stdbool.h>
11 9
12typedef struct Texture Texture; 10typedef struct Texture Texture;
diff --git a/src/llr/llr.c b/src/llr/llr.c
index fe02c0d..25cdf9f 100644
--- a/src/llr/llr.c
+++ b/src/llr/llr.c
@@ -204,7 +204,10 @@ static void configure_state(LLR* renderer) {
204 if (renderer->material_changed || renderer->shader_changed) { 204 if (renderer->material_changed || renderer->shader_changed) {
205 renderer->material_changed = false; 205 renderer->material_changed = false;
206 206
207 gfx_material_activate(renderer->shader, renderer->material); 207 // Geometry may be rendered without a material.
208 if (renderer->material) {
209 gfx_material_activate(renderer->shader, renderer->material);
210 }
208 } 211 }
209 212
210 if (renderer->shader_changed) { 213 if (renderer->shader_changed) {
@@ -330,6 +333,13 @@ void gfx_llr_set_camera(LLR* renderer, const Camera* camera) {
330 renderer->camera_changed = true; 333 renderer->camera_changed = true;
331} 334}
332 335
336void gfx_llr_set_projection_matrix(LLR* renderer, const mat4* projection) {
337 assert(renderer);
338
339 renderer->projection = *projection;
340 renderer->camera_changed = true;
341}
342
333void gfx_llr_set_aspect(LLR* renderer, float aspect) { 343void gfx_llr_set_aspect(LLR* renderer, float aspect) {
334 assert(renderer); 344 assert(renderer);
335 345
diff --git a/src/llr/mesh_impl.h b/src/llr/mesh_impl.h
index 96e60df..a997d5b 100644
--- a/src/llr/mesh_impl.h
+++ b/src/llr/mesh_impl.h
@@ -5,5 +5,5 @@
5typedef struct Mesh { 5typedef struct Mesh {
6 const Geometry* geometry; 6 const Geometry* geometry;
7 const Material* material; 7 const Material* material;
8 ShaderProgram* shader; 8 ShaderProgram* shader; // TODO: Move this back to Material?
9} Mesh; 9} Mesh;