diff --git a/level.cc b/level.cc index d2a64e9..f87186d 100644 --- a/level.cc +++ b/level.cc @@ -20,9 +20,9 @@ void Level::load(Shader shader) { // load the geometry of the stanford bunny and build a VAO: Model model = Model("Bunny.obj"); // load a texture: - Texture texture = Texture("clownfishBunny.png"); + Material material = Material("clownfishBunny.png"); //Create object - Object object = Object(model, texture, glm::vec3(0.0f, 0.0f, 0.0f), + Object object = Object(model, material, glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), shader); objects.push_back(object); diff --git a/level.hh b/level.hh index 8d07a0b..0fc8589 100644 --- a/level.hh +++ b/level.hh @@ -6,6 +6,7 @@ #include "light.hh" #include "entity.hh" #include "terrain.hh" +#include "material.hh" #include "shader.hh" class Level { diff --git a/material.cc b/material.cc index 69aa5d0..a2b2077 100644 --- a/material.cc +++ b/material.cc @@ -1,15 +1,15 @@ -#include "texture.hh" +#include "material.hh" -Texture::Texture(std::string filePath) { +Material::Material(std::string filePath) { reference = ACGL::OpenGL::Texture2DFileManager::the()->get(ACGL::OpenGL::Texture2DCreator(filePath)); } -Texture::Texture() { +Material::Material() { } -Texture::~Texture() { +Material::~Material() { } -ACGL::OpenGL::SharedTexture2D Texture::getReference() { +ACGL::OpenGL::SharedTexture2D Material::getReference() { return reference; } diff --git a/material.hh b/material.hh index 3de1717..e5aced5 100644 --- a/material.hh +++ b/material.hh @@ -1,17 +1,17 @@ -#ifndef TEXTURE_HH_INCLUDED -#define TEXTURE_HH_INCLUDED +#ifndef MATERIAL_HH_INCLUDED +#define MATERIAL_HH_INCLUDED #include #include #include #include -class Texture{ +class Material{ public: - Texture(std::string filePath); - Texture(); + Material(std::string filePath); + Material(); ACGL::OpenGL::SharedTexture2D getReference(); - ~Texture(); + ~Material(); private: ACGL::OpenGL::SharedTexture2D reference; }; diff --git a/object.cc b/object.cc index 65cd7da..abbce98 100644 --- a/object.cc +++ b/object.cc @@ -1,10 +1,10 @@ #include "object.hh" -Object::Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, +Object::Object(Model model, Material material, glm::vec3 position, glm::vec3 rotation, glm::vec3 velocity, glm::vec3 angularVelocity, Shader shader) : Entity(position, rotation) { this->model = model.getReference(); - this->texture = texture.getReference(); + this->material = material; this->velocity = velocity; this->angularVelocity = angularVelocity; this->shader = shader.getReference(); @@ -17,6 +17,6 @@ Object::~Object() { } void Object::render() { - shader->setTexture("uTexture", texture, 0); + shader->setTexture("uTexture", material.getReference(), 0); model->render(); } diff --git a/object.hh b/object.hh index 539ea65..6845050 100644 --- a/object.hh +++ b/object.hh @@ -3,7 +3,7 @@ #include "entity.hh" #include "model.hh" -#include "texture.hh" +#include "material.hh" #include "shader.hh" #include #include @@ -12,14 +12,14 @@ class Object : public Entity { public: - Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, + Object(Model model, Material material, glm::vec3 position, glm::vec3 rotation, glm::vec3 velocity, glm::vec3 angularVelocity, Shader shader); Object(); ~Object(); void render(); private: ACGL::OpenGL::SharedVertexArrayObject model; - ACGL::OpenGL::SharedTexture2D texture; + Material material; glm::vec3 velocity; glm::vec3 angularVelocity; ACGL::OpenGL::SharedShaderProgram shader; diff --git a/terrain.hh b/terrain.hh index c4d9a83..e765ae4 100644 --- a/terrain.hh +++ b/terrain.hh @@ -2,7 +2,7 @@ #define TERRAIN_HH_INCLUDED #include -#include "texture.hh" +#include "material.hh" #include #include #include @@ -10,12 +10,12 @@ class Terrain { public: Terrain(std::string filePath); - Terrain(); + Terrain(); ~Terrain(); void load(); void render(); private: - Texture texture; + Material material; std::string filePath; unsigned int heightmapWidth, heightmapHeight; float** heightmap; //can be accessed like 'float[][]'