From 50a170bafc8142d1cc4402e3f25feb9f83320878 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 11 Sep 2020 20:01:54 -0300 Subject: Remove CoglMatrix Adios, amiga. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439 --- cogl/cogl/cogl-clip-stack.c | 1 - cogl/cogl/cogl-clip-stack.h | 1 - cogl/cogl/cogl-framebuffer.c | 7 - cogl/cogl/cogl-matrix-private.h | 58 ---- cogl/cogl/cogl-matrix-stack.c | 1 - cogl/cogl/cogl-matrix-stack.h | 1 - cogl/cogl/cogl-matrix.c | 370 --------------------- cogl/cogl/cogl-matrix.h | 491 ---------------------------- cogl/cogl/cogl-meta-texture.c | 1 - cogl/cogl/cogl-pipeline-layer-private.h | 1 - cogl/cogl/cogl-pipeline-layer-state.c | 1 - cogl/cogl/cogl-pipeline-layer-state.h | 1 - cogl/cogl/cogl-pipeline-private.h | 1 - cogl/cogl/cogl.c | 1 - cogl/cogl/cogl.h | 1 - cogl/cogl/deprecated/cogl-material-compat.c | 1 - cogl/cogl/deprecated/cogl-material-compat.h | 1 - cogl/cogl/meson.build | 3 - 18 files changed, 942 deletions(-) delete mode 100644 cogl/cogl/cogl-matrix-private.h delete mode 100644 cogl/cogl/cogl-matrix.c delete mode 100644 cogl/cogl/cogl-matrix.h diff --git a/cogl/cogl/cogl-clip-stack.c b/cogl/cogl/cogl-clip-stack.c index e39f5b909..e15818721 100644 --- a/cogl/cogl/cogl-clip-stack.c +++ b/cogl/cogl/cogl-clip-stack.c @@ -40,7 +40,6 @@ #include "cogl-framebuffer-private.h" #include "cogl-journal-private.h" #include "cogl-util.h" -#include "cogl-matrix-private.h" #include "cogl-primitives-private.h" #include "cogl-private.h" #include "cogl-attribute-private.h" diff --git a/cogl/cogl/cogl-clip-stack.h b/cogl/cogl/cogl-clip-stack.h index 62d65bcd3..2efaa2777 100644 --- a/cogl/cogl/cogl-clip-stack.h +++ b/cogl/cogl/cogl-clip-stack.h @@ -31,7 +31,6 @@ #ifndef __COGL_CLIP_STACK_H #define __COGL_CLIP_STACK_H -#include "cogl-matrix.h" #include "cogl-primitive.h" #include "cogl-framebuffer.h" #include "cogl-matrix-stack.h" diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index 21fdf2e97..b4991900b 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -45,7 +45,6 @@ #include "cogl-clip-stack.h" #include "cogl-journal-private.h" #include "cogl-pipeline-state-private.h" -#include "cogl-matrix-private.h" #include "cogl-primitive-private.h" #include "cogl-offscreen.h" #include "cogl1-context.h" @@ -1600,7 +1599,6 @@ cogl_framebuffer_get_modelview_matrix (CoglFramebuffer *framebuffer, CoglMatrixEntry *modelview_entry = _cogl_framebuffer_get_modelview_entry (framebuffer); cogl_matrix_entry_get (modelview_entry, matrix); - _COGL_MATRIX_DEBUG_PRINT (matrix); } void @@ -1614,8 +1612,6 @@ cogl_framebuffer_set_modelview_matrix (CoglFramebuffer *framebuffer, if (framebuffer->context->current_draw_buffer == framebuffer) framebuffer->context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_MODELVIEW; - - _COGL_MATRIX_DEBUG_PRINT (matrix); } void @@ -1625,7 +1621,6 @@ cogl_framebuffer_get_projection_matrix (CoglFramebuffer *framebuffer, CoglMatrixEntry *projection_entry = _cogl_framebuffer_get_projection_entry (framebuffer); cogl_matrix_entry_get (projection_entry, matrix); - _COGL_MATRIX_DEBUG_PRINT (matrix); } void @@ -1644,8 +1639,6 @@ cogl_framebuffer_set_projection_matrix (CoglFramebuffer *framebuffer, if (framebuffer->context->current_draw_buffer == framebuffer) framebuffer->context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_PROJECTION; - - _COGL_MATRIX_DEBUG_PRINT (matrix); } void diff --git a/cogl/cogl/cogl-matrix-private.h b/cogl/cogl/cogl-matrix-private.h deleted file mode 100644 index ec9704342..000000000 --- a/cogl/cogl/cogl-matrix-private.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2008,2009 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - * - * Authors: - * Robert Bragg - */ - -#ifndef __COGL_MATRIX_PRIVATE_H -#define __COGL_MATRIX_PRIVATE_H - -#include - -G_BEGIN_DECLS - -#define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \ - if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \ - { \ - g_print ("%s:\n", G_STRFUNC); \ - cogl_debug_matrix_print (MATRIX); \ - } - -void -_cogl_matrix_prefix_print (const char *prefix, const graphene_matrix_t *matrix); - -void -_cogl_matrix_init_from_matrix_without_inverse (graphene_matrix_t *matrix, - const graphene_matrix_t *src); - -G_END_DECLS - -#endif /* __COGL_MATRIX_PRIVATE_H */ - diff --git a/cogl/cogl/cogl-matrix-stack.c b/cogl/cogl/cogl-matrix-stack.c index b978c51a0..3f6883068 100644 --- a/cogl/cogl/cogl-matrix-stack.c +++ b/cogl/cogl/cogl-matrix-stack.c @@ -39,7 +39,6 @@ #include "cogl-framebuffer-private.h" #include "cogl-object-private.h" #include "cogl-offscreen.h" -#include "cogl-matrix-private.h" #include "cogl-magazine-private.h" #include "cogl-gtype-private.h" diff --git a/cogl/cogl/cogl-matrix-stack.h b/cogl/cogl/cogl-matrix-stack.h index 1b83a8e24..3e330916f 100644 --- a/cogl/cogl/cogl-matrix-stack.h +++ b/cogl/cogl/cogl-matrix-stack.h @@ -39,7 +39,6 @@ #error "Only can be included directly." #endif -#include "cogl-matrix.h" #include "cogl-context.h" #include diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c deleted file mode 100644 index a8a96c694..000000000 --- a/cogl/cogl/cogl-matrix.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009,2010,2011 Intel Corporation. - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Robert Bragg - * Georges Basile Stavracas Neto - */ - -#include "cogl-config.h" - -#include -#include -#include -#include - -#include -#include -#include - -void -cogl_matrix_multiply (graphene_matrix_t *result, - const graphene_matrix_t *a, - const graphene_matrix_t *b) -{ - graphene_matrix_multiply (b, a, result); - _COGL_MATRIX_DEBUG_PRINT (result); -} - -void -_cogl_matrix_prefix_print (const char *prefix, - const graphene_matrix_t *matrix) -{ - graphene_matrix_print (matrix); -} - -/* - * Dumps the contents of a graphene_matrix_t structure. - */ -void -cogl_debug_matrix_print (const graphene_matrix_t *matrix) -{ - _cogl_matrix_prefix_print ("", matrix); -} - -void -cogl_matrix_rotate (graphene_matrix_t *matrix, - float angle, - float x, - float y, - float z) -{ - graphene_matrix_t rotation; - graphene_vec3_t axis; - - graphene_vec3_init (&axis, x, y, z); - graphene_matrix_init_rotate (&rotation, angle, &axis); - graphene_matrix_multiply (&rotation, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_rotate_euler (graphene_matrix_t *matrix, - const graphene_euler_t *euler) -{ - graphene_matrix_t rotation_transform; - - cogl_matrix_init_from_euler (&rotation_transform, euler); - cogl_matrix_multiply (matrix, matrix, &rotation_transform); -} - -void -cogl_matrix_frustum (graphene_matrix_t *matrix, - float left, - float right, - float bottom, - float top, - float z_near, - float z_far) -{ - graphene_matrix_t frustum; - - graphene_matrix_init_frustum (&frustum, - left, right, - bottom, top, - z_near, z_far); - graphene_matrix_multiply (&frustum, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_perspective (graphene_matrix_t *matrix, - float fov_y, - float aspect, - float z_near, - float z_far) -{ - float ymax = z_near * tan (fov_y * G_PI / 360.0); - - cogl_matrix_frustum (matrix, - -ymax * aspect, /* left */ - ymax * aspect, /* right */ - -ymax, /* bottom */ - ymax, /* top */ - z_near, - z_far); - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_orthographic (graphene_matrix_t *matrix, - float left, - float bottom, - float right, - float top, - float near, - float far) -{ - graphene_matrix_t ortho; - - graphene_matrix_init_ortho (&ortho, - left, right, - top, bottom, - near, far); - graphene_matrix_multiply (&ortho, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_scale (graphene_matrix_t *matrix, - float sx, - float sy, - float sz) -{ - graphene_matrix_t scale; - - graphene_matrix_init_scale (&scale, sx, sy, sz); - graphene_matrix_multiply (&scale, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_translate (graphene_matrix_t *matrix, - float x, - float y, - float z) -{ - graphene_matrix_t translation; - - graphene_matrix_init_translate (&translation, - &GRAPHENE_POINT3D_INIT (x, y, z)); - graphene_matrix_multiply (&translation, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_init_identity (graphene_matrix_t *matrix) -{ - graphene_matrix_init_identity (matrix); - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_init_translation (graphene_matrix_t *matrix, - float tx, - float ty, - float tz) -{ - graphene_matrix_init_translate (matrix, &GRAPHENE_POINT3D_INIT (tx, ty, tz)); - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -/* - * Loads a matrix array into graphene_matrix_t. - * - * @m matrix array. - * @mat matrix. - * - * Copies \p m into graphene_matrix_t::m and marks the MAT_FLAG_GENERAL and - * MAT_DIRTY_ALL - * flags. - */ -static void -_cogl_matrix_init_from_array (graphene_matrix_t *matrix, - const float *array) -{ - graphene_matrix_init_from_float (matrix, array); -} - -void -cogl_matrix_init_from_array (graphene_matrix_t *matrix, - const float *array) -{ - _cogl_matrix_init_from_array (matrix, array); - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_init_from_matrix (graphene_matrix_t *matrix, - const graphene_matrix_t *source) -{ - memcpy (matrix, source, sizeof (graphene_matrix_t)); -} - -void -_cogl_matrix_init_from_matrix_without_inverse (graphene_matrix_t *matrix, - const graphene_matrix_t *src) -{ - graphene_matrix_init_from_matrix (matrix, src); -} - -void -cogl_matrix_init_from_euler (graphene_matrix_t *matrix, - const graphene_euler_t *euler) -{ - graphene_matrix_init_identity (matrix); - graphene_matrix_rotate_euler (matrix, euler); -} - -gboolean -cogl_matrix_equal (const void *v1, const void *v2) -{ - const graphene_matrix_t *a = v1; - const graphene_matrix_t *b = v2; - - g_return_val_if_fail (v1 != NULL, FALSE); - g_return_val_if_fail (v2 != NULL, FALSE); - - return graphene_matrix_equal_fast (a, b); -} - -graphene_matrix_t * -cogl_matrix_copy (const graphene_matrix_t *matrix) -{ - if (G_LIKELY (matrix)) - return g_slice_dup (graphene_matrix_t, matrix); - - return NULL; -} - -void -cogl_matrix_free (graphene_matrix_t *matrix) -{ - g_slice_free (graphene_matrix_t, matrix); -} - -void -cogl_matrix_to_float (const graphene_matrix_t *matrix, - float *out_array) -{ - graphene_matrix_to_float (matrix, out_array); -} - -float -cogl_matrix_get_value (const graphene_matrix_t *matrix, - unsigned int row, - unsigned int column) -{ - return graphene_matrix_get_value (matrix, column, row); -} - -gboolean -cogl_matrix_is_identity (const graphene_matrix_t *matrix) -{ - return graphene_matrix_is_identity (matrix); -} - -void -cogl_matrix_look_at (graphene_matrix_t *matrix, - float eye_position_x, - float eye_position_y, - float eye_position_z, - float object_x, - float object_y, - float object_z, - float world_up_x, - float world_up_y, - float world_up_z) -{ - graphene_vec3_t eye; - graphene_vec3_t center; - graphene_vec3_t up; - graphene_matrix_t look_at; - - graphene_vec3_init (&eye, eye_position_x, eye_position_y, eye_position_z); - graphene_vec3_init (¢er, object_x, object_y, object_z); - graphene_vec3_init (&up, world_up_x, world_up_y, world_up_z); - - graphene_matrix_init_look_at (&look_at, &eye, ¢er, &up); - - cogl_matrix_multiply (matrix, matrix, &look_at); -} - -void -cogl_matrix_transpose (graphene_matrix_t *matrix) -{ - /* We don't need to do anything if the matrix is the identity matrix */ - if (graphene_matrix_is_identity (matrix)) - return; - - graphene_matrix_transpose (matrix, matrix); -} - -void -cogl_matrix_skew_xy (graphene_matrix_t *matrix, - float factor) -{ - graphene_matrix_t skew; - - graphene_matrix_init_identity (&skew); - graphene_matrix_skew_xy (&skew, factor); - graphene_matrix_multiply (&skew, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_skew_xz (graphene_matrix_t *matrix, - float factor) -{ - graphene_matrix_t skew; - - graphene_matrix_init_identity (&skew); - graphene_matrix_skew_xz (&skew, factor); - graphene_matrix_multiply (&skew, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} - -void -cogl_matrix_skew_yz (graphene_matrix_t *matrix, - float factor) -{ - graphene_matrix_t skew; - - graphene_matrix_init_identity (&skew); - graphene_matrix_skew_yz (&skew, factor); - graphene_matrix_multiply (&skew, matrix, matrix); - - _COGL_MATRIX_DEBUG_PRINT (matrix); -} diff --git a/cogl/cogl/cogl-matrix.h b/cogl/cogl/cogl-matrix.h deleted file mode 100644 index 008e5b467..000000000 --- a/cogl/cogl/cogl-matrix.h +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2008,2009 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - * - * Authors: - * Robert Bragg - */ - -#ifndef __COGL_MATRIX_H -#define __COGL_MATRIX_H - -#include - -#include - -#include -#include - -#include - -#include - -G_BEGIN_DECLS - -/** - * SECTION:cogl-matrix - * @short_description: Functions for initializing and manipulating 4x4 matrices - * - * Matrices are used in Cogl to describe affine model-view transforms, texture - * transforms, and projective transforms. This exposes a utility API that can - * be used for direct manipulation of these matrices. - */ - -/** - * cogl_matrix_init_identity: - * @matrix: A 4x4 transformation matrix - * - * Resets matrix to the identity matrix: - * - * |[ - * .xx=1; .xy=0; .xz=0; .xw=0; - * .yx=0; .yy=1; .yz=0; .yw=0; - * .zx=0; .zy=0; .zz=1; .zw=0; - * .wx=0; .wy=0; .wz=0; .ww=1; - * ]| - */ -COGL_EXPORT void -cogl_matrix_init_identity (graphene_matrix_t *matrix); - -/** - * cogl_matrix_init_translation: - * @matrix: A 4x4 transformation matrix - * @tx: x coordinate of the translation vector - * @ty: y coordinate of the translation vector - * @tz: z coordinate of the translation vector - * - * Resets matrix to the (tx, ty, tz) translation matrix: - * - * |[ - * .xx=1; .xy=0; .xz=0; .xw=tx; - * .yx=0; .yy=1; .yz=0; .yw=ty; - * .zx=0; .zy=0; .zz=1; .zw=tz; - * .wx=0; .wy=0; .wz=0; .ww=1; - * ]| - * - * Since: 2.0 - */ -COGL_EXPORT void -cogl_matrix_init_translation (graphene_matrix_t *matrix, - float tx, - float ty, - float tz); - -/** - * cogl_matrix_multiply: - * @result: The address of a 4x4 matrix to store the result in - * @a: A 4x4 transformation matrix - * @b: A 4x4 transformation matrix - * - * Multiplies the two supplied matrices together and stores - * the resulting matrix inside @result. - * - * It is possible to multiply the @a matrix in-place, so - * @result can be equal to @a but can't be equal to @b. - */ -COGL_EXPORT void -cogl_matrix_multiply (graphene_matrix_t *result, - const graphene_matrix_t *a, - const graphene_matrix_t *b); - -/** - * cogl_matrix_rotate: - * @matrix: A 4x4 transformation matrix - * @angle: The angle you want to rotate in degrees - * @x: X component of your rotation vector - * @y: Y component of your rotation vector - * @z: Z component of your rotation vector - * - * Multiplies @matrix with a rotation matrix that applies a rotation - * of @angle degrees around the specified 3D vector. - */ -COGL_EXPORT void -cogl_matrix_rotate (graphene_matrix_t *matrix, - float angle, - float x, - float y, - float z); - -/** - * cogl_matrix_rotate_euler: - * @matrix: A 4x4 transformation matrix - * @euler: A euler describing a rotation - * - * Multiplies @matrix with a rotation transformation described by the - * given #graphene_euler_t. - * - * Since: 2.0 - */ -COGL_EXPORT void -cogl_matrix_rotate_euler (graphene_matrix_t *matrix, - const graphene_euler_t *euler); - -/** - * cogl_matrix_translate: - * @matrix: A 4x4 transformation matrix - * @x: The X translation you want to apply - * @y: The Y translation you want to apply - * @z: The Z translation you want to apply - * - * Multiplies @matrix with a transform matrix that translates along - * the X, Y and Z axis. - */ -COGL_EXPORT void -cogl_matrix_translate (graphene_matrix_t *matrix, - float x, - float y, - float z); - -/** - * cogl_matrix_scale: - * @matrix: A 4x4 transformation matrix - * @sx: The X scale factor - * @sy: The Y scale factor - * @sz: The Z scale factor - * - * Multiplies @matrix with a transform matrix that scales along the X, - * Y and Z axis. - */ -COGL_EXPORT void -cogl_matrix_scale (graphene_matrix_t *matrix, - float sx, - float sy, - float sz); - -/** - * cogl_matrix_look_at: - * @matrix: A 4x4 transformation matrix - * @eye_position_x: The X coordinate to look from - * @eye_position_y: The Y coordinate to look from - * @eye_position_z: The Z coordinate to look from - * @object_x: The X coordinate of the object to look at - * @object_y: The Y coordinate of the object to look at - * @object_z: The Z coordinate of the object to look at - * @world_up_x: The X component of the world's up direction vector - * @world_up_y: The Y component of the world's up direction vector - * @world_up_z: The Z component of the world's up direction vector - * - * Applies a view transform @matrix that positions the camera at - * the coordinate (@eye_position_x, @eye_position_y, @eye_position_z) - * looking towards an object at the coordinate (@object_x, @object_y, - * @object_z). The top of the camera is aligned to the given world up - * vector, which is normally simply (0, 1, 0) to map up to the - * positive direction of the y axis. - * - * Because there is a lot of misleading documentation online for - * gluLookAt regarding the up vector we want to try and be a bit - * clearer here. - * - * The up vector should simply be relative to your world coordinates - * and does not need to change as you move the eye and object - * positions. Many online sources may claim that the up vector needs - * to be perpendicular to the vector between the eye and object - * position (partly because the man page is somewhat misleading) but - * that is not necessary for this function. - * - * You should never look directly along the world-up - * vector. - * - * It is assumed you are using a typical projection matrix where - * your origin maps to the center of your viewport. - * - * Almost always when you use this function it should be the first - * transform applied to a new modelview transform - * - * Since: 1.8 - * Stability: unstable - */ -COGL_EXPORT void -cogl_matrix_look_at (graphene_matrix_t *matrix, - float eye_position_x, - float eye_position_y, - float eye_position_z, - float object_x, - float object_y, - float object_z, - float world_up_x, - float world_up_y, - float world_up_z); - -/** - * cogl_matrix_frustum: - * @matrix: A 4x4 transformation matrix - * @left: X position of the left clipping plane where it - * intersects the near clipping plane - * @right: X position of the right clipping plane where it - * intersects the near clipping plane - * @bottom: Y position of the bottom clipping plane where it - * intersects the near clipping plane - * @top: Y position of the top clipping plane where it intersects - * the near clipping plane - * @z_near: The distance to the near clipping plane (Must be positive) - * @z_far: The distance to the far clipping plane (Must be positive) - * - * Multiplies @matrix by the given frustum perspective matrix. - */ -COGL_EXPORT void -cogl_matrix_frustum (graphene_matrix_t *matrix, - float left, - float right, - float bottom, - float top, - float z_near, - float z_far); - -/** - * cogl_matrix_perspective: - * @matrix: A 4x4 transformation matrix - * @fov_y: Vertical field of view angle in degrees. - * @aspect: The (width over height) aspect ratio for display - * @z_near: The distance to the near clipping plane (Must be positive, - * and must not be 0) - * @z_far: The distance to the far clipping plane (Must be positive) - * - * Multiplies @matrix by the described perspective matrix - * - * You should be careful not to have to great a @z_far / @z_near - * ratio since that will reduce the effectiveness of depth testing - * since there won't be enough precision to identify the depth of - * objects near to each other. - */ -COGL_EXPORT void -cogl_matrix_perspective (graphene_matrix_t *matrix, - float fov_y, - float aspect, - float z_near, - float z_far); - -/** - * cogl_matrix_orthographic: - * @matrix: A 4x4 transformation matrix - * @left: The x coordinate for the first vertical clipping plane - * @bottom: The y coordinate for the first horizontal clipping plane - * @right: The x coordinate for the second vertical clipping plane - * @top: The y coordinate for the second horizontal clipping plane - * @near: The distance to the near clipping - * plane (will be negative if the plane is - * behind the viewer) - * @far: The distance to the far clipping - * plane (will be negative if the plane is - * behind the viewer) - * - * Multiplies @matrix by a parallel projection matrix. - * - * Since: 1.10 - * Stability: unstable - */ -COGL_EXPORT void -cogl_matrix_orthographic (graphene_matrix_t *matrix, - float left, - float bottom, - float right, - float top, - float near, - float far); - -/** - * cogl_matrix_init_from_array: - * @matrix: A 4x4 transformation matrix - * @array: A linear array of 16 floats (column-major order) - * - * Initializes @matrix with the contents of @array - */ -COGL_EXPORT void -cogl_matrix_init_from_array (graphene_matrix_t *matrix, - const float *array); - -/** - * cogl_matrix_init_from_matrix: - * @matrix: A 4x4 transformation matrix - * @source: the #graphene_matrix_t to copy - * - * Initializes @matrix with the contents of @source - */ -COGL_EXPORT void -cogl_matrix_init_from_matrix (graphene_matrix_t *matrix, - const graphene_matrix_t *source); - -/** - * cogl_matrix_to_float: - * @matrix: A 4x4 transformation matrix - * @out_array: (array fixed-size=16) (out caller-allocates): return location - * for an array of floating point values. The array must be capable of - * holding at least 16 values. - * - * Casts @matrix to a float array which can be directly passed to OpenGL. - */ -COGL_EXPORT void -cogl_matrix_to_float (const graphene_matrix_t *matrix, - float *out_array); - -/** - * cogl_matrix_get_value: - * @matrix: A 4x4 transformation matrix - * - * - */ -COGL_EXPORT float -cogl_matrix_get_value (const graphene_matrix_t *matrix, - unsigned int row, - unsigned int column); - -/** - * cogl_matrix_init_from_euler: - * @matrix: A 4x4 transformation matrix - * @euler: A #graphene_euler_t - * - * Initializes @matrix from a #graphene_euler_t rotation. - */ -COGL_EXPORT void -cogl_matrix_init_from_euler (graphene_matrix_t *matrix, - const graphene_euler_t *euler); - -/** - * cogl_matrix_equal: - * @v1: A 4x4 transformation matrix - * @v2: A 4x4 transformation matrix - * - * Compares two matrices to see if they represent the same - * transformation. Although internally the matrices may have different - * annotations associated with them and may potentially have a cached - * inverse matrix these are not considered in the comparison. - * - * Since: 1.4 - */ -COGL_EXPORT gboolean -cogl_matrix_equal (const void *v1, const void *v2); - -/** - * cogl_matrix_copy: - * @matrix: A 4x4 transformation matrix you want to copy - * - * Allocates a new #graphene_matrix_t on the heap and initializes it with - * the same values as @matrix. - * - * Return value: (transfer full): A newly allocated #graphene_matrix_t which - * should be freed using cogl_matrix_free() - * - * Since: 1.6 - */ -COGL_EXPORT graphene_matrix_t * -cogl_matrix_copy (const graphene_matrix_t *matrix); - -/** - * cogl_matrix_free: - * @matrix: A 4x4 transformation matrix you want to free - * - * Frees a #graphene_matrix_t that was previously allocated via a call to - * cogl_matrix_copy(). - * - * Since: 1.6 - */ -COGL_EXPORT void -cogl_matrix_free (graphene_matrix_t *matrix); - -/** - * cogl_matrix_is_identity: - * @matrix: A #graphene_matrix_t - * - * Determines if the given matrix is an identity matrix. - * - * Returns: %TRUE if @matrix is an identity matrix else %FALSE - * Since: 1.8 - */ -COGL_EXPORT gboolean -cogl_matrix_is_identity (const graphene_matrix_t *matrix); - -/** - * cogl_matrix_transpose: - * @matrix: A #graphene_matrix_t - * - * Replaces @matrix with its transpose. Ie, every element (i,j) in the - * new matrix is taken from element (j,i) in the old matrix. - * - * Since: 1.10 - */ -COGL_EXPORT void -cogl_matrix_transpose (graphene_matrix_t *matrix); - -/** - * cogl_debug_matrix_print: - * @matrix: A #graphene_matrix_t - * - * Prints the contents of a #graphene_matrix_t to stdout. - * - * Since: 2.0 - */ -COGL_EXPORT void -cogl_debug_matrix_print (const graphene_matrix_t *matrix); - -/** - * cogl_matrix_determinant: - * @matrix: a #graphene_matrix_t - * - * Computes the determinant of the @matrix. - * - * Returns: the value of the determinant - */ -COGL_EXPORT float -cogl_matrix_determinant (const graphene_matrix_t *matrix); - -/** - * cogl_matrix_skew_xy: - * @matrix: a #graphene_matrix_t - * @factor: skew factor - * - * Adds a skew of factor on the X and Y axis to @matrix. - */ -COGL_EXPORT void -cogl_matrix_skew_xy (graphene_matrix_t *matrix, - float factor); - -/** - * cogl_matrix_skew_xz: - * @matrix: a #graphene_matrix_t - * @factor: skew factor - * - * Adds a skew of factor on the X and Z axis to @matrix. - */ -COGL_EXPORT void -cogl_matrix_skew_xz (graphene_matrix_t *matrix, - float factor); - -/** - * cogl_matrix_skew_yz: - * @matrix: a #graphene_matrix_t - * @factor: skew factor - * - * Adds a skew of factor on the Y and Z axis to @matrix. - */ -COGL_EXPORT void -cogl_matrix_skew_yz (graphene_matrix_t *matrix, - float factor); - -G_END_DECLS - -#endif /* __COGL_MATRIX_H */ diff --git a/cogl/cogl/cogl-meta-texture.c b/cogl/cogl/cogl-meta-texture.c index 026d86cd7..b8b91aa4a 100644 --- a/cogl/cogl/cogl-meta-texture.c +++ b/cogl/cogl/cogl-meta-texture.c @@ -33,7 +33,6 @@ #include "cogl-config.h" #include "cogl-texture.h" -#include "cogl-matrix.h" #include "cogl-spans.h" #include "cogl-meta-texture.h" #include "cogl-texture-private.h" diff --git a/cogl/cogl/cogl-pipeline-layer-private.h b/cogl/cogl/cogl-pipeline-layer-private.h index 6328d3374..461a45519 100644 --- a/cogl/cogl/cogl-pipeline-layer-private.h +++ b/cogl/cogl/cogl-pipeline-layer-private.h @@ -38,7 +38,6 @@ #include "cogl-pipeline.h" #include "cogl-node-private.h" #include "cogl-texture.h" -#include "cogl-matrix.h" #include "cogl-pipeline-layer-state.h" #include "cogl-pipeline-snippet-private.h" #include "cogl-sampler-cache-private.h" diff --git a/cogl/cogl/cogl-pipeline-layer-state.c b/cogl/cogl/cogl-pipeline-layer-state.c index 0260f90db..b2503148d 100644 --- a/cogl/cogl/cogl-pipeline-layer-state.c +++ b/cogl/cogl/cogl-pipeline-layer-state.c @@ -37,7 +37,6 @@ #include "cogl-pipeline-private.h" #include "cogl-blend-string.h" #include "cogl-util.h" -#include "cogl-matrix.h" #include "cogl-snippet-private.h" #include "cogl-texture-private.h" #include "cogl-pipeline-layer-state-private.h" diff --git a/cogl/cogl/cogl-pipeline-layer-state.h b/cogl/cogl/cogl-pipeline-layer-state.h index 9e33e8184..13bc46578 100644 --- a/cogl/cogl/cogl-pipeline-layer-state.h +++ b/cogl/cogl/cogl-pipeline-layer-state.h @@ -37,7 +37,6 @@ #include #include -#include #include G_BEGIN_DECLS diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h index dbe62f82e..b62c92856 100644 --- a/cogl/cogl/cogl-pipeline-private.h +++ b/cogl/cogl/cogl-pipeline-private.h @@ -37,7 +37,6 @@ #include "cogl-node-private.h" #include "cogl-pipeline-layer-private.h" #include "cogl-pipeline.h" -#include "cogl-matrix.h" #include "cogl-object-private.h" #include "cogl-profile.h" #include "cogl-list.h" diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c index d9f6d495e..a9cd5ca21 100644 --- a/cogl/cogl/cogl.c +++ b/cogl/cogl/cogl.c @@ -41,7 +41,6 @@ #include "cogl-context-private.h" #include "cogl-pipeline-private.h" #include "cogl-framebuffer-private.h" -#include "cogl-matrix-private.h" #include "cogl-journal-private.h" #include "cogl-bitmap-private.h" #include "cogl-texture-private.h" diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h index 142293dac..4a63a368f 100644 --- a/cogl/cogl/cogl.h +++ b/cogl/cogl/cogl.h @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/cogl/cogl/deprecated/cogl-material-compat.c b/cogl/cogl/deprecated/cogl-material-compat.c index e3a3c60cc..ac7923325 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.c +++ b/cogl/cogl/deprecated/cogl-material-compat.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/cogl/cogl/deprecated/cogl-material-compat.h b/cogl/cogl/deprecated/cogl-material-compat.h index 0648b5f66..04842f546 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.h +++ b/cogl/cogl/deprecated/cogl-material-compat.h @@ -36,7 +36,6 @@ #define __COGL_MATERIAL_H__ #include -#include #include #include #include diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index 360675d4c..a7346d81c 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -79,7 +79,6 @@ cogl_headers = [ 'cogl-context.h', 'cogl-frame-info.h', 'cogl-framebuffer.h', - 'cogl-matrix.h', 'cogl-object.h', 'cogl-offscreen.h', 'cogl-onscreen.h', @@ -258,8 +257,6 @@ cogl_sources = [ 'cogl-attribute.c', 'cogl-primitive-private.h', 'cogl-primitive.c', - 'cogl-matrix.c', - 'cogl-matrix-private.h', 'cogl-matrix-stack.c', 'cogl-matrix-stack-private.h', 'cogl-depth-state.c', -- cgit v1.2.1