From cfd7266c21a43cbd37fa712725cea85cdd1f7aab Mon Sep 17 00:00:00 2001 From: Omni Date: Fri, 16 Aug 2024 22:44:45 +1000 Subject: cyl mesh and poor mans translation gizmo --- src/render/immdraw.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/render/immdraw.c') 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 +} -- cgit v1.2.3-70-g09d2