This commit is contained in:
Tleety
2016-02-24 13:57:54 +01:00
parent 8d23c531af
commit 6f9ce8a0c1
5 changed files with 30 additions and 21 deletions
+11 -12
View File
@@ -3,21 +3,20 @@
CubeMapPass::CubeMapPass(IRenderer* renderer)
:m_Renderer(renderer)
{
LoadTextures();
LoadTextures("Nevada");
GenerateCubeMapTexture();
}
/*
*/
void CubeMapPass::LoadTextures()
void CubeMapPass::LoadTextures(std::string input)
{
for (int i = 0; i < 6; i++){
std::string str;
str = "Textures/Test/CubeMap/CubeMapTest0" + std::to_string(i) + ".png";
Texture* img = ResourceManager::Load<Texture>(str);
m_CubeMapTestTextures.push_back(img);
if (m_PreviusCubeMapTexture != input) {
m_CubeMapTextures.clear();
for (int i = 0; i < 6; i++) {
std::string str;
str = "Textures/Test/CubeMap/" + input + "/CubeMapTest0" + std::to_string(i) + ".png";
Texture* img = ResourceManager::Load<Texture>(str);
m_CubeMapTextures.push_back(img);
}
}
}
@@ -27,7 +26,7 @@ void CubeMapPass::GenerateCubeMapTexture()
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapTexture);
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_CubeMapTestTextures[i]->Data);
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, m_CubeMapTextures[0]->Width, m_CubeMapTextures[0]->Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_CubeMapTextures[i]->Data);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);