From: Peter Schaefer Date: Sun, 26 Apr 2015 18:55:30 +0000 (+0200) Subject: removed Drawable X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=3cd485f1b037af08e2c8a4e0a96ec62c84ecc06e;p=cgue_weave.git removed Drawable removed unused classes --- diff --git a/CGUE2015_Weave.sln b/CGUE2015_Weave.sln index e49e506..abd53b7 100644 --- a/CGUE2015_Weave.sln +++ b/CGUE2015_Weave.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shader", "shader", "{75179E shader\basicTexture_VS.hlsl = shader\basicTexture_VS.hlsl shader\lightingTexture_FS.hlsl = shader\lightingTexture_FS.hlsl shader\perspective_VS.hlsl = shader\perspective_VS.hlsl + shader\skybox_color_FS.hlsl = shader\skybox_color_FS.hlsl shader\skybox_FS.hlsl = shader\skybox_FS.hlsl shader\skybox_VS.hlsl = shader\skybox_VS.hlsl EndProjectSection diff --git a/Weave/Game.cpp b/Weave/Game.cpp index 63d32c4..b416b24 100644 --- a/Weave/Game.cpp +++ b/Weave/Game.cpp @@ -13,7 +13,6 @@ #include "Graphix\Scene.h" #include "Graphix\SceneObject.h" #include "Graphix\Shader.h" -#include "Graphix\Drawable.h" #include "Graphix\Graphix.h" #include "Fps.h" #include "Events.h" @@ -43,14 +42,13 @@ Game::Game() : playing(true) { srand((int)time(NULL)); // Hauptfenster - Scene* tmp_Scene = new Scene(0, 0, Graphix::getWindowWidth(), Graphix::getWindowHeight(), 45, 0.1f, 40, vec3(0.0f, 0.0f, 0.f)); - layer[0] = tmp_Scene; + current_world = new Scene(0, 0, Graphix::getWindowWidth(), Graphix::getWindowHeight(), 45, 0.1f, 40, vec3(0.0f, 0.0f, 0.f)); //SKYBOX! --------------------------- - shader_skybox = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl"); + shader_skybox = new Shader("skybox_VS.hlsl", "skybox_color_FS.hlsl"); //texture_skybox = new Texture("skybox_CUBE.jpg"); - tmp_Scene->addObject(new SceneObject(shader_skybox, scale(3.f * vec3(1.f, .5f, 1.f)), new SkyBox(), "")); + current_world->addObject(new SceneObject(shader_skybox, scale(3.f * vec3(1.f, .5f, 1.f)), new SkyBox(), "")); //SKYBOX! ---------------------------- //Allg Shader @@ -58,9 +56,9 @@ Game::Game() : playing(true) // Shader* shaderSky = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl"); // load LVL - tmp_Scene->addObject(new SceneObject(shader1, scale(3.f * vec3(1.f,.3f,1.f)), "level_test.dae", "model_levelTest_2D.png")); + current_world->addObject(new SceneObject(shader1, scale(3.f * vec3(1.f,.3f,1.f)), "level_test.dae", "model_levelTest_2D.png")); - tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f,1.f,0.f)), new BBox() , "")); + current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f,1.f,0.f)), new BBox() , "")); //Player SceneObject* tmp_playerObject = new SceneObject(shader1, translate(vec3(1.f, 3.f, 1.f))*rotate((float)M_PI_4,vec3(0.f,1.f,0.f)), "Player.dae", "model_player_2D.png"); @@ -68,8 +66,8 @@ Game::Game() : playing(true) tmp_playerObject->yStatic= false; //tmp_playerObject->setIntelligenz(new PlayerI(tmp_playerObject)); - tmp_Scene->addObject(tmp_playerObject); - tmp_Scene->setLookAt(tmp_playerObject); + current_world->addObject(tmp_playerObject); + current_world->setLookAt(tmp_playerObject); //player1 = Player(tmp_playerObject); // World @@ -79,7 +77,7 @@ Game::Game() : playing(true) //SceneObject::setTextureDanger("model_cow.jpg"); //SceneObject::setTextureSave("model_cow.jpg"); - //tmp_Scene->addObject(tmp_world); + //current_world->addObject(tmp_world); //int size = 5; //int steps = 10; @@ -97,16 +95,16 @@ Game::Game() : playing(true) // } // tmp_enemy = new SceneObject(shader1, translate(pos), "cow/cow.dae", "", (float)(rand() % 10 + 2) / 10.f); // tmp_enemy->setEnemy(true); - // tmp_Scene->addObject(tmp_enemy); + // current_world->addObject(tmp_enemy); // //cout << ((float)(rand() % (size*steps * 2)) / steps - size) << ((float)(rand() % (size*steps * 2)) / steps - size) << ((float)(rand() % (size*steps * 2)) / steps - size) << endl; //} //ein Gegner - //tmp_Scene->addObject(new SceneObject(shader1, glm::mat4(1.0f), "Player.dae", "model_player.png")); - //tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg")); - tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.4f)), "duck.dae", "model_duck_2D.png")); + //current_world->addObject(new SceneObject(shader1, glm::mat4(1.0f), "Player.dae", "model_player.png")); + //current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg")); + current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.4f)), "duck.dae", "model_duck_2D.png")); - //import("level_test.dae", tmp_Scene, shader1); + //import("level_test.dae", current_world, shader1); @@ -116,9 +114,7 @@ Game::Game() : playing(true) Game::~Game() { - for (auto i = layer.begin(); i != layer.end(); ++i){ - delete i->second; - } + delete current_world; } @@ -156,13 +152,12 @@ void Game::play() void Game::update(float deltaT) { if (playing){ - for (auto i = layer.begin(); i != layer.end(); ++i){ - (*i).second->update(deltaT); - } - + current_world->update(deltaT); + // l_interface->update(deltaT); - }else - l_menu->update(deltaT); + } +// else +// l_menu->update(deltaT); } void Game::draw() const @@ -172,12 +167,11 @@ void Game::draw() const //viewPort->bindView(*i, lookat->getPosition() + vec3(0.0f, 1.0f, 0.0f)); //SkyBox->draw(); - for (auto i = layer.begin(); i != layer.end(); ++i){ - (*i).second->draw(); - } + current_world->draw(); + // l_interface->draw(); } - else - l_menu->draw(); + //else + // l_menu->draw(); } \ No newline at end of file diff --git a/Weave/Game.h b/Weave/Game.h index 9c8d778..e62f129 100644 --- a/Weave/Game.h +++ b/Weave/Game.h @@ -1,18 +1,9 @@ #pragma once - -//#include "Graphix\Scene.h" -#include "Graphix\Drawable.h" -#include "Graphix\Scene.h" -//#include "Player.h" - -#include - -using std::map; - -#include "Graphix\Shader.h" -#include "Graphix\Texture.h" -#include "Graphix\Model.h" +class Shader; +class Texture; +class Model; +class Scene; class Game { @@ -31,14 +22,13 @@ private: bool playing; - Drawable *l_interface, *l_menu; +// Drawable *l_interface, *l_menu; - map layer; - //Player player1; + Scene* current_world; void update(float); void draw() const; - //bool import(const string &path, Scene *scene, Shader* shader); + Shader* shader_skybox; Texture* texture_skybox; diff --git a/Weave/Graphix/Drawable.cpp b/Weave/Graphix/Drawable.cpp deleted file mode 100644 index 7fd8457..0000000 --- a/Weave/Graphix/Drawable.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "Drawable.h" - - -Drawable::Drawable() -{ -} - - -Drawable::~Drawable() -{ -} - - -void Drawable::update(float _deltaT) -{ -} - -void Drawable::draw() const -{ -} - -void Drawable::collisions() -{ -} diff --git a/Weave/Graphix/Drawable.h b/Weave/Graphix/Drawable.h deleted file mode 100644 index c466e25..0000000 --- a/Weave/Graphix/Drawable.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -class Drawable -{ -public: - Drawable(); - virtual ~Drawable(); - - virtual void draw() const; - virtual void update(float); - - virtual void collisions(); - -}; - diff --git a/Weave/Graphix/Model/Model.cpp b/Weave/Graphix/Model/Model.cpp index ed12071..d891b40 100644 --- a/Weave/Graphix/Model/Model.cpp +++ b/Weave/Graphix/Model/Model.cpp @@ -104,7 +104,6 @@ void Model::drawBBox(Shader* _shader,const mat4& _modelMat) const { if (BoundingBox==nullptr) { - exBBox = true; BoundingBox = new BBox(); // BBoxShader = new Shader("basic_FS.hlsl", "basic_VS.hlsl"); // BoundingBox->bindShader(BBoxShader); diff --git a/Weave/Graphix/Scene.h b/Weave/Graphix/Scene.h index 20a0c5e..04a6258 100644 --- a/Weave/Graphix/Scene.h +++ b/Weave/Graphix/Scene.h @@ -13,8 +13,7 @@ using std::set; typedef list SceneList; -class Scene : - public Drawable +class Scene { public: //Scene(); diff --git a/Weave/Graphix/SceneObject.h b/Weave/Graphix/SceneObject.h index 1261179..a0ff184 100644 --- a/Weave/Graphix/SceneObject.h +++ b/Weave/Graphix/SceneObject.h @@ -15,8 +15,7 @@ class Model; //class string; -class SceneObject : - public Drawable +class SceneObject { public: diff --git a/Weave/Graphix/ViewPort.cpp b/Weave/Graphix/ViewPort.cpp index 487cc45..aad5988 100644 --- a/Weave/Graphix/ViewPort.cpp +++ b/Weave/Graphix/ViewPort.cpp @@ -35,8 +35,18 @@ void ViewPort::useViewPort() const void ViewPort::bindView(Shader* shader) const{ shader->useShader(); - glUniformMatrix4fv(shader->getUniformLocation("uProjection"), 1, false, value_ptr(projection)); - glUniformMatrix4fv(shader->getUniformLocation("uView"), 1, false, value_ptr(view)); + int tmp = -1; + + tmp = shader->getUniformLocation("uProjection"); + if (tmp >= 0) + glUniformMatrix4fv(tmp, 1, false, value_ptr(projection)); + tmp = shader->getUniformLocation("uInvProjection"); + if (tmp >= 0) + glUniformMatrix4fv(tmp, 1, false, value_ptr(glm::inverse(projection))); + + tmp = shader->getUniformLocation("uView"); + if (tmp >= 0) + glUniformMatrix4fv(shader->getUniformLocation("uView"), 1, false, value_ptr(view)); } void ViewPort::bindView(Shader* shader, vec3 pos) const{ @@ -52,7 +62,7 @@ void ViewPort::bindView(Shader* shader, vec3 pos) const{ tmp = shader->getUniformLocation("uView"); if (tmp >= 0) - glUniformMatrix4fv(tmp, 1, false, value_ptr(translate(view,-pos))); + glUniformMatrix4fv(tmp, 1, false, value_ptr(translate(view,-pos))); } void ViewPort::rotateView(float angle_x, float angle_y){ diff --git a/Weave/Graphix/idNcount.cpp b/Weave/Graphix/idNcount.cpp deleted file mode 100644 index e2d0ce3..0000000 --- a/Weave/Graphix/idNcount.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "idNcount.h" - -idNcount::idNcount(unsigned int _id) : -id(_id), -count(0) -{ -} - -idNcount::~idNcount() -{ -} - -idNcount::operator unsigned int() const -{ - return id; -} - -idNcount::operator bool() const -{ - return count <= 0; -} - -idNcount& idNcount::operator++() -{ - count++; - return *this; -} - -idNcount& idNcount::operator--() -{ - count--; - return *this; -} \ No newline at end of file diff --git a/Weave/Graphix/idNcount.h b/Weave/Graphix/idNcount.h deleted file mode 100644 index bae2bb5..0000000 --- a/Weave/Graphix/idNcount.h +++ /dev/null @@ -1,21 +0,0 @@ - -class idNcount -{ -public: - idNcount(unsigned int); - ~idNcount(); - - //handleID - operator unsigned int() const; - - //handleID wird gebraucht - idNcount& operator ++(); - //handleID wird nicht mehr gebraucht - idNcount& operator --(); - //ist die handleID ungenutzt? - operator bool() const; - -private: - unsigned int id; - unsigned int count; -}; \ No newline at end of file diff --git a/Weave/Graphix/matM.cpp b/Weave/Graphix/matM.cpp deleted file mode 100644 index 85e4f07..0000000 --- a/Weave/Graphix/matM.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "matM.h" - -#include "GLM.h" - - -matM::matM() -{ -} - - -matM::~matM() -{ -} - -void matM::transform() -{ -} - -void matM::rotate() -{ -} - -void matM::rotateC() -{ -} - -void matM::skale() -{ -} - -void matM::skaleC() -{ -} - - -void matM::setPosition() -{ -} - - -mat4 matM::getMat4() const -{ - return mat4(1.f); -} - -matM::operator mat4() const -{ - return mat4(1.f); -} - - -vec3 matM::getPosition() const -{ - return vec3(0.f); -} - -matM::operator vec3() const -{ - return vec3(0.f); -} diff --git a/Weave/Graphix/matM.h b/Weave/Graphix/matM.h deleted file mode 100644 index fbfbb0d..0000000 --- a/Weave/Graphix/matM.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "glm\glm.hpp" - -using glm::mat4; -using glm::vec3; - -class matM -{ -public: - matM(); - ~matM(); - - void transform(); - void rotate(); - void rotateC(); - void skale(); - void skaleC(); - - void setPosition(); - - mat4 getMat4() const; - operator mat4() const; - - vec3 getPosition() const; - operator vec3() const; - -private: - mat4 matrix; -}; - diff --git a/Weave/Weave.vcxproj b/Weave/Weave.vcxproj index 9f0dd6a..9e00615 100644 --- a/Weave/Weave.vcxproj +++ b/Weave/Weave.vcxproj @@ -97,7 +97,6 @@ - @@ -119,7 +118,6 @@ - diff --git a/Weave/Weave.vcxproj.filters b/Weave/Weave.vcxproj.filters index 8c9156f..1bca2f2 100644 --- a/Weave/Weave.vcxproj.filters +++ b/Weave/Weave.vcxproj.filters @@ -36,9 +36,6 @@ Source Files - - Source Files - Source Files @@ -92,9 +89,6 @@ Header Files - - Header Files - Header Files diff --git a/shader/skybox_FS.hlsl b/shader/skybox_FS.hlsl index 18675d3..1e1c0cc 100644 --- a/shader/skybox_FS.hlsl +++ b/shader/skybox_FS.hlsl @@ -6,6 +6,5 @@ smooth in vec3 eyeDirection; out vec4 FragmentColor; void main(){ - //FragmentColor = texture(uColorTexture, eyeDirection); - FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5); + FragmentColor = texture(uColorTexture, eyeDirection); } diff --git a/shader/skybox_color_FS.hlsl b/shader/skybox_color_FS.hlsl new file mode 100644 index 0000000..1724745 --- /dev/null +++ b/shader/skybox_color_FS.hlsl @@ -0,0 +1,9 @@ +//Fragment Shader +#version 330 + +smooth in vec3 eyeDirection; +out vec4 FragmentColor; + +void main(){ + FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5); +}