/** * Multiply the current matrix with a rotation matrix. * * \param angle angle of rotation, in degrees. * \param x rotation vector x coordinate. * \param y rotation vector y coordinate. * \param z rotation vector z coordinate. * * \sa glRotatef(). * * Flushes the vertices and calls _math_matrix_rotate() with the top-most * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (angle != 0.0F) { _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } }
/** * Multiply the current matrix with a rotation matrix. * * \param angle angle of rotation, in degrees. * \param x rotation vector x coordinate. * \param y rotation vector y coordinate. * \param z rotation vector z coordinate. * * \sa glRotatef(). * * Flushes the vertices and calls _math_matrix_rotate() with the top-most * matrix in the current stack and the given parameters. Marks * __struct gl_contextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); if (angle != 0.0F) { _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } }
void cogl_matrix_rotate (CoglMatrix *matrix, float angle, float x, float y, float z) { #ifndef USE_MESA_MATRIX_API CoglMatrix rotation; CoglMatrix result; float c, s; angle *= G_PI / 180.0f; c = cosf (angle); s = sinf (angle); rotation.xx = x * x * (1.0f - c) + c; rotation.yx = y * x * (1.0f - c) + z * s; rotation.zx = x * z * (1.0f - c) - y * s; rotation.wx = 0.0f; rotation.xy = x * y * (1.0f - c) - z * s; rotation.yy = y * y * (1.0f - c) + c; rotation.zy = y * z * (1.0f - c) + x * s; rotation.wy = 0.0f; rotation.xz = x * z * (1.0f - c) + y * s; rotation.yz = y * z * (1.0f - c) - x * s; rotation.zz = z * z * (1.0f - c) + c; rotation.wz = 0.0f; rotation.xw = 0.0f; rotation.yw = 0.0f; rotation.zw = 0.0f; rotation.ww = 1.0f; cogl_matrix_multiply (&result, matrix, &rotation); *matrix = result; #else _math_matrix_rotate (matrix, angle, x, y, z); #endif _COGL_MATRIX_DEBUG_PRINT (matrix); }