diff --git a/YoggieEngine/src/Graphics/Primitives/CubeMap.cpp b/YoggieEngine/src/Graphics/Primitives/CubeMap.cpp index 48d8bff..23d8199 100644 --- a/YoggieEngine/src/Graphics/Primitives/CubeMap.cpp +++ b/YoggieEngine/src/Graphics/Primitives/CubeMap.cpp @@ -1,8 +1,5 @@ #include #include "CubeMap.h" -#define STB_IMAGE_IMPLEMENTATION -#include "../stb_image.h" - YoggieEngine::CubeMap::CubeMap() { diff --git a/YoggieEngine/src/Graphics/Primitives/Texture.cpp b/YoggieEngine/src/Graphics/Primitives/Texture.cpp index bec80fa..73dd4cf 100644 --- a/YoggieEngine/src/Graphics/Primitives/Texture.cpp +++ b/YoggieEngine/src/Graphics/Primitives/Texture.cpp @@ -1,11 +1,8 @@ #include #include "Texture.h" -#include -#define STB_IMAGE_IMPLEMENTATION -#include "../stb_image.h" namespace YoggieEngine { - Texture::Texture(const std::string texturePath) { + Texture::Texture(const std::string texturePath , bool Transparency) { int width, height, channels; unsigned char* data = stbi_load(texturePath.c_str(), &width, &height, &channels, 0); @@ -16,8 +13,15 @@ namespace YoggieEngine { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); glGenerateMipmap(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + if (Transparency) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } + else { + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/YoggieEngine/src/Graphics/Primitives/Texture.h b/YoggieEngine/src/Graphics/Primitives/Texture.h index 0cf622f..332f94a 100644 --- a/YoggieEngine/src/Graphics/Primitives/Texture.h +++ b/YoggieEngine/src/Graphics/Primitives/Texture.h @@ -2,7 +2,7 @@ namespace YoggieEngine { class Texture { public: - Texture(const std::string texturePath); + Texture(const std::string texturePath, bool Transparency = false); void Bind(); void Unbind(); diff --git a/YoggieEngine/src/Graphics/stb_image.cpp b/YoggieEngine/src/Graphics/stb_image.cpp new file mode 100644 index 0000000..40fda9e --- /dev/null +++ b/YoggieEngine/src/Graphics/stb_image.cpp @@ -0,0 +1,4 @@ +#include +#define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include "stb_image.h" diff --git a/YoggieEngine/src/YoggieEngine.h b/YoggieEngine/src/YoggieEngine.h index 6ab5e3e..2dbe613 100644 --- a/YoggieEngine/src/YoggieEngine.h +++ b/YoggieEngine/src/YoggieEngine.h @@ -1,5 +1,6 @@ #pragma once + // Important STL #include #include @@ -18,7 +19,7 @@ #include #include #include - +#include "Graphics/stb_image.h" extern "C"