X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FEnvironment%2FSkybox.cpp;h=51fe46627cfa345db165d389f8ebd7d15554a7ca;hb=b9a46d8e2b7e7e22c706e7dd3734f31015db4408;hp=ce58adf8d56d18ccadbb1a2dde3d89587f2cc7b5;hpb=b84825978803615f45a9f128232e62431042aec0;p=lugaru.git diff --git a/Source/Environment/Skybox.cpp b/Source/Environment/Skybox.cpp index ce58adf..51fe466 100644 --- a/Source/Environment/Skybox.cpp +++ b/Source/Environment/Skybox.cpp @@ -18,8 +18,9 @@ You should have received a copy of the GNU General Public License along with Lugaru. If not, see . */ -#include "Environment/Skybox.h" -#include "Game.h" +#include "Environment/Skybox.hpp" + +#include "Game.hpp" extern float viewdistance; extern float blurness; @@ -29,8 +30,8 @@ extern float skyboxr; extern float skyboxg; extern float skyboxb; -void SkyBox::load (const std::string& ffront, const std::string& fleft, const std::string& fback, - const std::string& fright, const std::string& fup, const std::string& fdown) +void SkyBox::load(const std::string& ffront, const std::string& fleft, const std::string& fback, + const std::string& fright, const std::string& fup, const std::string& fdown) { front.load(ffront, true); left.load(fleft, true); @@ -65,106 +66,96 @@ void SkyBox::draw() glDisable(GL_CULL_FACE); glEnable(GL_BLEND); glDisable(GL_LIGHTING); - if (skyboxtexture) + if (skyboxtexture) { glEnable(GL_TEXTURE_2D); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); + } + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); front.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( 0.0f, 0.0f, -1); + glNormal3f(0.0f, 0.0f, -1); glTexCoord2f(0, 0); - glVertex3f(-size, -size, size); + glVertex3f(-size, -size, size); glTexCoord2f(1, 0); - glVertex3f( size, -size, size); + glVertex3f(size, -size, size); glTexCoord2f(1, 1); - glVertex3f( size, size, size); + glVertex3f(size, size, size); glTexCoord2f(0, 1); - glVertex3f(-size, size, size); + glVertex3f(-size, size, size); glEnd(); back.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( 0.0f, 0.0f, 1); + glNormal3f(0.0f, 0.0f, 1); glTexCoord2f(1, 0); glVertex3f(-size, -size, -size); glTexCoord2f(1, 1); - glVertex3f(-size, size, -size); + glVertex3f(-size, size, -size); glTexCoord2f(0, 1); - glVertex3f( size, size, -size); + glVertex3f(size, size, -size); glTexCoord2f(0, 0); - glVertex3f( size, -size, -size); + glVertex3f(size, -size, -size); glEnd(); up.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( 0.0f, -1.0f, 0); + glNormal3f(0.0f, -1.0f, 0); glTexCoord2f(0, 1); - glVertex3f(-size, size, -size); + glVertex3f(-size, size, -size); glTexCoord2f(0, 0); - glVertex3f(-size, size, size); + glVertex3f(-size, size, size); glTexCoord2f(1, 0); - glVertex3f( size, size, size); + glVertex3f(size, size, size); glTexCoord2f(1, 1); - glVertex3f( size, size, -size); + glVertex3f(size, size, -size); glEnd(); down.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( 0.0f, 1.0f, 0); + glNormal3f(0.0f, 1.0f, 0); glTexCoord2f(0, 0); glVertex3f(-size, -size, -size); glTexCoord2f(1, 0); - glVertex3f( size, -size, -size); + glVertex3f(size, -size, -size); glTexCoord2f(1, 1); - glVertex3f( size, -size, size); + glVertex3f(size, -size, size); glTexCoord2f(0, 1); - glVertex3f(-size, -size, size); + glVertex3f(-size, -size, size); glEnd(); right.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( -1.0f, 0.0f, 0); + glNormal3f(-1.0f, 0.0f, 0); glTexCoord2f(1, 0); - glVertex3f( size, -size, -size); + glVertex3f(size, -size, -size); glTexCoord2f(1, 1); - glVertex3f( size, size, -size); + glVertex3f(size, size, -size); glTexCoord2f(0, 1); - glVertex3f( size, size, size); + glVertex3f(size, size, size); glTexCoord2f(0, 0); - glVertex3f( size, -size, size); + glVertex3f(size, -size, size); glEnd(); left.bind(); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBegin(GL_QUADS); - glNormal3f( 1.0f, 0.0f, 0); + glNormal3f(1.0f, 0.0f, 0); glTexCoord2f(0, 0); glVertex3f(-size, -size, -size); glTexCoord2f(1, 0); - glVertex3f(-size, -size, size); + glVertex3f(-size, -size, size); glTexCoord2f(1, 1); - glVertex3f(-size, size, size); + glVertex3f(-size, size, size); glTexCoord2f(0, 1); - glVertex3f(-size, size, -size); + glVertex3f(-size, size, -size); glEnd(); glEnable(GL_CULL_FACE); glDepthMask(1); glPopMatrix(); } - -SkyBox::~SkyBox() -{ - front.destroy(); - left.destroy(); - back.destroy(); - right.destroy(); - up.destroy(); - down.destroy(); -}; -