summaryrefslogtreecommitdiff
path: root/src/render/immdraw.c
diff options
context:
space:
mode:
authorOmni <omniscient.oce@gmail.com>2024-08-16 22:44:45 +1000
committerOmni <omniscient.oce@gmail.com>2024-08-16 22:44:45 +1000
commitcfd7266c21a43cbd37fa712725cea85cdd1f7aab (patch)
treed09e6b819497c7823c062136142d9c1c9cfda3fc /src/render/immdraw.c
parenta4074b0feb6b2194af7c175fe1826c8e550f10aa (diff)
cyl mesh and poor mans translation gizmo
Diffstat (limited to 'src/render/immdraw.c')
-rw-r--r--src/render/immdraw.c13
1 files changed, 11 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
+}