void RageMatrixAngles( RageMatrix* pOut, const RageVector3 &angles ) { const RageVector3 angles_radians( angles * 2*PI / 360 ); const float sy = RageFastSin( angles_radians[2] ); const float cy = RageFastCos( angles_radians[2] ); const float sp = RageFastSin( angles_radians[1] ); const float cp = RageFastCos( angles_radians[1] ); const float sr = RageFastSin( angles_radians[0] ); const float cr = RageFastCos( angles_radians[0] ); RageMatrixIdentity( pOut ); // matrix = (Z * Y) * X pOut->m[0][0] = cp*cy; pOut->m[0][1] = cp*sy; pOut->m[0][2] = -sp; pOut->m[1][0] = sr*sp*cy+cr*-sy; pOut->m[1][1] = sr*sp*sy+cr*cy; pOut->m[1][2] = sr*cp; pOut->m[2][0] = (cr*sp*cy+-sr*-sy); pOut->m[2][1] = (cr*sp*sy+-sr*cy); pOut->m[2][2] = cr*cp; }
void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z ) { RageMatrixIdentity(pOut); pOut->m[3][0] = x; pOut->m[3][1] = y; pOut->m[3][2] = z; }
void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z ) { RageMatrixIdentity(pOut); pOut->m[0][0] = x; pOut->m[1][1] = y; pOut->m[2][2] = z; }
void RageMatrixRotationZ( RageMatrix* pOut, float theta ) { theta *= PI/180; RageMatrixIdentity(pOut); pOut->m[0][0] = RageFastCos(theta); pOut->m[1][1] = pOut->m[0][0]; pOut->m[0][1] = RageFastSin(theta); pOut->m[1][0] = -pOut->m[0][1]; }
void RageMatrixRotationZ( RageMatrix* pOut, float theta ) { theta *= PI/180; RageMatrixIdentity(pOut); pOut->m[0][0] = cosf(theta); pOut->m[1][1] = pOut->m[0][0]; pOut->m[0][1] = sinf(theta); pOut->m[1][0] = -pOut->m[0][1]; }
RageDisplay::RageDisplay() { RageMatrixIdentity( &g_CenteringMatrix ); g_ProjectionStack = MatrixStack(); g_ViewStack = MatrixStack(); g_WorldStack = MatrixStack(); g_TextureStack = MatrixStack(); // Register with Lua. { Lua *L = LUA->Get(); lua_pushstring( L, "DISPLAY" ); this->PushSelf( L ); lua_settable( L, LUA_GLOBALSINDEX ); LUA->Release( L ); } }
void RageMatrixSkewX( RageMatrix* pOut, float fAmount ) { RageMatrixIdentity(pOut); pOut->m[1][0] = fAmount; }
// Loads identity in the current matrix. void LoadIdentity() { RageMatrixIdentity( &stack.back() ); }
RageMatrix RageMatrixIdentity() { RageMatrix m; RageMatrixIdentity( &m ); return m; }