summaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/model.cpp b/model.cpp
index 778d945..dac6538 100644
--- a/model.cpp
+++ b/model.cpp
@@ -128,10 +128,12 @@ Asset* Model_Loader::load(
mesh.mvp_binding = shader->descriptor_binding("c_mvp");
mesh.mvp_binding_depth = depth_shader->descriptor_binding("c_mvp");
mesh.mat_binding = shader->descriptor_binding("material");
+ mesh.env_cube_binding = shader->descriptor_binding("env_cube");
mesh.mesh_binding = shader->binding_index("mesh");
assert(mesh.mvp_binding >= 0);
assert(mesh.mat_binding >= 0);
assert(mesh.mesh_binding >= 0);
+ assert(mesh.env_cube_binding >= 0);
pack_read(f, &vertex_size, 4);
pack_read(f, &mesh.count, 4);
pack_read(f, &vertex_count, 4);
@@ -330,6 +332,7 @@ void Model_Instance::render(
Device* dev,
Arena* a,
Render_Pass& pass,
+ Texture_Id env_cubemap,
Sampler_Id sampler
) {
int i, c = m->mesh_count;
@@ -382,6 +385,11 @@ void Model_Instance::render(
i * sizeof(MVP_Cbuffer),
sizeof(MVP_Cbuffer)
);
+ pb.texture(
+ mesh.env_cube_binding,
+ env_cubemap,
+ sampler
+ );
}
pb.cull(Cull_Mode::back);
pb.vertex_format(shader.vf);
@@ -433,12 +441,13 @@ void Model_Scene::render(
Device* dev,
Arena* a,
Render_Pass& pass,
+ Texture_Id env_cubemap,
Sampler_Id sampler
) {
int i;
Model_Instance* instance = instances;
for (i = 0; i < count; i++, instance++)
- instance->render(dev, a, pass, sampler);
+ instance->render(dev, a, pass, env_cubemap, sampler);
}
void Model_Scene::destroy(Device* dev) {