Created a testing skybox and got the reflection and refraction working.
This commit is contained in:
parent
4ee5058e82
commit
29f1606085
20 changed files with 56 additions and 28 deletions
|
|
@ -1,9 +1,10 @@
|
|||
#include "mesh.hpp"
|
||||
#include "dbc.hpp"
|
||||
|
||||
void Mesh::draw(Shader &shader) {
|
||||
// CAN WE DO THIS LESS OFTEN OUTSIDE DRAWING?
|
||||
apply_textures(shader);
|
||||
void Mesh::draw(Shader &shader, bool with_textures) {
|
||||
if(with_textures) {
|
||||
apply_textures(shader);
|
||||
}
|
||||
|
||||
glBindVertexArray(VAO);
|
||||
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ struct Mesh {
|
|||
setup_mesh();
|
||||
}
|
||||
|
||||
void draw(Shader &shader);
|
||||
void draw(Shader &shader, bool with_textures);
|
||||
void setup_mesh();
|
||||
void apply_textures(const Shader& shader);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ unsigned int texture_from_file(const std::string& directory, const std::string&
|
|||
return textureID;
|
||||
}
|
||||
|
||||
void Model::draw(Shader &shader) {
|
||||
void Model::draw(Shader &shader, bool with_textures) {
|
||||
for(auto& mesh : meshes) {
|
||||
mesh.draw(shader);
|
||||
mesh.draw(shader, with_textures);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct Model {
|
|||
load_model();
|
||||
}
|
||||
|
||||
void draw(Shader &shader);
|
||||
void draw(Shader &shader, bool with_textures=true);
|
||||
|
||||
void load_model();
|
||||
void process_node(const aiScene *scene, aiNode *node);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void Scene::draw_thing(Shader& with_shader, Thing& thing)
|
|||
|
||||
with_shader.setMat4("model", model);
|
||||
|
||||
thing.model.draw(with_shader);
|
||||
thing.model.draw(with_shader, false);
|
||||
}
|
||||
|
||||
void Scene::render(GLFWwindow* window) {
|
||||
|
|
@ -47,6 +47,7 @@ void Scene::render(GLFWwindow* window) {
|
|||
shader.use();
|
||||
shader.setMat4("view", view);
|
||||
shader.setMat4("projection", projection);
|
||||
shader.setVec3("cameraPos", camera.position);
|
||||
|
||||
for(auto& thing : things) {
|
||||
draw_thing(shader, thing);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue