#include <SkyBox.h>
Inheritance diagram for pge::SkyBox:
Public Member Functions | |
SkyBox (const std::string &skyPrefix, float size) | |
Constructor. | |
virtual | ~SkyBox (void) |
Destructor. | |
bool | init (void) |
void | render (void) |
Called when the object should render itself. | |
void | timer (unsigned int delay) |
Called when the timer event comes. | |
Private Attributes | |
Texture * | m_skyFront |
Texture * | m_skyBack |
Texture * | m_skyLeft |
Texture * | m_skyRight |
Texture * | m_skyBottom |
Texture * | m_skyTop |
Sprite * | m_front |
Sprite * | m_back |
Sprite * | m_left |
Sprite * | m_right |
Sprite * | m_bottom |
Sprite * | m_top |
Vector3f | m_frontTopLeft |
Vector3f | m_frontTopRight |
Vector3f | m_frontBottomLeft |
Vector3f | m_frontBottomRight |
Vector3f | m_backTopLeft |
Vector3f | m_backTopRight |
Vector3f | m_backBottomLeft |
Vector3f | m_backBottomRight |
float | m_size |
|
Constructor.
Definition at line 20 of file SkyBox.cpp. References m_back, m_backBottomLeft, m_backBottomRight, m_backTopLeft, m_backTopRight, m_bottom, m_front, m_frontBottomLeft, m_frontBottomRight, m_frontTopLeft, m_frontTopRight, m_left, m_right, m_size, m_skyBack, m_skyBottom, m_skyFront, m_skyLeft, m_skyRight, m_skyTop, and m_top.
00020 { 00021 m_size = size; 00022 00023 m_frontTopLeft = Vector3f(-m_size, m_size, m_size); 00024 m_frontTopRight = Vector3f(m_size, m_size, m_size); 00025 m_frontBottomLeft = Vector3f(-m_size, -m_size, m_size); 00026 m_frontBottomRight = Vector3f(m_size, -m_size, m_size); 00027 m_backTopLeft = Vector3f(-m_size, m_size, -m_size); 00028 m_backTopRight = Vector3f(m_size, m_size, -m_size); 00029 m_backBottomLeft = Vector3f(-m_size, -m_size, -m_size); 00030 m_backBottomRight = Vector3f(m_size, -m_size, -m_size); 00031 00032 m_front = new Sprite(m_frontTopRight, m_frontTopLeft, m_frontBottomLeft, m_frontBottomRight); 00033 m_back = new Sprite(m_backTopLeft, m_backTopRight, m_backBottomRight, m_backBottomLeft); 00034 m_left = new Sprite(m_backTopRight, m_frontTopRight, m_frontBottomRight, m_backBottomRight); 00035 m_right = new Sprite(m_frontTopLeft, m_backTopLeft, m_backBottomLeft, m_frontBottomLeft); 00036 m_bottom = new Sprite(m_backBottomRight, m_frontBottomRight, m_frontBottomLeft, m_backBottomLeft); 00037 m_top = new Sprite(m_backTopRight, m_backTopLeft, m_frontTopLeft, m_frontTopRight); 00038 00039 std::string file = skyPrefix; 00040 m_skyBack = TextureDatabase::getInstance()->addTexture(file.append("_back.jpg"), "sky_back.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00041 file = skyPrefix; 00042 m_skyFront = TextureDatabase::getInstance()->addTexture(file.append("_front.jpg"), "sky_front.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00043 file = skyPrefix; 00044 m_skyRight = TextureDatabase::getInstance()->addTexture(file.append("_right.jpg"), "sky_right.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00045 file = skyPrefix; 00046 m_skyLeft = TextureDatabase::getInstance()->addTexture(file.append("_left.jpg"), "sky_left.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00047 file = skyPrefix; 00048 m_skyBottom = TextureDatabase::getInstance()->addTexture(file.append("_bottom.jpg"), "sky_bottom.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00049 file = skyPrefix; 00050 m_skyTop = TextureDatabase::getInstance()->addTexture(file.append("_top.jpg"), "sky_top.jpg", false, GL_CLAMP, GL_CLAMP, GL_NEAREST, GL_NEAREST, false, 0, 0, 0); 00051 } |
|
Destructor.
Definition at line 59 of file SkyBox.cpp. References m_back, m_bottom, m_front, m_left, m_right, and m_top.
00059 { 00060 if(m_front != NULL) { 00061 delete m_front; 00062 m_front = NULL; 00063 } 00064 if(m_back != NULL) { 00065 delete m_back; 00066 m_back = NULL; 00067 } 00068 if(m_left != NULL) { 00069 delete m_left; 00070 m_left = NULL; 00071 } 00072 if(m_right != NULL) { 00073 delete m_right; 00074 m_right = NULL; 00075 } 00076 if(m_bottom != NULL) { 00077 delete m_bottom; 00078 m_bottom = NULL; 00079 } 00080 if(m_top != NULL) { 00081 delete m_top; 00082 m_top = NULL; 00083 } 00084 } |
|
Implements pge::IRenderableObject. Definition at line 92 of file SkyBox.cpp.
00092 { 00093 return true; 00094 } |
|
Called when the object should render itself.
Implements pge::IRenderableObject. Definition at line 102 of file SkyBox.cpp. References m_back, m_bottom, m_front, m_left, m_right, m_skyBack, m_skyBottom, m_skyFront, m_skyLeft, m_skyRight, m_skyTop, m_top, pge::Vector3f::m_v, and pge::Sprite::render().
00102 { 00103 Vector3f color; 00104 00105 if(DayNightCycle::getInstance()->getDayNightCycle() >= 0.1f) { 00106 color = Vector3f(1.0f, 1.0f, 1.0f) * DayNightCycle::getInstance()->getDayNightCycle(); 00107 } else { 00108 color = Vector3f(0.1f, 0.1f, 0.1f); 00109 } 00110 00111 renderer::color4f(color.m_v[0], color.m_v[1], color.m_v[2], 1.0f); 00112 renderer::setTexture(m_skyBack, GL_MODULATE); 00113 m_back->render(); 00114 renderer::setTexture(m_skyFront); 00115 m_front->render(); 00116 renderer::setTexture(m_skyLeft); 00117 m_left->render(); 00118 renderer::setTexture(m_skyRight); 00119 m_right->render(); 00120 renderer::setTexture(m_skyTop); 00121 m_top->render(); 00122 renderer::setTexture(m_skyBottom); 00123 m_bottom->render(); 00124 } |
Here is the call graph for this function:
|
Called when the timer event comes.
Implements pge::IRenderableObject. Definition at line 132 of file SkyBox.cpp.
00132 { 00133 } |
|
|
|
Definition at line 84 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 85 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 82 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 83 of file SkyBox.h. Referenced by SkyBox(). |
|
|
|
|
|
Definition at line 80 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 81 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 78 of file SkyBox.h. Referenced by SkyBox(). |
|
Definition at line 79 of file SkyBox.h. Referenced by SkyBox(). |
|
|
|
|
|
Definition at line 87 of file SkyBox.h. Referenced by SkyBox(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|