mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl/matrix-stack: Use graphene types on entries
This will help moving to graphene_matrix_t, since the convertions between nodes and graphene types won't be necessary anymore. https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
parent
5790c23112
commit
97206476ac
@ -69,9 +69,7 @@ typedef struct _CoglMatrixEntryTranslate
|
|||||||
{
|
{
|
||||||
CoglMatrixEntry _parent_data;
|
CoglMatrixEntry _parent_data;
|
||||||
|
|
||||||
float x;
|
graphene_point3d_t t;
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
|
|
||||||
} CoglMatrixEntryTranslate;
|
} CoglMatrixEntryTranslate;
|
||||||
|
|
||||||
@ -80,9 +78,7 @@ typedef struct _CoglMatrixEntryRotate
|
|||||||
CoglMatrixEntry _parent_data;
|
CoglMatrixEntry _parent_data;
|
||||||
|
|
||||||
float angle;
|
float angle;
|
||||||
float x;
|
graphene_vec3_t axis;
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
|
|
||||||
} CoglMatrixEntryRotate;
|
} CoglMatrixEntryRotate;
|
||||||
|
|
||||||
|
@ -158,9 +158,7 @@ cogl_matrix_stack_translate (CoglMatrixStack *stack,
|
|||||||
|
|
||||||
entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_TRANSLATE);
|
entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_TRANSLATE);
|
||||||
|
|
||||||
entry->x = x;
|
graphene_point3d_init (&entry->t, x, y, z);
|
||||||
entry->y = y;
|
|
||||||
entry->z = z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -175,9 +173,7 @@ cogl_matrix_stack_rotate (CoglMatrixStack *stack,
|
|||||||
entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_ROTATE);
|
entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_ROTATE);
|
||||||
|
|
||||||
entry->angle = angle;
|
entry->angle = angle;
|
||||||
entry->x = x;
|
graphene_vec3_init (&entry->axis, x, y, z);
|
||||||
entry->y = y;
|
|
||||||
entry->z = z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -553,9 +549,9 @@ initialized:
|
|||||||
CoglMatrixEntryTranslate *translate =
|
CoglMatrixEntryTranslate *translate =
|
||||||
(CoglMatrixEntryTranslate *)children[i];
|
(CoglMatrixEntryTranslate *)children[i];
|
||||||
cogl_matrix_translate (matrix,
|
cogl_matrix_translate (matrix,
|
||||||
translate->x,
|
translate->t.x,
|
||||||
translate->y,
|
translate->t.y,
|
||||||
translate->z);
|
translate->t.z);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case COGL_MATRIX_OP_ROTATE:
|
case COGL_MATRIX_OP_ROTATE:
|
||||||
@ -564,9 +560,9 @@ initialized:
|
|||||||
(CoglMatrixEntryRotate *)children[i];
|
(CoglMatrixEntryRotate *)children[i];
|
||||||
cogl_matrix_rotate (matrix,
|
cogl_matrix_rotate (matrix,
|
||||||
rotate->angle,
|
rotate->angle,
|
||||||
rotate->x,
|
graphene_vec3_get_x (&rotate->axis),
|
||||||
rotate->y,
|
graphene_vec3_get_y (&rotate->axis),
|
||||||
rotate->z);
|
graphene_vec3_get_z (&rotate->axis));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case COGL_MATRIX_OP_ROTATE_EULER:
|
case COGL_MATRIX_OP_ROTATE_EULER:
|
||||||
@ -776,9 +772,9 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
|
|||||||
|
|
||||||
translate = (CoglMatrixEntryTranslate *)node0;
|
translate = (CoglMatrixEntryTranslate *)node0;
|
||||||
|
|
||||||
*x = *x - translate->x;
|
*x = *x - translate->t.x;
|
||||||
*y = *y - translate->y;
|
*y = *y - translate->t.y;
|
||||||
*z = *z - translate->z;
|
*z = *z - translate->t.z;
|
||||||
}
|
}
|
||||||
for (head1 = common_ancestor1->next; head1; head1 = head1->next)
|
for (head1 = common_ancestor1->next; head1; head1 = head1->next)
|
||||||
{
|
{
|
||||||
@ -791,9 +787,9 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
|
|||||||
|
|
||||||
translate = (CoglMatrixEntryTranslate *)node1;
|
translate = (CoglMatrixEntryTranslate *)node1;
|
||||||
|
|
||||||
*x = *x + translate->x;
|
*x = *x + translate->t.x;
|
||||||
*y = *y + translate->y;
|
*y = *y + translate->t.y;
|
||||||
*z = *z + translate->z;
|
*z = *z + translate->t.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -956,9 +952,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
|
|||||||
/* We could perhaps use an epsilon to compare here?
|
/* We could perhaps use an epsilon to compare here?
|
||||||
* I expect the false negatives are probaly never going to
|
* I expect the false negatives are probaly never going to
|
||||||
* be a problem and this is a bit cheaper. */
|
* be a problem and this is a bit cheaper. */
|
||||||
if (translate0->x != translate1->x ||
|
if (!graphene_point3d_equal (&translate0->t, &translate1->t))
|
||||||
translate0->y != translate1->y ||
|
|
||||||
translate0->z != translate1->z)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -969,9 +963,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
|
|||||||
CoglMatrixEntryRotate *rotate1 =
|
CoglMatrixEntryRotate *rotate1 =
|
||||||
(CoglMatrixEntryRotate *)entry1;
|
(CoglMatrixEntryRotate *)entry1;
|
||||||
if (rotate0->angle != rotate1->angle ||
|
if (rotate0->angle != rotate1->angle ||
|
||||||
rotate0->x != rotate1->x ||
|
!graphene_vec3_equal (&rotate0->axis, &rotate1->axis))
|
||||||
rotate0->y != rotate1->y ||
|
|
||||||
rotate0->z != rotate1->z)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1069,9 +1061,9 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
|
|||||||
CoglMatrixEntryTranslate *translate =
|
CoglMatrixEntryTranslate *translate =
|
||||||
(CoglMatrixEntryTranslate *)entry;
|
(CoglMatrixEntryTranslate *)entry;
|
||||||
g_print (" TRANSLATE X=%f Y=%f Z=%f\n",
|
g_print (" TRANSLATE X=%f Y=%f Z=%f\n",
|
||||||
translate->x,
|
translate->t.x,
|
||||||
translate->y,
|
translate->t.y,
|
||||||
translate->z);
|
translate->t.z);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case COGL_MATRIX_OP_ROTATE:
|
case COGL_MATRIX_OP_ROTATE:
|
||||||
@ -1080,9 +1072,9 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
|
|||||||
(CoglMatrixEntryRotate *)entry;
|
(CoglMatrixEntryRotate *)entry;
|
||||||
g_print (" ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
|
g_print (" ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
|
||||||
rotate->angle,
|
rotate->angle,
|
||||||
rotate->x,
|
graphene_vec3_get_x (&rotate->axis),
|
||||||
rotate->y,
|
graphene_vec3_get_y (&rotate->axis),
|
||||||
rotate->z);
|
graphene_vec3_get_z (&rotate->axis));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case COGL_MATRIX_OP_ROTATE_QUATERNION:
|
case COGL_MATRIX_OP_ROTATE_QUATERNION:
|
||||||
|
Loading…
Reference in New Issue
Block a user