summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/immdraw.c13
-rw-r--r--src/render/immdraw.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/render/immdraw.c b/src/render/immdraw.c
index d352ddf..8a10c65 100644
--- a/src/render/immdraw.c
+++ b/src/render/immdraw.c
@@ -28,6 +28,9 @@ void Immdraw_Init(Immdraw_Storage* storage) {
Geometry cone_geo = Geo_CreateCone(1.0, 1.0, 8);
storage->cone = Mesh_Create(&cone_geo, true);
+ Geometry cyl_geo = Geo_CreateCylinder(1.0, 2.0, 8);
+ storage->cylinder = Mesh_Create(&cyl_geo, true);
+
storage->bbox = GenBboxMesh();
// Pipeline / material
@@ -54,7 +57,7 @@ void Immdraw_Init(Immdraw_Storage* storage) {
.vs = { .debug_name = "Immdraw Vertex Shader", .filepath = vert_path, .code = vert_shader },
.fs = { .debug_name = "Immdraw Fragment Shader", .filepath = frag_path, .code = frag_shader },
.depth_test = true,
- .wireframe = false,
+ .wireframe = true,
};
GPU_Renderpass* rpass =
GPU_Renderpass_Create((GPU_RenderpassDesc){ .default_framebuffer = true });
@@ -87,6 +90,12 @@ void Immdraw_Bbox(Transform tf, Vec4 colour, bool wireframe) {
Immdraw_Primitive(tf, CEL_LINE, 1.0, colour, wireframe, imm->bbox);
}
+void Immdraw_Cylinder(Transform tf, Vec4 colour, bool wireframe) {
+ TRACE("Draw cylinder");
+ Immdraw_Storage* imm = Render_GetImmdrawStorage();
+ Immdraw_Primitive(tf, CEL_TRI, 1.0, colour, wireframe, imm->cylinder);
+}
+
void Immdraw_Cone(Transform tf, Vec4 colour, bool wireframe) {
TRACE("Draw cone");
Immdraw_Storage* imm = Render_GetImmdrawStorage();
@@ -164,4 +173,4 @@ Mesh GenBboxMesh() {
.indices = indices };
return Mesh_Create(&geo, true);
-} \ No newline at end of file
+}
diff --git a/src/render/immdraw.h b/src/render/immdraw.h
index cf0bed5..2911350 100644
--- a/src/render/immdraw.h
+++ b/src/render/immdraw.h
@@ -13,6 +13,7 @@ typedef struct Immdraw_Storage {
Mesh plane;
Mesh cube;
Mesh sphere;
+ Mesh cylinder;
Mesh cone;
Mesh bbox;
GPU_Pipeline* colour_pipeline; /** @brief Pipeline for drawing geometry that has vertex colours */
@@ -31,6 +32,7 @@ PUB void Immdraw_Shutdown(Immdraw_Storage* storage);
// These functions cause a pipeline switch and so aren't optimised for performance
PUB void Immdraw_Plane(Transform tf, Vec4 colour, bool wireframe);
PUB void Immdraw_Cuboid(Transform tf, Vec4 colour, bool wireframe);
+PUB void Immdraw_Cylinder(Transform tf, Vec4 colour, bool wireframe);
PUB void Immdraw_Cone(Transform tf, Vec4 colour, bool wireframe);
PUB void Immdraw_Sphere(Transform tf, Vec4 colour, bool wireframe);
PUB void Immdraw_Bbox(Transform tf, Vec4 colour, bool wireframe);