[mutter/gbsneto/graphene2: 32/45] cogl/matrix: Apply perspective with Graphene
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene2: 32/45] cogl/matrix: Apply perspective with Graphene
- Date: Sat, 7 Sep 2019 11:19:55 +0000 (UTC)
commit d0590de9e8a39b6bdab3fab59bc62ffa8b167cf4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Feb 27 19:03:59 2019 -0300
cogl/matrix: Apply perspective with Graphene
cogl/cogl/cogl-matrix.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 7f0d3176c..97034ee7a 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -421,15 +421,16 @@ cogl_matrix_perspective (CoglMatrix *matrix,
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);
+ graphene_matrix_t perspective, m;
+
+ graphene_matrix_init_perspective (&perspective, fov_y, aspect, z_near, z_far);
+
+ cogl_matrix_to_graphene_matrix (matrix, &m);
+ graphene_matrix_transpose (&m, &m);
+
+ graphene_matrix_multiply (&m, &perspective, &m);
+ graphene_matrix_to_cogl_matrix (&m, matrix);
+
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]