diff options
author | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-17 23:12:42 +1000 |
---|---|---|
committer | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-17 23:12:42 +1000 |
commit | c3737fff1be704e14a2bada69bbf8a6709c5f670 (patch) | |
tree | aa2225901f26598b07855a65a944354fbedc40b1 /src/new_render/shader_layouts.h | |
parent | f8641a5cc4c8baf1f0a7be3685afc219d90143d9 (diff) |
wip shader layouts for common stuff
Diffstat (limited to 'src/new_render/shader_layouts.h')
-rw-r--r-- | src/new_render/shader_layouts.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/new_render/shader_layouts.h b/src/new_render/shader_layouts.h index d1ed1cc..e34e790 100644 --- a/src/new_render/shader_layouts.h +++ b/src/new_render/shader_layouts.h @@ -1,3 +1,58 @@ #pragma once #include "maths_types.h" #include "ral_types.h" + +/** @brief shader layout for camera matrices */ +typedef struct Binding_Camera { + Mat4 view; + Mat4 projection; +} Binding_Camera; + +typedef struct Binding_Model { + Mat4 model; +} Binding_Model; + +/** @brief data that is handy to have in any shader */ +typedef struct Binding_Globals { + +} Binding_Globals; + +typedef struct pbr_point_light { + Vec3 pos; + f32 pad; + Vec3 color; + f32 pad2; +} pbr_point_light; + +typedef struct Binding_PointLights { + pbr_point_light pointLights[4]; + Vec4 viewPos; +} Binding_PointLights; + +static ShaderDataLayout Binding_Camera_GetLayout(void* data) { + Binding_Camera* d = data; + bool has_data = data != NULL; + + ShaderBinding b1 = { + .label = "Camera", + .kind = BINDING_BYTES + }; + if (has_data) { + b1.data.bytes.data = d; + } + return (ShaderDataLayout) {.bindings = {b1 }, .binding_count = 1}; +} + +static ShaderDataLayout Binding_Model_GetLayout(void* data) { + Binding_Model* d = data; + bool has_data = data != NULL; + + ShaderBinding b1 = { + .label = "Model", + .kind = BINDING_BYTES + }; + if (has_data) { + b1.data.bytes.data = d; + } + return (ShaderDataLayout) {.bindings = {b1 }, .binding_count = 1}; +}
\ No newline at end of file |