first wall of LightBox done
git-svn-id: svn://anubis/dwscr/trunk@92 5bef9df8-b654-44bb-925b-0ff18baa8f8c
This commit is contained in:
parent
4ed97f09f6
commit
126b75fb56
1
Makefile
1
Makefile
@ -11,6 +11,7 @@ export CXXFLAGS := -O2 -Wall
|
|||||||
export CPPFLAGS
|
export CPPFLAGS
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CPPFLAGS += -DDEBUG
|
CPPFLAGS += -DDEBUG
|
||||||
|
CPPFLAGS += -g
|
||||||
endif
|
endif
|
||||||
ifdef WITHOUT_ODE
|
ifdef WITHOUT_ODE
|
||||||
CPPFLAGS += -DWITHOUT_ODE
|
CPPFLAGS += -DWITHOUT_ODE
|
||||||
|
@ -8,8 +8,11 @@
|
|||||||
#include "LightBounce.h"
|
#include "LightBounce.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#define SIZE 5
|
||||||
|
|
||||||
/* construct screensaver mode and do some basic OpenGL setup */
|
/* construct screensaver mode and do some basic OpenGL setup */
|
||||||
LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
|
LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
|
||||||
{
|
{
|
||||||
@ -22,6 +25,31 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
|
|||||||
0.01,
|
0.01,
|
||||||
1000.01);
|
1000.01);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
LogoBox tmp;
|
||||||
|
float box_stride = tmp.getWidth() * 1.2;
|
||||||
|
float half_size = SIZE * box_stride / 2.0;
|
||||||
|
float y = -half_size;
|
||||||
|
int rot = false;
|
||||||
|
for (int i = 0; i < SIZE; i++)
|
||||||
|
{
|
||||||
|
float x = -half_size;
|
||||||
|
for (int j = 0; j < SIZE; j++)
|
||||||
|
{
|
||||||
|
LightBounce_Box * box = new LightBounce_Box;
|
||||||
|
box->logoBox = new LogoBox();
|
||||||
|
box->x = x;
|
||||||
|
box->y = y;
|
||||||
|
box->z = -half_size;
|
||||||
|
box->xr = 0;
|
||||||
|
box->yr = 0;
|
||||||
|
box->zr = rot ? 90.0 : 0;
|
||||||
|
m_boxes.push_back(box);
|
||||||
|
x += box_stride;
|
||||||
|
rot = !rot;
|
||||||
|
}
|
||||||
|
y += box_stride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called every time this screensaver mode should redraw the screen */
|
/* called every time this screensaver mode should redraw the screen */
|
||||||
@ -36,9 +64,21 @@ void LightBounce::update()
|
|||||||
{
|
{
|
||||||
glViewport(i*width/numMonitors, 0, width/numMonitors, height);
|
glViewport(i*width/numMonitors, 0, width/numMonitors, height);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluLookAt(0, 0, 12, 0, 0, 0, 0, 1, 0);
|
gluLookAt(0, 0, SIZE * 5.0, 0, 0, 0, 0, 1, 0);
|
||||||
glRotatef(m_elapsed/33.0f, 0, 1, 0);
|
glRotatef(m_elapsed/33.0f, 0, 1, 0);
|
||||||
m_logoBox.draw();
|
int sz = m_boxes.size();
|
||||||
|
for (int i = 0; i < sz; i++)
|
||||||
|
{
|
||||||
|
glPushMatrix();
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,20 @@
|
|||||||
#include "SSMain.h"
|
#include "SSMain.h"
|
||||||
#include "SSMode.h"
|
#include "SSMode.h"
|
||||||
#include "LogoBox.h"
|
#include "LogoBox.h"
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
LogoBox * logoBox;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
float xr;
|
||||||
|
float yr;
|
||||||
|
float zr;
|
||||||
|
float dist;
|
||||||
|
} LightBounce_Box;
|
||||||
|
|
||||||
class LightBounce : public SSMode
|
class LightBounce : public SSMode
|
||||||
{
|
{
|
||||||
@ -16,7 +30,7 @@ public:
|
|||||||
LightBounce(SSMain * _SSMain);
|
LightBounce(SSMain * _SSMain);
|
||||||
void update();
|
void update();
|
||||||
protected:
|
protected:
|
||||||
LogoBox m_logoBox;
|
vector<LightBounce_Box *> m_boxes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user