#include "Fps.h"
#include "Events.h"
+#include "Graphix\SkyBox.h"
+
#include "Graphix\Model.h"
#include "Message.h"
layer[0] = tmp_Scene;
//SKYBOX! ---------------------------
- // tmp_Scene->addObject(new SceneObject(shaderSky, glm::mat4(1.0f), "SkyBox.dae", "skybox.jpg"));
- //Message::info("Error from before?");
- //Graphix::getGlError();
- skybox = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
- //Message::info("Creating SkyBox Shader");
- //Graphix::getGlError();
- SkyBox = new SceneObject(skybox, mat4(1.f), "SkyBox.dae", "skybox_CUBE.jpg");
- //Message::info("Creating SkyBox SceneObject"); rotate((float)M_PI_2, vec3(1.f, 0.f, 0.f))
- //Graphix::getGlError();
- //Message::info("Done");
-
- //tmp_Scene->addObject(new SceneObject(shader1, rotate((float)M_PI_2,vec3(1.f,0.f,0.f)), "SkyBox.dae", "skybox.jpg"));
-
- //tmp_Scene->addObject(SkyBox);
+ shader_skybox = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
+ //texture_skybox = new Texture("skybox_CUBE.jpg");
+
+ tmp_Scene->addObject(new SceneObject(shader_skybox, scale(3.f * vec3(1.f, .3f, 1.f)), new SkyBox(), "skybox_CUBE.jpg"));
//SKYBOX! ----------------------------
//Allg Shader
using std::map;
+#include "Graphix\Shader.h"
+#include "Graphix\Texture.h"
+#include "Graphix\Model.h"
class Game
{
void draw() const;
//bool import(const string &path, Scene *scene, Shader* shader);
- Shader* skybox;
- SceneObject* SkyBox;
+ Shader* shader_skybox;
+ Texture* texture_skybox;
+ Model* model_skybox;
};
-IMesh::IMesh(const string& _modelpath, uint _mindex) :
-numfaces(-1),
-numvertices(-1),
-vertexBuffer(-1),
-normalBuffer(-1),
-uvBuffer(-1),
-indexBuffer(-1)
+IMesh::IMesh(const string& _modelpath, uint _mindex)
{
float *vertex = nullptr, *normals = nullptr, *uvs = nullptr;
uint *index = nullptr;
- aiMesh* mesh = import(_modelpath, _mindex);
-
- import(mesh, numvertices, numfaces, vertex, uvs, normals, index);
+ import(_modelpath, numvertices, numfaces, vertex, uvs, normals, index, _mindex);
genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex);
genBuffer(normalBuffer, numvertices * 3 * sizeof(float), (void*)normals);
genBuffer(uvBuffer, numvertices * 2 * sizeof(float), (void*)uvs);
genBuffer(indexBuffer, numfaces * 3 * sizeof(uint), (void*)index);
- delete vertex, normals, uvs, index, mesh;
+ delete vertex, normals, uvs, index;
}
-IMesh::IMesh(const aiMesh* _mesh) :
-numfaces(-1),
-numvertices(-1),
-vertexBuffer(-1),
-normalBuffer(-1),
-uvBuffer(-1),
-indexBuffer(-1)
+IMesh::IMesh(const aiMesh* _mesh)
{
float *vertex = nullptr, *normals = nullptr, *uvs = nullptr;
IMesh::~IMesh()
{
glDeleteBuffers(1, &vertexBuffer);
+ glDeleteBuffers(1, &indexBuffer);
glDeleteBuffers(1, &normalBuffer);
glDeleteBuffers(1, &uvBuffer);
- glDeleteBuffers(1, &indexBuffer);
-
}
-//void IMesh::useModel(Shader* _shader)
+
+
+//void IMesh::drawModel(Shader* _shader, Texture* _texture, const mat4& _modelMat) const
//{
-// uint vao=-1;
-// auto i = shader_map.find(*_shader);
-// if (i == shader_map.end())
-// vao = bindShader(_shader);
-// else
-// vao = i->second;
-//
-// glBindVertexArray(vao);
-// _shader->useShader();
//
//}
-void IMesh::useModel(Shader* _shader) const
-{
- _shader->useShader();
- uint vao = -1;
- auto i = shader_map.find(*_shader);
- if (i == shader_map.end())
- Message::error("The Shader wasn't bind to the IMesh.\n");
- else
- vao = i->second;
-
- glBindVertexArray(vao);
-
-
-}
-
-void IMesh::useTexture(Texture* _texture, Shader* _shader) const
-{
- if (_texture != nullptr)
- {
- auto tmp = _shader->getUniformLocation("uColorTexture");
- if (tmp < 0){
- return;
- }
- int unit = 0;
- _texture->bind(unit);
- glUniform1i(tmp, unit);
- }
-}
-
-void IMesh::useModelMat(const mat4& _model, Shader* _shader) const
-{
- int tmp = _shader->getUniformLocation("uModel");
- if (tmp >= 0)
- glUniformMatrix4fv(tmp, 1, GL_FALSE, value_ptr(_model));
-}
-
-void IMesh::drawModel(Shader* _shader, Texture* _texture, const mat4& _model) const
-{
- //Message::info("Error from before?");
- //Graphix::getGlError();
- useModel(_shader);
- //Message::info("IMesh loading Coordinates");
- //Graphix::getGlError();
- useTexture(_texture, _shader);
- //Message::info("IMesh loading Texture");
- //Graphix::getGlError();
- useModelMat(_model, _shader);
- //Message::info("IMesh loading MMatrix");
- //Graphix::getGlError();
- glDrawElements(GL_TRIANGLES, numfaces * 3, GL_UNSIGNED_INT, 0);
- //Message::info("IMesh drawing Elements");
- //Graphix::getGlError();
- glBindVertexArray(0);
- //system("pause");
-}
-
-void IMesh::bindShader(Shader* _shader)
-{
- //Message::info("bindShader");
- //Graphix::getGlError();
- //Message::info("Do Stuff");
- uint vao;
- glGenVertexArrays(1, &vao);
- glBindVertexArray(vao);
-
- //Message::info("bindVAO");
- //Graphix::getGlError();
-
- bindBuffer(vertexBuffer, _shader->getAttribLocation("aPosition"));
- //Message::info("aPosition");
- //Graphix::getGlError();
- bindBuffer(uvBuffer, _shader->getAttribLocation("aUV"), 2);
- //Message::info("aUV");
- //Graphix::getGlError();
- bindBuffer(normalBuffer, _shader->getAttribLocation("aNormal"));
- //Message::info("aNormal");
- //Graphix::getGlError();
-
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
- //Message::info("bindIndexBuffer");
- //Graphix::getGlError();
-
- glBindVertexArray(0);
-
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-
- shader_map[*_shader] = vao;
-
- //Message::info("cleanUp");
- //Graphix::getGlError();
- //Message::info("Done");
-
-}
-
-void IMesh::genBuffer(uint &buffer, uint size, void* value)
-{
- glGenBuffers(1, &buffer);
- glBindBuffer(GL_ARRAY_BUFFER, buffer);
- glBufferData(GL_ARRAY_BUFFER, size, value, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-void IMesh::bindBuffer(const uint &buffer, const uint index, const uint dim)
-{
- //Falls index nicht gefunden werden konnte
- if (index == (uint)-1)
- {
- Message::info("IMesh: BindBuffer wird ausgelassen da index fehlerhaft ist.");
- return;
- }
-
- glBindBuffer(GL_ARRAY_BUFFER, buffer);
- glEnableVertexAttribArray(index);
- glVertexAttribPointer(index, dim, GL_FLOAT, GL_FALSE, 0, 0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
+//void IMesh::bindShader(Shader* _shader)
+//{
+//
+//}
-aiMesh* IMesh::import(const string& _modelpath, uint _mindex) const
+bool IMesh::import(const string& _modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index, uint _mindex) const
{
Assimp::Importer importer;
if (!scene)
{
Message::error("The file " + _modelpath + " couldn't be read.\n" + importer.GetErrorString());
- return nullptr;
+ return false;
}
if (!scene->HasMeshes() || scene->mNumMeshes <= _mindex)
{
Message::error("The file " + _modelpath + " doesn't contain any nodes.");
- return nullptr;
+ return false;
}
- return scene->mMeshes[_mindex];
+ return import(scene->mMeshes[_mindex], numvertices, numfaces, vertex, uvs, normals, index);
}
bool IMesh::import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index) const
class Texture;
struct aiMesh;
-class IMesh : Model
+class IMesh : public Model
{
public:
IMesh(const string& modelpath, uint index=0);
virtual ~IMesh();
- void drawModel(Shader* shader, Texture* texture, const mat4& modelMat) const;
+ //void drawModel(Shader* shader, Texture* texture, const mat4& modelMat) const;
- void bindShader(Shader* shader);
+ //void bindShader(Shader* shader);
protected:
- uint numvertices, numfaces;
- uint vertexBuffer, normalBuffer, uvBuffer, indexBuffer;
// Mesh Speichern?
- aiMesh* import(const string& modelpath, uint mindex = 0) const;
+ bool import(const string& modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index , uint mindex = 0) const;
bool import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index) const;
- void genBuffer(uint &buffer, uint size, void* value);
- void bindBuffer(const uint &buffer, const uint index,const uint dim = 3);
- void useModel(Shader* shader) const;
- void useTexture(Texture* texture, Shader* shader) const;
- void useModelMat(const mat4& model, Shader* shader) const;
if (scene->HasMeshes())// && scene->mNumMeshes > mindex)
{
- IMesh* tmp_model=nullptr;
for (unsigned int i = 0; i < scene->mNumMeshes; i++)
{
models.push_back(new IMesh(scene->mMeshes[i]));
return;
}
-
}
IMetaMesh::~IMetaMesh()
class Shader;
class Texture;
-class IMetaMesh : Model
+class IMetaMesh : public Model
{
public:
IMetaMesh(const string& modelpath);
#include "Model.h"
#include <GL/glew.h>
+#include "../Message.h"
+#include "Shader.h"
+#include "Texture.h"
-Model::Model()
+#include "Graphix.h"
+
+Model::Model() :
+ numfaces(0),
+ numvertices(0),
+ vertexBuffer(-1),
+ normalBuffer(-1),
+ uvBuffer(-1),
+ indexBuffer(-1)
{
}
void Model::bindShader(Shader* _shader)
{
+ //Message::info("bindShader");
+ //Graphix::getGlError();
+ //Message::info("Do Stuff");
+
+ if (indexBuffer == (uint)-1)
+ {
+ Message::error("Model: IndexBuffer wurde nicht geladen.");
+ return;
+ }
+
+ uint vao;
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
+
+ //Message::info("bindVAO");
+ //Graphix::getGlError();
+ if (vertexBuffer != (uint)-1)
+ bindBuffer(vertexBuffer, _shader->getAttribLocation("aPosition"));
+ //Message::info("aPosition");
+ //Graphix::getGlError();
+ if (uvBuffer != (uint)-1)
+ bindBuffer(uvBuffer, _shader->getAttribLocation("aUV"), 2);
+ //Message::info("aUV");
+ //Graphix::getGlError();
+ if (normalBuffer != (uint)-1)
+ bindBuffer(normalBuffer, _shader->getAttribLocation("aNormal"));
+ //Message::info("aNormal");
+ //Graphix::getGlError();
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
+ //Message::info("bindIndexBuffer");
+ //Graphix::getGlError();
+
+ glBindVertexArray(0);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ shader_map[*_shader] = vao;
+
+ //Message::info("cleanUp");
+ //Graphix::getGlError();
+ //Message::info("Done");
}
void Model::drawModel(Shader* _shader, Texture* _texture, const mat4& _modelMat) const
{
+ //Message::info("Error from before?");
+ //Graphix::getGlError();
+ useModel(_shader);
+ //Message::info("IMesh loading Coordinates");
+ //Graphix::getGlError();
+ useTexture(_texture, _shader);
+ //Message::info("IMesh loading Texture");
+ //Graphix::getGlError();
+ useModelMat(_modelMat, _shader);
+ //Message::info("IMesh loading MMatrix");
+ //Graphix::getGlError();
+ glDrawElements(GL_TRIANGLES, numfaces * 3, GL_UNSIGNED_INT, 0);
+ //Message::info("IMesh drawing Elements");
+ //Graphix::getGlError();
+ glBindVertexArray(0);
+ //system("pause");
}
void Model::drawBBox() const
BBsize = _max - _min;
BBposition = (_min + _max) / 2.f;
}
+
+void Model::genBuffer(uint &buffer, uint size, void* value)
+{
+ glGenBuffers(1, &buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, buffer);
+ glBufferData(GL_ARRAY_BUFFER, size, value, GL_STATIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
+void Model::bindBuffer(const uint &buffer, const uint index, const uint dim)
+{
+ //Falls index nicht gefunden werden konnte
+ if (index == (uint)-1)
+ {
+ Message::info("Model: BindBuffer wird ausgelassen da index fehlerhaft ist.");
+ return;
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, buffer);
+ glEnableVertexAttribArray(index);
+ glVertexAttribPointer(index, dim, GL_FLOAT, GL_FALSE, 0, 0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
+void Model::useModel(Shader* _shader) const
+{
+ _shader->useShader();
+ uint vao = -1;
+ auto i = shader_map.find(*_shader);
+ if (i == shader_map.end())
+ Message::error("The Shader wasn't bind to the Model.\n");
+ else
+ vao = i->second;
+
+ glBindVertexArray(vao);
+
+}
+
+void Model::useTexture(Texture* _texture, Shader* _shader) const
+{
+ if (_texture != nullptr)
+ {
+ auto tmp = _shader->getUniformLocation("uColorTexture");
+ if (tmp < 0){
+ return;
+ }
+ int unit = 0;
+ _texture->bind(unit);
+ glUniform1i(tmp, unit);
+ }
+}
+
+void Model::useModelMat(const mat4& _model, Shader* _shader) const
+{
+ int tmp = _shader->getUniformLocation("uModel");
+ if (tmp >= 0)
+ glUniformMatrix4fv(tmp, 1, GL_FALSE, value_ptr(_model));
+}
virtual void drawBBox() const;
protected:
+ uint numvertices, numfaces;
+ uint vertexBuffer, indexBuffer, normalBuffer, uvBuffer;
std::unordered_map<uint, uint> shader_map;
void updateBB(const vec3& min, const vec3& max);
+ void genBuffer(uint &buffer, uint size, void* value);
+ void bindBuffer(const uint &buffer, const uint index, const uint dim = 3);
+
+ virtual void useModel(Shader* shader) const;
+ virtual void useTexture(Texture* texture, Shader* shader) const;
+ virtual void useModelMat(const mat4& model, Shader* shader) const;
+
private:
vec3 BBsize, BBposition;
SceneObject* lookat;
+
bool newObjects;
SceneList* SceneObjects;
set<Shader*>* ShaderSet;
#include "Scene.h"
#include "Texture.h"
+#include "IMesh.h"
+#include "IMetaMesh.h"
+
#include "Graphix.h"
using std::string;
using std::cout;
using std::endl;
-SceneObject::SceneObject(Shader* _shader, mat4& _model, string _modelpath, string texturepath, unsigned int _model_index) :
-IMetaMesh(_modelpath),
-model(_model),
+SceneObject::SceneObject(Shader* _shader, mat4& _modelMat, string _modelpath, string texturepath, unsigned int _model_index) :
+model(new IMetaMesh(_modelpath)),
+modelMat(_modelMat),
shader(_shader),
mainScene(NULL),
collision_ignore(false),
{
//Message::info("Error from befor?");
//Graphix::getGlError();
- new IMetaMesh(_modelpath);
- //Message::info("Creating Model");
+// new IMetaMesh(_modelpath);
+ //Message::info("Creating modelMat");
//Graphix::getGlError();
- //modelID = _shader->getUniformLocation("model");
+ //modelID = _shader->getUniformLocation("modelMat");
if (texturepath!="")
texture = new Texture(texturepath);
//Message::info("Creating SkyBox Shader");
//Graphix::getGlError();
- bindShader(shader);
+ model->bindShader(shader);
+ //Message::info("Binding Shader");
+ //Graphix::getGlError();
+ //Message::info("Done");
+
+}
+
+SceneObject::SceneObject(Shader* _shader, mat4& _modelMat, Model* _model, string texturepath) :
+model(_model),
+modelMat(_modelMat),
+shader(_shader),
+mainScene(NULL),
+collision_ignore(false),
+texture(nullptr)
+{
+ //Message::info("Error from befor?");
+ //Graphix::getGlError();
+ // new IMetaMesh(_modelpath);
+ //Message::info("Creating modelMat");
+ //Graphix::getGlError();
+ //modelID = _shader->getUniformLocation("modelMat");
+ if (texturepath != "")
+ texture = new Texture(texturepath);
+ //Message::info("Creating SkyBox Shader");
+ //Graphix::getGlError();
+
+ model->bindShader(shader);
//Message::info("Binding Shader");
//Graphix::getGlError();
//Message::info("Done");
}
-//SceneObject::SceneObject(Shader* _shader, mat4& _model, IMesh* model_obj, string texturepath) :
+//SceneObject::SceneObject(Shader* _shader, mat4& _modelMat, IMesh* model_obj, string texturepath) :
//IMesh(*model_obj),
-//model(_model),
+//modelMat(_modelMat),
//shader(_shader),
//mainScene(NULL),
//collision_ignore(false),
//texture(nullptr)
//{
-// modelID = _shader->getUniformLocation("model");
+// modelID = _shader->getUniformLocation("modelMat");
// if (texturepath != "")
// texture = new Texture(texturepath);
//
- //model = scale(model, vec3(matter));
- //model = (deltaT * spin) * model; //TODO drehen scheint nicht zu funktionieren
+ //modelMat = scale(modelMat, vec3(matter));
+ //modelMat = (deltaT * spin) * modelMat; //TODO drehen scheint nicht zu funktionieren
}
// useTexture(texture, shader);
-// useMMatrix(model,shader);
+// useMMatrix(modelMat,shader);
// glUniform1i(shader->getUniformLocation ("inv"), 1);
// drawModel();
- drawModel(shader, texture, model);
+ model->drawModel(shader, texture, modelMat);
}
void SceneObject::collisions(SceneObject* _other)
}
vec3 SceneObject::getPosition() const{
- return vec3(model[3]);
+ return vec3(modelMat[3]);
}
-void SceneObject::setModel(mat4& _model){
- model = _model;
+void SceneObject::setModel(mat4& _modelMat){
+ modelMat = _modelMat;
}
void SceneObject::turn(float angle, vec3& axis){
//vec3 pos = getPosition();
- //model = rotate(degree, axis)*model;
- //model = model*translate(pos - getPosition());
- model = model * rotate(angle, axis);
+ //modelMat = rotate(degree, axis)*modelMat;
+ //modelMat = modelMat*translate(pos - getPosition());
+ modelMat = modelMat * rotate(angle, axis);
}
void SceneObject::turnTo(vec3& direction, float speed){
vec3 pos = getPosition();
float perc = 1;
- model = translate(-pos) * model;
- float rot_angle = orientedAngle(normalize((vec3)(model * vec4(0.f, 0.f, 1.f, 1.f))), direction, vec3(0.f, 1.f, 0.f));
+ modelMat = translate(-pos) * modelMat;
+ float rot_angle = orientedAngle(normalize((vec3)(modelMat * vec4(0.f, 0.f, 1.f, 1.f))), direction, vec3(0.f, 1.f, 0.f));
if (abs(rot_angle) / M_PI > speed)
perc = speed / abs(rot_angle) * M_PI;
- model = rotate(rot_angle *perc , vec3(0.f, 1.f, 0.f)) * model;
- model = translate(pos) * model;
+ modelMat = rotate(rot_angle *perc , vec3(0.f, 1.f, 0.f)) * modelMat;
+ modelMat = translate(pos) * modelMat;
}
void SceneObject::move(vec3& dist){
- model = translate(dist) * model;
+ modelMat = translate(dist) * modelMat;
}
//SceneObject* SceneObject::copy()
//{
-// return new SceneObject(shader, model, modelpath, *texture);
+// return new SceneObject(shader, modelMat, modelpath, *texture);
//}
//
#include "GLM.h"
#include "Drawable.h"
-#include "IMesh.h"
-#include "IMetaMesh.h"
#include <string>
class Scene;
class Texture;
class Shader;
+class Model;
//class string;
class SceneObject :
- public Drawable,
- public IMetaMesh
+ public Drawable
{
public:
//SceneObject(Shader* _shader, mat4& model);
SceneObject(Shader* _shader, mat4& model, string modelpath, string texturepath, unsigned int model_index=0);
+
+ SceneObject(Shader* _shader, mat4& modelMat, Model* model, string texturepath);
+
//SceneObject(Shader* _shader, mat4& model, IMesh* model_obj, string texturepath);
virtual ~SceneObject();
void setMatter(float);
- mat4 model;
+ mat4 modelMat;
//__declspec(deprecated)
//unsigned int modelID;
Texture* texture;
+ Model* model;
+
};
glUseProgram(handle);
}
-GLuint Shader::getAttribLocation(const string& name) const
+int Shader::getAttribLocation(const string& name) const
{
int ind = glGetAttribLocation(handle, name.c_str());
if (ind < 0)
return ind;
}
-GLuint Shader::getUniformLocation(const string& name) const
+int Shader::getUniformLocation(const string& name) const
{
int ind = glGetUniformLocation(handle, name.c_str());
if (ind < 0)
using std::string;
+typedef unsigned int uint;
+
class Shader
{
public:
void useShader() const;
- unsigned int getAttribLocation(const string& name) const;
- unsigned int getUniformLocation(const string& name) const;
- unsigned int getHandle() const;
- operator unsigned int() const;
+ int getAttribLocation(const string& name) const;
+ int getUniformLocation(const string& name) const;
+ uint getHandle() const;
+ operator uint() const;
private:
- unsigned int handle;
+ uint handle;
- unsigned int loadShader(string& _shaderPath);
- unsigned int loadProgram(unsigned int _shader1, unsigned int _shader2);
+ uint loadShader(string& _shaderPath);
+ uint loadProgram(uint _shader1, uint _shader2);
--- /dev/null
+#include "SkyBox.h"
+
+#include "GL/glew.h"
+#include "Graphix.h"
+
+
+SkyBox::SkyBox()
+{
+ numvertices = 4;
+ numfaces = 2;
+
+ float vertex[] { -1.f, - 1.f, 0.f, 1.f, - 1.f, 0.f, - 1.f, 1.f, 0.f, 1.f, 1.f, 0.f };
+ uint index[] { 1,3,2,0,1,2};
+
+ //import("skybox.dae", numvertices, numfaces, vertex, uvs, normals, index, 0);
+
+ genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex);
+ genBuffer(indexBuffer, numfaces * 3 * sizeof(uint), (void*)index);
+
+// delete vertex, index;
+}
+
+
+SkyBox::~SkyBox()
+{
+}
+
+void SkyBox::drawModel(Shader* _shader, Texture* _texture, const mat4& _modelMat) const
+{
+ glDisable(GL_DEPTH_TEST);
+ Model::drawModel(_shader, _texture, _modelMat);
+ glEnable(GL_DEPTH_TEST);
+}
+
+void SkyBox::useModelMat(const mat4& model, Shader* shader) const
+{
+
+}
+
--- /dev/null
+#pragma once
+
+#include "Model.h"
+
+class SkyBox :
+ public Model
+{
+public:
+ SkyBox();
+ ~SkyBox();
+
+ void drawModel(Shader* shader, Texture* texture, const mat4& modelMat) const;
+
+ void useModelMat(const mat4& model, Shader* shader) const;
+
+};
+
<ClCompile Include="Graphix\Scene.cpp" />
<ClCompile Include="Graphix\SceneObject.cpp" />
<ClCompile Include="Graphix\Shader.cpp" />
+ <ClCompile Include="Graphix\SkyBox.cpp" />
<ClCompile Include="Graphix\Texture.cpp" />
<ClCompile Include="Graphix\ViewPort.cpp" />
<ClCompile Include="main.cpp" />
<ClInclude Include="Graphix\Scene.h" />
<ClInclude Include="Graphix\SceneObject.h" />
<ClInclude Include="Graphix\Shader.h" />
+ <ClInclude Include="Graphix\SkyBox.h" />
<ClInclude Include="Graphix\Texture.h" />
<ClInclude Include="Graphix\ViewPort.h" />
<ClInclude Include="Message.h" />
<ClCompile Include="Graphix\IMetaMesh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Graphix\SkyBox.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Fps.h">
<ClInclude Include="Graphix\IMetaMesh.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="Graphix\SkyBox.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
void main(){
//FragmentColor = texture(uColorTexture, eyeDirection);
- FragmentColor = vec4(eyeDirection, 0.5);
+ FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5);
}