Can load the backpack model and if you hit R it will be made of glass.
This commit is contained in:
parent
29f1606085
commit
7afef0a930
5 changed files with 28 additions and 14 deletions
|
|
@ -31,12 +31,14 @@ void Scene::draw_thing(Shader& with_shader, Thing& thing)
|
|||
|
||||
with_shader.setMat4("model", model);
|
||||
|
||||
thing.model.draw(with_shader, false);
|
||||
// !reflect_on turns it on? yeah weird
|
||||
thing.model.draw(with_shader, !reflect_on);
|
||||
}
|
||||
|
||||
void Scene::render(GLFWwindow* window) {
|
||||
glm::mat4 view = camera.look_at();
|
||||
glm::mat4 projection = glm::mat4(1.0f);
|
||||
auto& with_shader = reflect_on ? reflect_shader : shader;
|
||||
|
||||
// fov, aspect, near plane, far plane
|
||||
projection = glm::perspective(glm::radians(camera.fov), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
|
||||
|
|
@ -44,13 +46,13 @@ void Scene::render(GLFWwindow* window) {
|
|||
framebuffer.begin();
|
||||
|
||||
// render the scene
|
||||
shader.use();
|
||||
shader.setMat4("view", view);
|
||||
shader.setMat4("projection", projection);
|
||||
shader.setVec3("cameraPos", camera.position);
|
||||
with_shader.use();
|
||||
with_shader.setMat4("view", view);
|
||||
with_shader.setMat4("projection", projection);
|
||||
with_shader.setVec3("cameraPos", camera.position);
|
||||
|
||||
for(auto& thing : things) {
|
||||
draw_thing(shader, thing);
|
||||
draw_thing(with_shader, thing);
|
||||
}
|
||||
|
||||
render_skybox(projection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue