diff --git a/clutter/clutter/clutter-cogl.c b/clutter/clutter/clutter-cogl.c index 2ba1b1612..712bbe913 100644 --- a/clutter/clutter/clutter-cogl.c +++ b/clutter/clutter/clutter-cogl.c @@ -83,15 +83,15 @@ cogl_matrix_progress (const GValue *a, /* skew */ shear_res = shear1[2] + (shear2[2] - shear1[2]) * progress; /* YZ */ if (shear_res != 0.f) - _clutter_util_matrix_skew_yz (&res, shear_res); + cogl_matrix_skew_yz (&res, shear_res); shear_res = shear1[1] + (shear2[1] - shear1[1]) * progress; /* XZ */ if (shear_res != 0.f) - _clutter_util_matrix_skew_xz (&res, shear_res); + cogl_matrix_skew_xz (&res, shear_res); shear_res = shear1[0] + (shear2[0] - shear1[0]) * progress; /* XY */ if (shear_res != 0.f) - _clutter_util_matrix_skew_xy (&res, shear_res); + cogl_matrix_skew_xy (&res, shear_res); /* scale */ graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res); diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h index 7d4dfd04a..27f7da3be 100644 --- a/clutter/clutter/clutter-private.h +++ b/clutter/clutter/clutter-private.h @@ -257,13 +257,6 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a, float _clutter_util_matrix_determinant (const CoglMatrix *matrix); -void _clutter_util_matrix_skew_xy (CoglMatrix *matrix, - float factor); -void _clutter_util_matrix_skew_xz (CoglMatrix *matrix, - float factor); -void _clutter_util_matrix_skew_yz (CoglMatrix *matrix, - float factor); - gboolean _clutter_util_matrix_decompose (const CoglMatrix *src, graphene_point3d_t *scale_p, float shear_p[3], diff --git a/clutter/clutter/clutter-util.c b/clutter/clutter/clutter-util.c index 0aca5dbd9..0c5c244c4 100644 --- a/clutter/clutter/clutter-util.c +++ b/clutter/clutter/clutter-util.c @@ -285,36 +285,6 @@ _clutter_util_matrix_transpose_vector4_transform (const CoglMatrix *matrix, + matrix->ww * point->w; } -void -_clutter_util_matrix_skew_xy (CoglMatrix *matrix, - float factor) -{ - matrix->yx += matrix->xx * factor; - matrix->yy += matrix->xy * factor; - matrix->yz += matrix->xz * factor; - matrix->yw += matrix->xw * factor; -} - -void -_clutter_util_matrix_skew_xz (CoglMatrix *matrix, - float factor) -{ - matrix->zx += matrix->xx * factor; - matrix->zy += matrix->xy * factor; - matrix->zz += matrix->xz * factor; - matrix->zw += matrix->xw * factor; -} - -void -_clutter_util_matrix_skew_yz (CoglMatrix *matrix, - float factor) -{ - matrix->zx += matrix->yx * factor; - matrix->zy += matrix->yy * factor; - matrix->zz += matrix->yz * factor; - matrix->zw += matrix->yw * factor; -} - static void _clutter_util_vertex_combine (const graphene_point3d_t *a, const graphene_point3d_t *b, diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c index 7bd2af0b0..17ee499dd 100644 --- a/cogl/cogl/cogl-matrix.c +++ b/cogl/cogl/cogl-matrix.c @@ -2246,3 +2246,42 @@ cogl_gtype_matrix_get_type (void) { return cogl_matrix_get_gtype (); } + +void +cogl_matrix_skew_xy (CoglMatrix *matrix, + float factor) +{ + matrix->yx += matrix->xx * factor; + matrix->yy += matrix->xy * factor; + matrix->yz += matrix->xz * factor; + matrix->yw += matrix->xw * factor; + + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_matrix_skew_xz (CoglMatrix *matrix, + float factor) +{ + matrix->zx += matrix->xx * factor; + matrix->zy += matrix->xy * factor; + matrix->zz += matrix->xz * factor; + matrix->zw += matrix->xw * factor; + + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_matrix_skew_yz (CoglMatrix *matrix, + float factor) +{ + matrix->zx += matrix->yx * factor; + matrix->zy += matrix->yy * factor; + matrix->zz += matrix->yz * factor; + matrix->zw += matrix->yw * factor; + + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} diff --git a/cogl/cogl/cogl-matrix.h b/cogl/cogl/cogl-matrix.h index e784b094a..4b5eef699 100644 --- a/cogl/cogl/cogl-matrix.h +++ b/cogl/cogl/cogl-matrix.h @@ -760,6 +760,51 @@ GType cogl_matrix_get_gtype (void); COGL_EXPORT GType cogl_gtype_matrix_get_type (void); + +/** + * cogl_matrix_determinant: + * @matrix: a #CoglMatrix + * + * Computes the determinant of the @matrix. + * + * Returns: the value of the determinant + */ +COGL_EXPORT float +cogl_matrix_determinant (const CoglMatrix *matrix); + +/** + * cogl_matrix_skew_xy: + * @matrix: a #CoglMatrix + * @factor: skew factor + * + * Adds a skew of factor on the X and Y axis to @matrix. + */ +COGL_EXPORT void +cogl_matrix_skew_xy (CoglMatrix *matrix, + float factor); + +/** + * cogl_matrix_skew_xz: + * @matrix: a #CoglMatrix + * @factor: skew factor + * + * Adds a skew of factor on the X and Z axis to @matrix. + */ +COGL_EXPORT void +cogl_matrix_skew_xz (CoglMatrix *matrix, + float factor); + +/** + * cogl_matrix_skew_yz: + * @matrix: a #CoglMatrix + * @factor: skew factor + * + * Adds a skew of factor on the Y and Z axis to @matrix. + */ +COGL_EXPORT void +cogl_matrix_skew_yz (CoglMatrix *matrix, + float factor); + G_END_DECLS #endif /* __COGL_MATRIX_H */