diff options
Diffstat (limited to 'gfx/src/core/geometry.h')
-rw-r--r-- | gfx/src/core/geometry.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gfx/src/core/geometry.h b/gfx/src/core/geometry.h new file mode 100644 index 0000000..c37a76f --- /dev/null +++ b/gfx/src/core/geometry.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include <gfx/core.h> | ||
4 | |||
5 | #include "gl_util.h" | ||
6 | |||
7 | #include <stdbool.h> | ||
8 | |||
9 | /// A piece of renderable geometry. | ||
10 | /// | ||
11 | /// The Geometry does not own its buffers, since buffers are typically shared | ||
12 | /// to reduce the memory footprint and the number of draw calls. More generally, | ||
13 | /// the renderer assumes ownership of all rendering resources, which simplifies | ||
14 | /// their management. | ||
15 | typedef struct Geometry { | ||
16 | GLuint vao; | ||
17 | GLenum mode; | ||
18 | GeometryDesc desc; | ||
19 | size_t num_verts; // May differ from the initial value in the descriptor if | ||
20 | // the geometry is updated. | ||
21 | GfxCore* gfxcore; | ||
22 | } Geometry; | ||
23 | |||
24 | /// Create new geometry. | ||
25 | bool gfx_init_geometry(Geometry*, GfxCore*, const GeometryDesc*); | ||
26 | |||
27 | /// Destroy the geometry. | ||
28 | void gfx_del_geometry(Geometry*); | ||