dwscr/ss/SSMode.cc
josh 8d759e4fd7 added WITHOUT_ODE testing to some sources to build without ODE support
git-svn-id: svn://anubis/dwscr/trunk@124 5bef9df8-b654-44bb-925b-0ff18baa8f8c
2010-10-26 20:22:28 +00:00

54 lines
1.1 KiB
C++

/* Author: Josh Holtrop
* DornerWorks screensaver
* SSMode is base class that provides common functionality for
* screensaver modes. It should be extended by a screensaver
* mode implementing class.
*/
#include "SSMode.h"
SSMode::SSMode(SSMain * _SSMain)
: m_SSMain(_SSMain)
{
m_startTick = SDL_GetTicks();
}
SSMode::~SSMode()
{
}
/* update the number of elapsed milliseconds */
void SSMode::update()
{
Uint32 ticks = SDL_GetTicks();
m_elapsed = ticks - m_startTick;
}
#ifndef WITHOUT_ODE
/* push an OpenGL matrix onto the matrix stack for a given
* ODE body position and rotation */
void SSMode::pushTransform(const dReal pos[3], const dReal R[12])
{
GLfloat matrix[16];
matrix[0] = R[0];
matrix[1] = R[4];
matrix[2] = R[8];
matrix[3] = 0;
matrix[4] = R[1];
matrix[5] = R[5];
matrix[6] = R[9];
matrix[7] = 0;
matrix[8] = R[2];
matrix[9] = R[6];
matrix[10] = R[10];
matrix[11] = 0;
matrix[12] = pos[0];
matrix[13] = pos[1];
matrix[14] = pos[2];
matrix[15] = 1;
glPushMatrix();
glMultMatrixf(matrix);
}
#endif