OI од.
void Sky :: draw ( const Cameras camera ) {
Vector3D pos ( camera.getPos () );
BoundingBox frontBox ( Vector3D (pos.x-skySize,
pos.y+skySize, pos.z-skySize), Vector3D (pos.x+skySize, pos.y+skySize, pos.z+skySize));
BoundingBox backBox ( Vector3D(pos.x-skySize,
pos.y-skySize, pos.z-skySize),
Vector3D(pos.x+skySize,
pos .y-skySize, pos . z+skySize) ) ,-
BoundingBox leftBox ( Vector3D(pos.x-skySize,
pos.y-skySize, pos.z-skySize),
Vector3D(pos.x-skySize,
pos.y+skySize, pos.z+skySize));
BoundingBox rightBox ( Vector3D(pos.x+skySize,
pos.y-skySize,pos.z-skySize),
Vector3D (pos.x+skySize,
pos.y+skySize, pos.z+skySize));
BoundingBox upBox ( Vector3D(pos.x-skySize,
pos.y-skySize, pos.z+skySize), Vector3D(pos.x+skySize, pos.y+skySize, pos.z+skySize));
Добавляем эффекты
BoundingBox downBox ( Vector3D(pos.x-skySize,
pos.y-skySize,pos.z-skySize), Vector3D(pos.x+skySize, pos.y+skySize, pos.z-skySize));
if ( camera.inViewingFrustrum ( frontBox ) ) {
glBindTexture ( GL_TEXTURE_2D,
skyTextures [0] -> getld () ); glBegin ( GL_QUADS );
glTexCoord2f ( l.Of - invWidth [0], invHeight [0] ) ; glVertex3d ( pos.x - skySize, pos.у + skySize, pos.z + skySize ),glTexCoord2f ( invWidth [0], invHeight [0] ) ; glVertex3f ( pos.x + skySize, pos.у + skySize, pos.z + skySize );
glTexCoord2f ( invWidth [0], l.Of - invHeight [0] ); glVertex3f ( pos.x + skySize, pos.у + skySize, pos.z - skySize );
glTexCoord2f ( l.Of - invWidth [0],
1.Of - invHeight [0] ) ; glVertex3f ( pos.x - skySize, pos.у + skySize,
pos.z - skySize );
glEnd ();
}
if ( camera.inViewingFrustrum ( backBox ) ) {
glBindTexture ( GL_TEXTURE_2D,
skyTextures [1] -> getld () ); glBegin ( GL_QUADS );
glTexCoord2f ( invWidth [1], invHeight [1] ) ; glVertex3d ( pos.x - skySize, pos.у - skySize, pos.z + skySize );
glTexCoord2f ( invWidth [1], l.Of - invHeight [1] ) ,-glVertex3f ( pos.x - skySize, pos.у - skySize, pos. z - skySize ) ,-