Changing all occurences from texture to material.
This commit is contained in:
parent
31447458aa
commit
21b144a72b
4
level.cc
4
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);
|
||||
|
1
level.hh
1
level.hh
@ -6,6 +6,7 @@
|
||||
#include "light.hh"
|
||||
#include "entity.hh"
|
||||
#include "terrain.hh"
|
||||
#include "material.hh"
|
||||
#include "shader.hh"
|
||||
|
||||
class Level {
|
||||
|
10
material.cc
10
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;
|
||||
}
|
||||
|
12
material.hh
12
material.hh
@ -1,17 +1,17 @@
|
||||
#ifndef TEXTURE_HH_INCLUDED
|
||||
#define TEXTURE_HH_INCLUDED
|
||||
#ifndef MATERIAL_HH_INCLUDED
|
||||
#define MATERIAL_HH_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <ACGL/OpenGL/Creator/Texture2DCreator.hh>
|
||||
#include <ACGL/OpenGL/Data/TextureLoadStore.hh>
|
||||
#include <ACGL/OpenGL/Managers.hh>
|
||||
|
||||
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;
|
||||
};
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "entity.hh"
|
||||
#include "model.hh"
|
||||
#include "texture.hh"
|
||||
#include "material.hh"
|
||||
#include "shader.hh"
|
||||
#include <string>
|
||||
#include <ACGL/Math/Math.hh>
|
||||
@ -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;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define TERRAIN_HH_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include "texture.hh"
|
||||
#include "material.hh"
|
||||
#include <fstream>
|
||||
#include <netinet/in.h>
|
||||
#include <ACGL/OpenGL/Objects/VertexArrayObject.hh>
|
||||
@ -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[][]'
|
||||
|
Loading…
Reference in New Issue
Block a user