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/shadows.c | |
parent | f8641a5cc4c8baf1f0a7be3685afc219d90143d9 (diff) |
wip shader layouts for common stuff
Diffstat (limited to 'src/new_render/shadows.c')
-rw-r--r-- | src/new_render/shadows.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/new_render/shadows.c b/src/new_render/shadows.c index 612fd34..24bfb57 100644 --- a/src/new_render/shadows.c +++ b/src/new_render/shadows.c @@ -11,11 +11,6 @@ #include "render_scene.h" #include "render_types.h" -typedef struct ShadowUniforms { - Mat4 light_space; - Mat4 model; -} ShadowUniforms; - ShaderDataLayout ShadowUniforms_GetLayout(void* data) { ShadowUniforms* d = (ShadowUniforms*)data; bool has_data = data != NULL; @@ -102,19 +97,15 @@ void Shadow_ShadowmapExecute(Shadow_Storage* storage, Mat4 light_space_transform for (size_t ent_i = 0; ent_i < entity_count; ent_i++) { RenderEnt renderable = entities[ent_i]; if (renderable.casts_shadows) { - Model* model = MODEL_GET(renderable.model); + // Model* model = MODEL_GET(renderable.model); uniforms.model = renderable.affine; // update the model transform - size_t num_meshes = Mesh_darray_len(model->meshes); - for (u32 mesh_i = 0; mesh_i < num_meshes; mesh_i++) { - Mesh mesh = model->meshes->data[mesh_i]; - - GPU_EncodeBindShaderData(&shadow_encoder, 0, shader_data); - GPU_EncodeSetVertexBuffer(&shadow_encoder, mesh.vertex_buffer); - GPU_EncodeSetIndexBuffer(&shadow_encoder, mesh.index_buffer); - GPU_EncodeDrawIndexed(&shadow_encoder, mesh.geometry->indices->len); - } + Mesh* mesh = renderable.mesh; + GPU_EncodeBindShaderData(&shadow_encoder, 0, shader_data); + GPU_EncodeSetVertexBuffer(&shadow_encoder, mesh->vertex_buffer); + GPU_EncodeSetIndexBuffer(&shadow_encoder, mesh->index_buffer); + GPU_EncodeDrawIndexed(&shadow_encoder, mesh->geometry->indices->len); } } |