diff options
Diffstat (limited to 'src/renderer/builtin_materials.h')
-rw-r--r-- | src/renderer/builtin_materials.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/renderer/builtin_materials.h b/src/renderer/builtin_materials.h index 740ab3d..8d84e53 100644 --- a/src/renderer/builtin_materials.h +++ b/src/renderer/builtin_materials.h @@ -10,8 +10,10 @@ */ #pragma once +#include <assert.h> #include "colours.h" #include "defines.h" +#include "maths.h" #include "ral.h" #include "ral_types.h" @@ -51,7 +53,7 @@ typedef struct pbr_point_light { typedef struct pbr_params_light_uniforms { vec3 viewPos; - pbr_point_light pointLights[4]; + /* pbr_point_light pointLights[4]; */ } pbr_params_light_uniforms; typedef struct pbr_params_bindgroup { @@ -79,7 +81,21 @@ static shader_data_layout pbr_params_shader_layout(void* data) { .stores_data = has_data, .data = { .bytes = { .size = sizeof(pbr_params_light_uniforms) } } }; + printf("Size %d \n", b3.data.bytes.size); + if (has_data) { + b1.data.bytes.data = &d->mvp_matrices; + b2.data.bytes.data = &d->material; + /* d->lights.viewPos = vec3(0, 1, 0); */ + b3.data.bytes.data = &d->lights; + print_vec3(d->lights.viewPos); + } + return (shader_data_layout){ .name = "pbr_params", .bindings = { b1, b2, b3 }, .bindings_count = 3 }; } + +static void* shader_layout_get_binding(shader_data_layout* layout, u32 nth_binding) { + assert(nth_binding < layout->bindings_count); + return &layout->bindings[nth_binding].data; +} |