]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
Effect Blur(AccBuffer) umbenannt
authorPeter Schaefer <schaeferpm@gmail.com>
Thu, 14 Apr 2016 10:20:10 +0000 (12:20 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Thu, 14 Apr 2016 10:20:10 +0000 (12:20 +0200)
Texturen aufgeteilt in Buffer & Image

22 files changed:
Weave/Events.cpp
Weave/Game.cpp
Weave/Graphix/Graphix.cpp
Weave/Graphix/Graphix.h
Weave/Graphix/Model.h
Weave/Graphix/Model/Plane.cpp
Weave/Graphix/Model/SkyBox.cpp
Weave/Graphix/Texture.cpp [deleted file]
Weave/Graphix/Texture.h [deleted file]
Weave/Graphix/Textures.h [new file with mode: 0644]
Weave/Graphix/Textures/Texture.cpp [new file with mode: 0644]
Weave/Graphix/Textures/Texture.h [new file with mode: 0644]
Weave/Graphix/Textures/tBuffer.cpp [new file with mode: 0644]
Weave/Graphix/Textures/tBuffer.h [new file with mode: 0644]
Weave/Graphix/Textures/tImage.cpp [new file with mode: 0644]
Weave/Graphix/Textures/tImage.h [new file with mode: 0644]
Weave/Scene/EventBox.cpp
Weave/Scene/SceneObject.cpp
Weave/Scene/Sky.cpp
Weave/Weave.vcxproj
Weave/Weave.vcxproj.filters
shader/blur_FS.hlsl

index d1561132cdc68a0d3fc6ecddb47d459b70f8679a..e19a3316caa5bcba47ebcc2ce8df9708e49c2f5c 100644 (file)
@@ -139,7 +139,7 @@ void Events::KeyDown(int _key)
                break;
        case SDLK_LSHIFT:
                timeshift = true;
-               Graphix::enableEffects(EF_MOTION_BLUR);
+               Graphix::enableEffects(EF_MOTION_BLUR_ACC);
                break;
        default:
                break;
@@ -152,7 +152,7 @@ void Events::KeyUp(int _key)
        {
        case SDLK_LSHIFT:
                timeshift = false;
-               Graphix::disableEffects(EF_MOTION_BLUR);
+               Graphix::disableEffects(EF_MOTION_BLUR_ACC);
                break;
        default:
                break;
index 1778c4b5ece5eac5797f2e02885bb44388b58357..ca049e70c06d074e2bbc62296dd252d2218643b7 100644 (file)
@@ -15,7 +15,7 @@
 \r
 #include "Graphix\Shader.h"\r
 #include "Graphix\Graphix.h"\r
-#include "Graphix\Texture.h"\r
+#include "Graphix\Textures.h"\r
 #include "Fps.h"\r
 #include "Events.h"\r
 \r
index 4db3355f07e93056d569e2a300095bb03e6d6a19..530973c49f453a4136c0ab2d502a2dace43ccd4e 100644 (file)
@@ -67,6 +67,7 @@ void Graphix::updateEffects()
 void Graphix::init()\r
 {\r
 \r
+       /*SDL INIT*/\r
        if (SDL_Init(sdlFlags) != 0)\r
        {\r
                Message::error((string)"SDL_Init: " + SDL_GetError());\r
@@ -93,6 +94,10 @@ void Graphix::init()
 \r
        sdl_glcontext = SDL_GL_CreateContext(sdl_window);\r
 \r
+       SDL_ShowCursor(SDL_DISABLE);\r
+\r
+\r
+       /*OpenGL INIT*/\r
        GLenum err = glewInit();\r
        if (err != GLEW_OK)\r
        {\r
@@ -124,7 +129,6 @@ void Graphix::init()
        }\r
 #endif\r
 \r
-       SDL_ShowCursor(SDL_DISABLE);\r
 \r
        glEnable(GL_DEPTH_TEST);\r
 \r
@@ -204,7 +208,8 @@ void Graphix::hideMouse(bool _enable)
 void Graphix::clear()\r
 {\r
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\r
-       if (testEffect(EF_MOTION_BLUR))\r
+\r
+       if (testEffect(EF_MOTION_BLUR_ACC))\r
        {\r
                glAccum(GL_RETURN, MOTION_BLUR_INTENS);\r
                glClear(GL_ACCUM_BUFFER_BIT);\r
@@ -216,8 +221,9 @@ void Graphix::clear()
 \r
 void Graphix::swap()\r
 {\r
-       if (testEffect(EF_MOTION_BLUR))\r
+       if (testEffect(EF_MOTION_BLUR_ACC))\r
                glAccum(GL_ACCUM, MOTION_BLUR_COEFF);\r
+\r
        SDL_GL_SwapWindow(sdl_window);\r
 }\r
 \r
index 337482d259a9384ec6ce8d71aa40028f43dd576e..7d10ff47bde9e34663848c8c73b055f0cd22efb4 100644 (file)
@@ -9,7 +9,7 @@
 
 enum Effects {
        EF_NOTHING = 0,
-       EF_MOTION_BLUR = BIT(1),
+       EF_MOTION_BLUR_ACC = BIT(1),
        EF_TRANSPARENCY = BIT(2),
        EF_BLOOM = BIT(3)
 };
index d786d9abbc305626a8b1e783bda3000d57d4ab7e..6fbfc1f941a33902f642ed86b0e73bf01fa1068c 100644 (file)
@@ -4,3 +4,4 @@
 //#include "Model\IMetaMesh.h"
 //#include "Model\SkyBox.h"
 //#include "Model\BBox.h"
+#include "Model\Plane.h"
index f967b4c913138aa141bda312bfe5ac3f00203380..300bc2593545ffd40b6c17db8d74b88c927b515c 100644 (file)
@@ -32,15 +32,16 @@ void Plane::drawModel() const
        useModel(mat4(1.f));
 
        Shader::gActive()->setUniformLocation("uPlain", 1);
+       Shader::gActive()->setUniformLocation("uFar", 0);
 
-       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+       glDrawArrays(GL_QUADS, 0, 4);
        glBindVertexArray(0);
 }
 
 void Plane::bt_init(bool isConvex)
 {
        if(bt_collision_shape==nullptr)
-               bt_collision_shape = new btBoxShape(btVector3(.5f, .5f, .001f));
+               bt_collision_shape = new btBoxShape(btVector3(.5f, .5f, .01f));
 }
 
 
index a3f5e23a6eade85bbbb3f6a3616e42907b3cdea6..64f9919a0fd869b53749ff559acfc8dc1ce0b2d0 100644 (file)
@@ -38,6 +38,7 @@ void SkyBox::drawModel(const mat4& _modelMat) const
 \r
        useModel(_modelMat);\r
 \r
+       Shader::gActive()->setUniformLocation("uPlain", 0);\r
        Shader::gActive()->setUniformLocation("uFar", 1);\r
 \r
        Model::drawModel();\r
diff --git a/Weave/Graphix/Texture.cpp b/Weave/Graphix/Texture.cpp
deleted file mode 100644 (file)
index 5f57fcb..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#include "Texture.h"
-#include <GL\glew.h>
-#include "FreeImage.h"
-#include <iostream>
-#include "../GLM.h"
-
-#include "../Message.h"
-#include "Graphix.h"
-#include "Shader.h"
-
-using std::string;
-using std::unordered_map;
-
-
-Texture::Texture(const string& _path, const vec4& _material) : path(_path), handle(-1), TEXTURE_TYPE(-1), material(_material)
-{
-       //Message::info("Error from before?");
-       //Graphix::getGlError();
-       //Message::info("Do some Stuff");
-
-
-       texHandle& t_ptr = texture_Map[_path];
-
-       if (t_ptr.handle >= 0)
-       {
-               handle = t_ptr.handle;
-               return;
-       }
-
-       glGenTextures(1, &handle);
-
-       auto path_type = path.substr(path.find_last_of("_")+1);
-       path_type = path_type.substr(0, path_type.find_first_of("."));
-
-       if (path_type == "CUBE")
-       {
-               TEXTURE_TYPE = GL_TEXTURE_CUBE_MAP;
-       }
-       else if (path_type == "2D")
-       {
-               TEXTURE_TYPE = GL_TEXTURE_2D;
-       }
-       else
-       {
-               Message::info("Texture : Undefined Type, was set to default (2D)");
-               TEXTURE_TYPE = GL_TEXTURE_2D;
-       }
-       glBindTexture(TEXTURE_TYPE, handle);
-
-       FREE_IMAGE_FORMAT format = FreeImage_GetFileType(("../textures/" + path).c_str());//Automatocally detects the format
-       if (format == FIF_UNKNOWN)
-       {
-               Message::error("Texture: Couldn't detect texture file format.");
-       }
-       FIBITMAP* data = FreeImage_Load(format, ("../textures/" + path).c_str());
-       if (!data)
-       {
-               Message::error("Texture: Couldn't read texture file.");
-       }
-
-       //FIBITMAP* temp = data;
-       data = FreeImage_ConvertTo32Bits(data);
-       if (!data)
-       {
-               Message::error("Texture: Couldn't convert texture file to bit format."); 
-       }
-       //FreeImage_Unload(temp);
-
-       unsigned int width = FreeImage_GetWidth(data);
-       unsigned int height = FreeImage_GetHeight(data);
-
-       //unsigned int width, height;
-
-       //FIBITMAP *data = FreeImage_Load(FIF_PNG, path.c_str(), PNG_DEFAULT);
-       //Graphix::getGlError();
-//     if (TEXTURE_TYPE == GL_TEXTURE_2D)
-       {
-               glTexImage2D(TEXTURE_TYPE, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)FreeImage_GetBits(data));
-               //Message::info("TexImage");
-               //Graphix::getGlError();
-               //Message::info("Other Stuff");
-               glGenerateMipmap(TEXTURE_TYPE);
-       }
-//     else if (TEXTURE_TYPE == GL_TEXTURE_CUBE_MAP)
-               
-
-       glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-       glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-       if (TEXTURE_TYPE == -1)
-       {
-               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-               glTexParameteri(TEXTURE_TYPE, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
-       }
-
-       t_ptr.handle = handle;
-       //Graphix::getGlError();
-       //Message::info("Done");
-       
-}
-
-Texture::~Texture()
-{
-       glDeleteTextures(1, &handle);
-}
-
-Texture* Texture::newTexture(const string& _path, const vec4& _material)
-{
-       texHandle& t_ptr = texture_Map[_path];
-
-       if (t_ptr.ptr == nullptr)
-       {
-               t_ptr.ptr = new Texture(_path, _material);
-       }
-
-       ++t_ptr.count;
-
-       return t_ptr.ptr;
-}
-
-void Texture::deleteTexture(const string& _path)
-{
-       texHandle& t_ptr = texture_Map[_path];
-
-       if (t_ptr.ptr == nullptr)
-       {
-               Message::warning("deleteTexture: " + _path + " doesn't exist.");
-               return;
-       }
-               
-       --t_ptr.count;
-
-       if (!t_ptr.count)
-       {
-               delete t_ptr.ptr;
-               texture_Map.erase(_path);
-       }
-}
-
-void Texture::useTexture() const
-{
-
-       /* bind Texture*/
-       int unit = 0;
-       glActiveTexture(GL_TEXTURE0 + unit);
-       glBindTexture(TEXTURE_TYPE, handle);
-
-       Shader::gActive()->setUniformLocation("uColorTexture", unit);
-
-       /* bind Material*/
-       Shader::gActive()->setUniformLocation("material", material);
-}
-
-Texture::operator string() const
-{
-       return path;
-}
-
-unordered_map<string, Texture::texHandle> Texture::texture_Map;
\ No newline at end of file
diff --git a/Weave/Graphix/Texture.h b/Weave/Graphix/Texture.h
deleted file mode 100644 (file)
index d6968a8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#include "../GLM.h"
-
-#include <string>
-#include <unordered_map>
-
-class Texture
-{
-public:
-       static Texture* newTexture(const std::string& path, const vec4& material);
-       static void deleteTexture(const std::string& path);
-
-       virtual void useTexture() const;
-
-       operator std::string() const;
-
-private:
-       Texture(const std::string& path, const vec4& material);
-       ~Texture();
-
-       unsigned int handle;
-       std::string path;
-       unsigned int TEXTURE_TYPE;
-
-       typedef struct texStruct
-       {
-               int handle=-1;
-               unsigned int count=0;
-               Texture* ptr=nullptr;
-       } texHandle;
-
-       vec4 material;
-
-       static std::unordered_map<std::string, texHandle> texture_Map;
-};
\ No newline at end of file
diff --git a/Weave/Graphix/Textures.h b/Weave/Graphix/Textures.h
new file mode 100644 (file)
index 0000000..45f5bc0
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "Textures/Texture.h"
+//#include "Textures\tImage.h"
+#include "Textures\tBuffer.h"
diff --git a/Weave/Graphix/Textures/Texture.cpp b/Weave/Graphix/Textures/Texture.cpp
new file mode 100644 (file)
index 0000000..c0cf076
--- /dev/null
@@ -0,0 +1,108 @@
+#include "Texture.h"
+#include <GL\glew.h>
+
+#include "../../Message.h"
+
+#include "tImage.h"
+
+using std::string;
+using std::unordered_map;
+
+
+Texture::Texture() 
+       : texture_internal(GL_RGB16F), texture_format(GL_RGB),texture_target(GL_TEXTURE_2D),texture_type(GL_FLOAT)
+{
+       glGenTextures(1, &handle);
+}
+
+Texture::~Texture()
+{
+       glDeleteTextures(1, &handle);
+}
+
+Texture* Texture::newTImage(const string& _path, const vec4& _material)
+{
+       texHandle& t_ptr = texture_Map[_path];
+
+       if (t_ptr.ptr == nullptr)
+       {
+               t_ptr.ptr = new tImage(_path, _material);
+               handle_Map[t_ptr.ptr->handle] = &t_ptr;
+       }
+
+       ++t_ptr.count;
+
+       return t_ptr.ptr;
+}
+
+void Texture::deleteTImage(unsigned int _handle)
+{
+       texHandle& t_ptr = *handle_Map[_handle];
+
+       if (t_ptr.ptr == nullptr)
+       {
+               Message::warning("deleteTexture: Image doesn't exist.");
+               return;
+       }
+               
+       --t_ptr.count;
+
+       if (!t_ptr.count)
+       {
+               texture_Map.erase(*t_ptr.ptr);
+               //delete t_ptr.ptr;
+       }
+}
+
+unsigned int Texture::getTTarget() const
+{
+       return texture_target;
+}
+
+
+Texture::operator unsigned int() const
+{
+       return handle;
+}
+
+void Texture::bindTexture()
+{
+       glBindTexture(texture_target, handle);
+
+       glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+       glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+       glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+       glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+       //glTexParameteri(texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
+
+       glTexImage2D(texture_target, 0, texture_internal, width, height, 0, texture_format, texture_type, data);
+}
+
+void Texture::unbindTexture()
+{
+       glDeleteTextures(1, &handle);
+       glGenTextures(1, &handle);
+}
+
+void Texture::useTexture() const
+{
+
+       /* bind Texture*/
+       int unit = 0;
+       glActiveTexture(GL_TEXTURE0 + unit);
+       glBindTexture(texture_target, handle);
+}
+
+void Texture::updateSize(unsigned int _width, unsigned int _height)
+{
+       width = _width;
+       height = _height;
+
+       glBindTexture(texture_target, handle);
+       glTexImage2D(texture_target, 0, texture_internal, width, height, 0, texture_format, texture_type, data);
+}
+
+
+unordered_map<string, Texture::texHandle> Texture::texture_Map;
+unordered_map<unsigned int, Texture::texHandle*> Texture::handle_Map;
\ No newline at end of file
diff --git a/Weave/Graphix/Textures/Texture.h b/Weave/Graphix/Textures/Texture.h
new file mode 100644 (file)
index 0000000..3fbc945
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "../../GLM.h"
+
+#include <string>
+#include <unordered_map>
+
+class tImage;
+
+class Texture
+{
+public:
+       static Texture* newTImage(const std::string& path, const vec4& material);
+       static void deleteTImage(const unsigned int handle);
+
+       Texture();
+       ~Texture();
+
+       virtual void bindTexture();
+       virtual void unbindTexture();
+       virtual void useTexture() const;
+
+       virtual void updateSize(unsigned int width, unsigned int height);
+
+       virtual operator unsigned int() const;
+
+       unsigned int getTTarget() const;
+
+protected:
+       unsigned int handle;
+
+       unsigned int texture_target;
+       unsigned int texture_internal;
+       unsigned int texture_format;
+       unsigned int texture_type;
+
+       void* data = nullptr;
+
+       unsigned int width = 0, height = 0;
+
+
+       typedef struct texStruct
+       {
+               unsigned int count=0;
+               tImage* ptr=nullptr;
+       } texHandle;
+
+       static std::unordered_map<std::string, texHandle> texture_Map;
+       static std::unordered_map<unsigned int, texHandle*> handle_Map;
+};
\ No newline at end of file
diff --git a/Weave/Graphix/Textures/tBuffer.cpp b/Weave/Graphix/Textures/tBuffer.cpp
new file mode 100644 (file)
index 0000000..b76f95f
--- /dev/null
@@ -0,0 +1,66 @@
+#include "tBuffer.h"
+
+#include <GL\glew.h>
+#include "../Shader.h"
+
+
+tBuffer::tBuffer(unsigned int _dim)
+{
+       buffer_target = GL_FRAMEBUFFER;
+
+       /*gen Buffer*/
+       glGenBuffers(1, &handle);
+       
+
+       /*gen Texture*/
+       textures = new Texture[_dim];
+}
+
+
+tBuffer::~tBuffer()
+{
+       delete textures;
+       glDeleteBuffers(1, &handle);
+}
+
+tBuffer::operator unsigned int() const
+{
+       return handle;
+}
+
+unsigned int tBuffer::getDim() const
+{
+       return dim;
+}
+
+Texture* tBuffer::getTexture(unsigned int i) const
+{
+       return &textures[i];
+}
+
+void tBuffer::bindBuffer()
+{
+       glBindFramebuffer(buffer_target, handle);
+       for (unsigned int i = 0; i < dim; i++)
+       {
+               textures[i].bindTexture();
+               glFramebufferTexture2D(buffer_target, GL_COLOR_ATTACHMENT0 + i, textures[i].getTTarget(), textures[i], 0);
+       }
+       
+}
+
+void tBuffer::unbindBuffer()
+{
+       for (unsigned int i = 0; i < dim; i++)
+       {
+               textures[i].unbindTexture();
+       }
+       glDeleteBuffers(1, &handle);
+       glGenBuffers(1, &handle);
+
+}
+
+void tBuffer::useBuffer() const
+{
+       glBindFramebuffer(buffer_target, handle);
+}
\ No newline at end of file
diff --git a/Weave/Graphix/Textures/tBuffer.h b/Weave/Graphix/Textures/tBuffer.h
new file mode 100644 (file)
index 0000000..60b5d03
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+#include "Texture.h"
+
+class tBuffer
+{
+public:
+       tBuffer(unsigned int dim=1);
+       virtual ~tBuffer();
+
+       virtual void bindBuffer();
+       virtual void unbindBuffer();
+       virtual void useBuffer() const;
+
+       operator unsigned int() const;
+
+       unsigned int getDim() const;
+       Texture* getTexture(unsigned int i = 0) const;
+
+       unsigned int dim;
+       Texture* textures = nullptr;
+protected:
+       unsigned int handle;
+       unsigned int buffer_target;
+
+
+       
+};
+
diff --git a/Weave/Graphix/Textures/tImage.cpp b/Weave/Graphix/Textures/tImage.cpp
new file mode 100644 (file)
index 0000000..74e004e
--- /dev/null
@@ -0,0 +1,97 @@
+#include "tImage.h"
+
+#include <GL\glew.h>
+#include "../Shader.h"
+#include "FreeImage.h"
+
+
+#include "../../Message.h"
+
+using std::string;
+
+tImage::tImage(const string& _path, const vec4& _material) : path(_path), material(_material)
+{
+       auto path_type = _path.substr(_path.find_last_of("_") + 1);
+       path_type = path_type.substr(0, path_type.find_first_of("."));
+
+       if (path_type == "CUBE")
+       {
+               texture_target = GL_TEXTURE_CUBE_MAP;
+       }
+       else if (path_type == "2D")
+       {
+               texture_target = GL_TEXTURE_2D;
+       }
+       else
+       {
+               Message::info("Texture : Undefined Type, was set to default (2D)");
+       }
+
+       format = FreeImage_GetFileType(("../textures/" + _path).c_str());
+       if (format == FIF_UNKNOWN)
+       {
+               Message::error("Texture: Couldn't detect texture file format.");
+       }
+
+       texture_internal = GL_RGBA8;
+       texture_format = GL_BGRA;
+       texture_type = GL_UNSIGNED_BYTE;
+
+       loadImage(path);
+}
+
+
+tImage::~tImage()
+{
+       FreeImage_Unload((FIBITMAP*)data);
+}
+
+void tImage::bindTexture()
+{      
+       
+       Texture::bindTexture();
+       glGenerateMipmap(texture_target);
+       
+}
+
+void tImage::useTexture() const
+{
+
+       /* bind Texture*/
+       int unit = 0;
+       glActiveTexture(GL_TEXTURE0 + unit);
+       glBindTexture(texture_target, handle);
+
+       Shader::gActive()->setUniformLocation("uColorTexture", unit);
+
+       /* bind Material*/
+       Shader::gActive()->setUniformLocation("material", material);
+}
+
+
+void tImage::loadImage(const std::string & _path)
+{
+
+       FIBITMAP* data = FreeImage_Load(format, ("../textures/" + path).c_str());
+       if (!data)
+       {
+               Message::error("Texture: Couldn't read texture file.");
+       }
+
+       data = FreeImage_ConvertTo32Bits(data);
+       if (!data)
+       {
+               Message::error("Texture: Couldn't convert texture file to bit format.");
+       }
+
+       width = FreeImage_GetWidth(data);
+       height = FreeImage_GetHeight(data);
+
+       Texture::data = (GLvoid*)FreeImage_GetBits(data);
+}
+
+
+tImage::operator std::string() const
+{
+       return path;
+}
\ No newline at end of file
diff --git a/Weave/Graphix/Textures/tImage.h b/Weave/Graphix/Textures/tImage.h
new file mode 100644 (file)
index 0000000..cbb19c4
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once
+#include "Texture.h"
+
+#include "../../GLM.h"
+#include <string>
+
+enum FREE_IMAGE_FORMAT;
+
+class tImage :
+       public Texture
+{
+public:
+       tImage(const std::string& path, const vec4& material);
+       virtual ~tImage();
+
+       virtual void bindTexture() override;
+       virtual void useTexture() const override;
+
+       operator std::string() const;
+
+protected:
+       void loadImage(const std::string& path);
+
+       vec4 material;
+
+       std::string path;
+       FREE_IMAGE_FORMAT format;
+};
+
index ab47b88748d9ddb785665856d0b75666be2eceb4..6b272cc677581649056f5dfb8f62d04a27a12d4d 100644 (file)
@@ -5,7 +5,7 @@
 #include "../Graphix/Model.h"
 
 #include "../Events.h"
-#include "../Graphix/Texture.h"
+#include "../Graphix/Textures.h"
 
 #include "../Message.h"
 
index c3c1fb928c706c9d9396c9ffd5469eb0cf9c1830..b807e0f06c8afddea217889d6fece00efb0869f6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "../Graphix/Graphix.h"
 #include "../Graphix/Shader.h"
-#include "../Graphix/Texture.h"
+#include "../Graphix/Textures.h"
 #include "../Graphix/Model.h"
 
 #include "../Message.h"
@@ -75,7 +75,11 @@ move_delta(0)
        }
 
        if (texturepath != "")
-               texture = Texture::newTexture(texturepath, _material);
+       {
+               texture = Texture::newTImage(texturepath, _material);
+               texture->bindTexture();
+       }
+               
 
        if (texturepath == "model_duck_2D.png")
        {
@@ -148,16 +152,21 @@ move_delta(0)
        //Graphix::getGlError();
        //modelID = _shader->getUniformLocation("modelMat");
        if (texturepath != "")
-               texture = Texture::newTexture(texturepath, _material);
+       {
+               texture = Texture::newTImage(texturepath, _material);
+               texture->bindTexture();
+       }
+               
        //Message::info("Creating SkyBox Shader");
        //Graphix::getGlError();
 
        if (texturepath == "model_duck_2D.png")
        {
                collide_group = COL_ENEMY;
-               collision = Model::getBBoxModel();
        }
 
+       collision = Model::getBBoxModel();
+
        model->bindModel();
        model->bindShader(shader);
        //Message::info("Binding Shader");
@@ -184,7 +193,7 @@ SceneObject::~SceneObject()
 
 
        if (texture!=nullptr)
-               Texture::deleteTexture(*texture);
+               Texture::deleteTImage(*texture);
 
        if (newModel)
        {
index 5e4459a29f263a132bab253b40e6e955a0e709b4..859ac74dfc6b1ac4b3edc14e059d5f809c3cd2a9 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "../Graphix/Shader.h"
 #include "../Graphix/Model.h"
-#include "../Graphix/Texture.h"
+#include "../Graphix/Textures.h"
 
 #include "../GLM.h"
 
index 2f71aa765da7491077605b27cf409018d5128553..9f707bf4aa1258cf1888cb633091a4ecb56fff2e 100644 (file)
     <ClCompile Include="Graphix\Model\Plane.cpp" />\r
     <ClCompile Include="Graphix\Model\SkyBox.cpp" />\r
     <ClCompile Include="Graphix\PointLight.cpp" />\r
+    <ClCompile Include="Graphix\Textures\tBuffer.cpp" />\r
+    <ClCompile Include="Graphix\Textures\Texture.cpp" />\r
     <ClCompile Include="Scene\EventBox.cpp" />\r
     <ClCompile Include="Scene\Level.cpp" />\r
     <ClCompile Include="Scene\Marvin.cpp" />\r
     <ClCompile Include="Scene\Scene.cpp" />\r
     <ClCompile Include="Scene\SceneObject.cpp" />\r
     <ClCompile Include="Graphix\Shader.cpp" />\r
-    <ClCompile Include="Graphix\Texture.cpp" />\r
     <ClCompile Include="Graphix\ViewPort.cpp" />\r
     <ClCompile Include="main.cpp" />\r
     <ClCompile Include="Message.cpp" />\r
     <ClCompile Include="Scene\Sky.cpp" />\r
     <ClCompile Include="Scene\Timestamp.cpp" />\r
+    <ClCompile Include="Graphix\Textures\tImage.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="Average.h" />\r
     <ClInclude Include="Graphix\Model\Plane.h" />\r
     <ClInclude Include="Graphix\Model\SkyBox.h" />\r
     <ClInclude Include="Graphix\PointLight.h" />\r
+    <ClInclude Include="Graphix\Textures.h" />\r
+    <ClInclude Include="Graphix\Textures\tBuffer.h" />\r
+    <ClInclude Include="Graphix\Textures\Texture.h" />\r
     <ClInclude Include="Scene.h" />\r
     <ClInclude Include="Scene\EventBox.h" />\r
     <ClInclude Include="Scene\Level.h" />\r
     <ClInclude Include="Scene\Scene.h" />\r
     <ClInclude Include="Scene\SceneObject.h" />\r
     <ClInclude Include="Graphix\Shader.h" />\r
-    <ClInclude Include="Graphix\Texture.h" />\r
     <ClInclude Include="Graphix\ViewPort.h" />\r
     <ClInclude Include="Message.h" />\r
     <ClInclude Include="Scene\Sky.h" />\r
     <ClInclude Include="Scene\Timestamp.h" />\r
+    <ClInclude Include="Graphix\Textures\tImage.h" />\r
   </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
index d96246ba409dd0d68f1209614daf4fc890467bab..540faafd9421522d17a62da71bd5328277a481f8 100644 (file)
@@ -33,9 +33,6 @@
     <ClCompile Include="Graphix\Shader.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="Graphix\Texture.cpp">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="Graphix\ViewPort.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="Graphix\Model\Plane.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="Graphix\Textures\Texture.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="Graphix\Textures\tImage.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="Graphix\Textures\tBuffer.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="Fps.h">\r
     <ClInclude Include="Graphix\Shader.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="Graphix\Texture.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="Graphix\ViewPort.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
     <ClInclude Include="Graphix\Model\Plane.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="Graphix\Textures.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="Graphix\Textures\Texture.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="Graphix\Textures\tImage.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="Graphix\Textures\tBuffer.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index ce74b5cc7fa9ee162c777594809c7be97b948c61..acbcedd1e102e72ec74fc8b1b0a6c7348af9e5f1 100644 (file)
@@ -5,7 +5,7 @@ in vec2 fUVs;
 out vec4 gl_FragColor;
 
 uniform sampler2D u_texture;
-uniform bool uHorizontal;
+uniform bool uHorizontal = true;
 uniform bool uSymetric = true;
 
 uniform float weight[5] = float[](0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162);