]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
removed Drawable
authorPeter Schaefer <schaeferpm@gmail.com>
Sun, 26 Apr 2015 18:55:30 +0000 (20:55 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Sun, 26 Apr 2015 18:55:30 +0000 (20:55 +0200)
removed unused classes

17 files changed:
CGUE2015_Weave.sln
Weave/Game.cpp
Weave/Game.h
Weave/Graphix/Drawable.cpp [deleted file]
Weave/Graphix/Drawable.h [deleted file]
Weave/Graphix/Model/Model.cpp
Weave/Graphix/Scene.h
Weave/Graphix/SceneObject.h
Weave/Graphix/ViewPort.cpp
Weave/Graphix/idNcount.cpp [deleted file]
Weave/Graphix/idNcount.h [deleted file]
Weave/Graphix/matM.cpp [deleted file]
Weave/Graphix/matM.h [deleted file]
Weave/Weave.vcxproj
Weave/Weave.vcxproj.filters
shader/skybox_FS.hlsl
shader/skybox_color_FS.hlsl [new file with mode: 0644]

index e49e506008ec21e15c0502ae120cf98ae4e9c264..abd53b7b0f7410ccca8dad81f8cefbccd088fbe0 100644 (file)
@@ -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
index 63d32c4a0ac2940d23a31a5e5d3cc76795646cba..b416b24dadebf48596fd945965f3861417c84e19 100644 (file)
@@ -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
index 9c8d778a37ecbfe2701946b8cc91d9d653e5e01f..e62f1291b0e4604ff8a65774c3cbbaf76430bc37 100644 (file)
@@ -1,18 +1,9 @@
 #pragma once
 
-
-//#include "Graphix\Scene.h"
-#include "Graphix\Drawable.h"
-#include "Graphix\Scene.h"
-//#include "Player.h"
-
-#include <map>
-
-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<int,Drawable*> 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 (file)
index 7fd8457..0000000
+++ /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 (file)
index c466e25..0000000
+++ /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();
-
-};
-
index ed12071082b062a2f6c21b5864e41d21b0f2c843..d891b40d9cfa339a07a7c275e2195cafc59f6015 100644 (file)
@@ -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);
index 20a0c5ea31624ec46732058b929b8a52c9d9a8c8..04a62581a19cd4be5ee29e9dd16be264adbefd5c 100644 (file)
@@ -13,8 +13,7 @@ using std::set;
 
 typedef list<SceneObject*> SceneList;
 
-class Scene :
-       public Drawable
+class Scene
 {
 public:
        //Scene();
index 1261179ac3f57bc22195166352781fa2da75e07f..a0ff18470dcd023ffcf310b6a336d2ef92916546 100644 (file)
@@ -15,8 +15,7 @@ class Model;
 
 //class string;
 
-class SceneObject :
-       public Drawable
+class SceneObject
 {
 public:
 
index 487cc4541da970167bed1d86b387e08faa82f940..aad59887b429c29fbdacd75cd7278c3f3ba0fab1 100644 (file)
@@ -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 (file)
index e2d0ce3..0000000
+++ /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 (file)
index bae2bb5..0000000
+++ /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 (file)
index 85e4f07..0000000
+++ /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 (file)
index fbfbb0d..0000000
+++ /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;
-};
-
index 9f0dd6ac696229f15108b1d66e44ce5bd0e1ee32..9e00615494c6ae8956fb6e274a5683bceecc2faf 100644 (file)
@@ -97,7 +97,6 @@
     <ClCompile Include="Events.cpp" />
     <ClCompile Include="Fps.cpp" />
     <ClCompile Include="Game.cpp" />
-    <ClCompile Include="Graphix\Drawable.cpp" />
     <ClCompile Include="Graphix\GLM.cpp" />
     <ClCompile Include="Graphix\Graphix.cpp" />
     <ClCompile Include="Graphix\Model\IMesh.cpp" />
     <ClInclude Include="Events.h" />
     <ClInclude Include="Fps.h" />
     <ClInclude Include="Game.h" />
-    <ClInclude Include="Graphix\Drawable.h" />
     <ClInclude Include="Graphix\GLM.h" />
     <ClInclude Include="Graphix\Graphix.h" />
     <ClInclude Include="Graphix\Model\IMesh.h" />
index 8c9156fc7eeec72206372ee2958375613eef8f2f..1bca2f21ce61bb2b84a02736f00b168963a27a1f 100644 (file)
@@ -36,9 +36,6 @@
     <ClCompile Include="Graphix\Shader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Graphix\Drawable.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Graphix\Texture.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -92,9 +89,6 @@
     <ClInclude Include="Graphix\Shader.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Graphix\Drawable.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Graphix\Texture.h">
       <Filter>Header Files</Filter>
     </ClInclude>
index 18675d3d27383dca8cd524380e8f11efc83a66ad..1e1c0cc49b5cfd81f224da2f9950e7550603c225 100644 (file)
@@ -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 (file)
index 0000000..1724745
--- /dev/null
@@ -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);
+}