From 07a2157fe61c63297f449f8ebd6b303cab0932ac Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 12 Oct 2011 12:26:00 -0400 Subject: [PATCH] begin creating the ring --- modes/Tunnel.cc | 40 +++++++++++++++++++++++++++++++++++++++- modes/Tunnel.h | 15 ++++++++++----- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/modes/Tunnel.cc b/modes/Tunnel.cc index f230bf4..ce56705 100644 --- a/modes/Tunnel.cc +++ b/modes/Tunnel.cc @@ -10,6 +10,13 @@ #include "Tunnel.h" +using namespace std; + +#define N_LOGOS_PER_RING 12 +#define RING_RADIUS 18 +#define BREAKOFF_DIST 20 +#define RING_LAYER_DIST 10 + Tunnel::Tunnel() { m_last_ticks = 0; @@ -24,6 +31,21 @@ bool Tunnel::expose (GnomeScreensaver & gs) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + for (list::const_iterator it = m_logos.begin(); + it != m_logos.end(); + it++) + { + glPushMatrix(); + glTranslatef(0, m_offset + it->offset + 50, 0); + glRotatef(it->trot, 0, 1, 0); + glTranslatef(RING_RADIUS, 0, 0); + glRotatef(-90.0, 0, 0, 1); + glRotatef(90.0, 1, 0, 0); + glRotatef(it->zrot, 0, 0, 1); + m_logobox.draw(); + glPopMatrix(); + } + return true; } @@ -36,10 +58,26 @@ bool Tunnel::configure (GnomeScreensaver & gs) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); + gluLookAt(0, 0, 0, 0, 1, 0, 0, 0, 1); glViewport(0, 0, gs.getWidth(), gs.getHeight()); + for (int i = 0; i < 5; i++) + { + for (int j = 0; j < N_LOGOS_PER_RING; j++) + { + float zrot = ((j + i) & 0x3) * 90.0; + float trot = j * 360.0 / N_LOGOS_PER_RING; + LBStruct lbs = { + -i * RING_LAYER_DIST, + zrot, + trot, + {0, 0, 1} + }; + m_logos.push_back(lbs); + } + } + return true; } diff --git a/modes/Tunnel.h b/modes/Tunnel.h index 1136e0d..f1519a9 100644 --- a/modes/Tunnel.h +++ b/modes/Tunnel.h @@ -2,6 +2,8 @@ #ifndef TUNNEL_H #define TUNNEL_H +#include + #include "LogoBox.h" #include "Mode.h" #include "GnomeScreensaver.h" @@ -14,14 +16,17 @@ class Tunnel : public Mode bool expose (GnomeScreensaver & gs); bool configure (GnomeScreensaver & gs); bool update (GnomeScreensaver & gs); + typedef struct { + float offset; + float zrot; + float trot; + float spin_axis[3]; + } LBStruct; protected: LogoBox m_logobox; - int m_num_monitors; uint64_t m_last_ticks; - void initMonitorInfo(); - void getRandomAxis(float (*axis)[3]); - uint32_t getRandomSwitchTime(); - float getRandomSpeed(); + std::list m_logos; + float m_offset; }; #endif /* TUNNEL_H */