changed LightBounce to use display list for each logo
git-svn-id: svn://anubis/dwscr/trunk@99 5bef9df8-b654-44bb-925b-0ff18baa8f8c
This commit is contained in:
parent
c8940490ca
commit
1c41d64a3a
@ -19,7 +19,6 @@ LightBounceBox::LightBounceBox(LogoBox * lb,
|
|||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
float xr, float yr, float zr)
|
float xr, float yr, float zr)
|
||||||
{
|
{
|
||||||
this->logoBox = lb;
|
|
||||||
this->x = x;
|
this->x = x;
|
||||||
this->y = y;
|
this->y = y;
|
||||||
this->z = z;
|
this->z = z;
|
||||||
@ -27,6 +26,22 @@ LightBounceBox::LightBounceBox(LogoBox * lb,
|
|||||||
this->yr = yr;
|
this->yr = yr;
|
||||||
this->zr = zr;
|
this->zr = zr;
|
||||||
this->dist = 0.0;
|
this->dist = 0.0;
|
||||||
|
|
||||||
|
m_dl = glGenLists(1);
|
||||||
|
glNewList(m_dl, GL_COMPILE);
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(x, y, z);
|
||||||
|
glRotatef(xr, 1, 0, 0);
|
||||||
|
glRotatef(yr, 0, 1, 0);
|
||||||
|
glRotatef(zr, 0, 0, 1);
|
||||||
|
lb->draw();
|
||||||
|
glPopMatrix();
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
LightBounceBox::~LightBounceBox()
|
||||||
|
{
|
||||||
|
glDeleteLists(m_dl, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct screensaver mode and do some basic OpenGL setup */
|
/* construct screensaver mode and do some basic OpenGL setup */
|
||||||
@ -113,15 +128,7 @@ void LightBounce::update()
|
|||||||
int sz = m_boxes.size();
|
int sz = m_boxes.size();
|
||||||
for (int i = 0; i < sz; i++)
|
for (int i = 0; i < sz; i++)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
m_boxes[i]->draw();
|
||||||
glTranslatef(m_boxes[i]->x,
|
|
||||||
m_boxes[i]->y,
|
|
||||||
m_boxes[i]->z);
|
|
||||||
glRotatef(m_boxes[i]->xr, 1, 0, 0);
|
|
||||||
glRotatef(m_boxes[i]->yr, 0, 1, 0);
|
|
||||||
glRotatef(m_boxes[i]->zr, 0, 0, 1);
|
|
||||||
m_boxes[i]->logoBox->draw();
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
|
@ -18,14 +18,19 @@ public:
|
|||||||
LightBounceBox(LogoBox * lb,
|
LightBounceBox(LogoBox * lb,
|
||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
float xr, float yr, float zr);
|
float xr, float yr, float zr);
|
||||||
LogoBox * logoBox;
|
~LightBounceBox();
|
||||||
|
void draw() { glCallList(m_dl); }
|
||||||
|
float dist;
|
||||||
|
|
||||||
|
private:
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
float xr;
|
float xr;
|
||||||
float yr;
|
float yr;
|
||||||
float zr;
|
float zr;
|
||||||
float dist;
|
|
||||||
|
GLuint m_dl;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LightBounce : public SSMode
|
class LightBounce : public SSMode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user