summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-16 18:54:44 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-16 18:54:44 +1000
commita4074b0feb6b2194af7c175fe1826c8e550f10aa (patch)
tree91449852c57936780ae316ed7d4e8ff12e4e24a6 /src/render
parent938e3944fd7d55951e794224e6346488d3c701ea (diff)
cone mesh
Diffstat (limited to 'src/render')
-rw-r--r--src/render/immdraw.c11
-rw-r--r--src/render/immdraw.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/render/immdraw.c b/src/render/immdraw.c
index c2589c3..d352ddf 100644
--- a/src/render/immdraw.c
+++ b/src/render/immdraw.c
@@ -25,6 +25,9 @@ void Immdraw_Init(Immdraw_Storage* storage) {
Geometry plane_geo = Geo_CreatePlane(f32x2(1.0, 1.0), 1, 1);
storage->plane = Mesh_Create(&plane_geo, true);
+ Geometry cone_geo = Geo_CreateCone(1.0, 1.0, 8);
+ storage->cone = Mesh_Create(&cone_geo, true);
+
storage->bbox = GenBboxMesh();
// Pipeline / material
@@ -78,12 +81,18 @@ void Immdraw_Plane(Transform tf, Vec4 colour, bool wireframe) {
Immdraw_Primitive(tf, CEL_TRI, 1.0, colour, wireframe, imm->plane);
}
-PUB void Immdraw_Bbox(Transform tf, Vec4 colour, bool wireframe) {
+void Immdraw_Bbox(Transform tf, Vec4 colour, bool wireframe) {
TRACE("Draw bbox");
Immdraw_Storage* imm = Render_GetImmdrawStorage();
Immdraw_Primitive(tf, CEL_LINE, 1.0, colour, wireframe, imm->bbox);
}
+void Immdraw_Cone(Transform tf, Vec4 colour, bool wireframe) {
+ TRACE("Draw cone");
+ Immdraw_Storage* imm = Render_GetImmdrawStorage();
+ Immdraw_Primitive(tf, CEL_TRI, 1.0, colour, wireframe, imm->cone);
+}
+
void Immdraw_Primitive(Transform tf, PrimitiveTopology topology, f32 size, Vec4 colour,
bool wireframe, Mesh mesh) {
Immdraw_Storage* imm = Render_GetImmdrawStorage();
diff --git a/src/render/immdraw.h b/src/render/immdraw.h
index b205129..cf0bed5 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 cone;
Mesh bbox;
GPU_Pipeline* colour_pipeline; /** @brief Pipeline for drawing geometry that has vertex colours */
} Immdraw_Storage;
@@ -30,6 +31,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_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);