aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-07-04 10:27:06 -0700
committer3gg <3gg@shellblade.net>2025-07-04 10:27:06 -0700
commit1ec46bead3cf87971a2329f9ef4ddde5a0c48325 (patch)
tree3f4c404467c3ad9c94265295f4aa1b97a10a9eb3 /include
parente386405ac636b7e4a41d5c03eb363e9c120ce919 (diff)
Clarify doc
Diffstat (limited to 'include')
-rw-r--r--include/gfx/core.h3
-rw-r--r--include/gfx/llr/light.h (renamed from include/gfx/scene/light.h)0
-rw-r--r--include/gfx/llr/llr.h117
-rw-r--r--include/gfx/llr/material.h (renamed from include/gfx/scene/material.h)0
-rw-r--r--include/gfx/llr/mesh.h (renamed from include/gfx/scene/mesh.h)0
5 files changed, 120 insertions, 0 deletions
diff --git a/include/gfx/core.h b/include/gfx/core.h
index 2a29003..0cf4465 100644
--- a/include/gfx/core.h
+++ b/include/gfx/core.h
@@ -474,6 +474,9 @@ void gfx_deactivate_shader_program(const ShaderProgram*);
474/// 474///
475/// This function should be called after setting all of the uniform variables 475/// This function should be called after setting all of the uniform variables
476/// and prior to issuing a draw call. 476/// and prior to issuing a draw call.
477///
478/// The given program must have been activated prior to this call with
479/// gfx_activate_shader_program().
477void gfx_apply_uniforms(const ShaderProgram*); 480void gfx_apply_uniforms(const ShaderProgram*);
478 481
479/// Set the texture uniform. 482/// Set the texture uniform.
diff --git a/include/gfx/scene/light.h b/include/gfx/llr/light.h
index 132e344..132e344 100644
--- a/include/gfx/scene/light.h
+++ b/include/gfx/llr/light.h
diff --git a/include/gfx/llr/llr.h b/include/gfx/llr/llr.h
new file mode 100644
index 0000000..49b7706
--- /dev/null
+++ b/include/gfx/llr/llr.h
@@ -0,0 +1,117 @@
1#pragma once
2
3#include <math/aabb2.h>
4#include <math/aabb3.h>
5#include <math/camera.h>
6#include <math/mat4.h>
7#include <math/vec3.h>
8#include <math/vec4.h>
9
10typedef struct Anima Anima;
11typedef struct Light Light;
12typedef struct Mesh Mesh;
13typedef struct Skeleton Skeleton;
14
15typedef struct ImmRenderer ImmRenderer;
16
17/// Prepare the graphics systems for immediate-mode rendering.
18///
19/// Call this before issuing any immediate-mode rendering draws.
20void gfx_imm_start(ImmRenderer*);
21
22/// End immediate mode rendering.
23///
24/// Call this after issuing immediate-mode rendering draws and before swapping
25/// buffers.
26void gfx_imm_end(ImmRenderer*);
27
28// -----------------------------------------------------------------------------
29// Immediate-mode rendering of scene elements.
30//
31// This renders models and meshes under lighting. It is up to the client to
32// determine visibility, sort the calls optimally, etc.
33
34/// Push a light into the lights stack.
35void gfx_imm_push_light(ImmRenderer*, Light*);
36
37/// Pop the last light from the lights stack.
38void gfx_imm_pop_light(ImmRenderer*);
39
40/// Load a skeleton.
41///
42/// If a skeleton is loaded, subsequent meshes are rendered with joint data
43/// passed to the shader. This has a cost, so if subsequent meshes are not
44/// animated, unload the skeleton prior to rendering them.
45void gfx_imm_set_skeleton(ImmRenderer*, const Anima*, const Skeleton*);
46
47/// Unload the loaded skeleton.
48void gfx_imm_unset_skeleton(ImmRenderer*);
49
50/// Render the mesh.
51void gfx_imm_render_mesh(ImmRenderer*, const Mesh*);
52
53// -----------------------------------------------------------------------------
54// Immediate-mode rendering of primitives.
55//
56// This is rather inefficient and should be reserved for debug rendering. It
57// also does not support lighting; the primitives are rendered with a constant
58// colour.
59
60/// Draw a set of triangles.
61void gfx_imm_draw_triangles(ImmRenderer*, const vec3[], size_t num_triangles);
62
63/// Draw a triangle.
64void gfx_imm_draw_triangle(ImmRenderer*, const vec3[3]);
65
66/// Draw a bounding box.
67void gfx_imm_draw_aabb2(ImmRenderer*, aabb2);
68
69/// Draw a bounding box.
70void gfx_imm_draw_aabb3(ImmRenderer*, aabb3);
71
72/// Draw a box.
73///
74/// The vertices must be given in the following order:
75///
76/// 7 ----- 6
77/// / /|
78/// 3 ----- 2 |
79/// | | |
80/// | 4 ----- 5
81/// |/ |/
82/// 0 ----- 1
83void gfx_imm_draw_box3(ImmRenderer* renderer, const vec3 vertices[8]);
84
85/// Set the render colour.
86void gfx_imm_set_colour(ImmRenderer*, vec4 colour);
87
88// -----------------------------------------------------------------------------
89// Matrix stack manipulation.
90//
91// Common to both scene and and primitive rendering.
92
93/// Load an identity model matrix. Clears the matrix stack.
94void gfx_imm_load_identity(ImmRenderer* renderer);
95
96/// Push the given matrix to the matrix stack.
97void gfx_imm_push_matrix(ImmRenderer* renderer, const mat4* matrix);
98
99/// Pop the top of the matrix stack.
100void gfx_imm_pop_matrix(ImmRenderer* renderer);
101
102/// Push a translation matrix to the matrix stack.
103void gfx_imm_translate(ImmRenderer* renderer, vec3 offset);
104
105/// Set the model matrix. Clears the matrix stack.
106void gfx_imm_set_model_matrix(ImmRenderer*, const mat4*);
107
108// -----------------------------------------------------------------------------
109// Camera
110//
111// Common to both scene and and primitive rendering.
112
113/// Set the camera.
114void gfx_imm_set_camera(ImmRenderer*, const Camera*);
115
116/// Set the view-projection matrix.
117// void gfx_imm_set_view_projection_matrix(ImmRenderer*, const mat4*);
diff --git a/include/gfx/scene/material.h b/include/gfx/llr/material.h
index bca664e..bca664e 100644
--- a/include/gfx/scene/material.h
+++ b/include/gfx/llr/material.h
diff --git a/include/gfx/scene/mesh.h b/include/gfx/llr/mesh.h
index 0d3b4d4..0d3b4d4 100644
--- a/include/gfx/scene/mesh.h
+++ b/include/gfx/llr/mesh.h