diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-11 23:00:26 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-11 23:00:26 +1000 |
commit | b03bde3d412148cd573f5f14012cdd270f309947 (patch) | |
tree | 848af582079a60787cc5a5f8138e7ca6d508f2ee /src/render/immdraw.h | |
parent | 48a703e52490cb52fd32e54e3e37f7e70462a267 (diff) |
starting work on immediate mode drawing
Diffstat (limited to 'src/render/immdraw.h')
-rw-r--r-- | src/render/immdraw.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/render/immdraw.h b/src/render/immdraw.h index 0d58375..e635531 100644 --- a/src/render/immdraw.h +++ b/src/render/immdraw.h @@ -6,15 +6,21 @@ #include "defines.h" #include "maths_types.h" #include "ral_impl.h" +#include "ral_types.h" #include "render_types.h" typedef struct Immdraw_Storage { Mesh plane; Mesh cube; Mesh sphere; - GPU_Pipeline* colour_pipeline; + GPU_Pipeline* colour_pipeline; /** @brief Pipeline for drawing geometry that has vertex colours */ } Immdraw_Storage; +typedef struct ImmediateUniforms { + Mat4 model; + Vec4 colour; +} ImmediateUniforms; + // --- Public API PUB void Immdraw_Init(Immdraw_Storage* storage); @@ -24,4 +30,25 @@ PUB void Immdraw_Shutdown(Immdraw_Storage* storage); PUB void Immdraw_Plane(Transform tf, Vec4 colour, bool wireframe); PUB void Immdraw_Cuboid(Transform tf, Vec4 colour, bool wireframe); PUB void Immdraw_Sphere(Transform tf, f32 size, Vec4 colour, bool wireframe); + PUB void Immdraw_TransformGizmo(Transform tf, f32 size); + +// --- Internal + +static ShaderDataLayout ImmediateUniforms_GetLayout(void* data) { + ImmediateUniforms* d = (ImmediateUniforms*)data; + bool has_data = data != NULL; + + ShaderBinding b1 = { + .label = "ImmUniforms", + .kind = BINDING_BYTES, + // .vis = VISIBILITY_VERTEX, + .data.bytes.size = sizeof(ImmediateUniforms) + }; + + if (has_data) { + b1.data.bytes.data = d; + } + + return (ShaderDataLayout) {.bindings = { b1 }, .binding_count = 1}; +} |