mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
tests: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
parent
090973e538
commit
77352c2d3a
@ -33,14 +33,13 @@ actor_pivot (void)
|
|||||||
clutter_actor_set_rotation_angle (actor_implicit, CLUTTER_Z_AXIS, angle);
|
clutter_actor_set_rotation_angle (actor_implicit, CLUTTER_Z_AXIS, angle);
|
||||||
|
|
||||||
/* Explicit transformation */
|
/* Explicit transformation */
|
||||||
cogl_matrix_init_identity (&transform);
|
graphene_matrix_init_rotate (&transform, angle, graphene_vec3_z_axis ());
|
||||||
cogl_matrix_rotate (&transform, angle, 0, 0, 1.0);
|
|
||||||
clutter_actor_set_transform (actor_explicit, &transform);
|
clutter_actor_set_transform (actor_explicit, &transform);
|
||||||
|
|
||||||
clutter_actor_get_transform (actor_implicit, &result_implicit);
|
clutter_actor_get_transform (actor_implicit, &result_implicit);
|
||||||
clutter_actor_get_transform (actor_explicit, &result_explicit);
|
clutter_actor_get_transform (actor_explicit, &result_explicit);
|
||||||
|
|
||||||
g_assert (cogl_matrix_equal (&result_implicit, &result_explicit));
|
g_assert (graphene_matrix_equal (&result_implicit, &result_explicit));
|
||||||
|
|
||||||
clutter_actor_destroy (actor_implicit);
|
clutter_actor_destroy (actor_implicit);
|
||||||
clutter_actor_destroy (actor_explicit);
|
clutter_actor_destroy (actor_explicit);
|
||||||
|
@ -45,14 +45,14 @@ frame_cb (ClutterTimeline *timeline,
|
|||||||
{
|
{
|
||||||
TestMultiLayerMaterialState *state = data;
|
TestMultiLayerMaterialState *state = data;
|
||||||
|
|
||||||
cogl_matrix_multiply (&state->tex_matrix0,
|
graphene_matrix_multiply (&state->rot_matrix0,
|
||||||
&state->tex_matrix0,
|
&state->tex_matrix0,
|
||||||
&state->rot_matrix0);
|
&state->tex_matrix0);
|
||||||
cogl_material_set_layer_matrix (state->material0, 2, &state->tex_matrix0);
|
cogl_material_set_layer_matrix (state->material0, 2, &state->tex_matrix0);
|
||||||
|
|
||||||
cogl_matrix_multiply (&state->tex_matrix1,
|
graphene_matrix_multiply (&state->rot_matrix1,
|
||||||
&state->tex_matrix1,
|
&state->tex_matrix1,
|
||||||
&state->rot_matrix1);
|
&state->tex_matrix1);
|
||||||
cogl_material_set_layer_matrix (state->material1, 2, &state->tex_matrix1);
|
cogl_material_set_layer_matrix (state->material1, 2, &state->tex_matrix1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,18 +196,22 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
|
|
||||||
state->tex_coords = tex_coords;
|
state->tex_coords = tex_coords;
|
||||||
|
|
||||||
cogl_matrix_init_identity (&state->tex_matrix0);
|
graphene_matrix_init_identity (&state->tex_matrix0);
|
||||||
cogl_matrix_init_identity (&state->tex_matrix1);
|
graphene_matrix_init_identity (&state->tex_matrix1);
|
||||||
cogl_matrix_init_identity (&state->rot_matrix0);
|
graphene_matrix_init_identity (&state->rot_matrix0);
|
||||||
cogl_matrix_init_identity (&state->rot_matrix1);
|
graphene_matrix_init_identity (&state->rot_matrix1);
|
||||||
|
|
||||||
cogl_matrix_translate (&state->rot_matrix0, 0.5, 0.5, 0);
|
graohene_matrix_translate (&state->rot_matrix0,
|
||||||
cogl_matrix_rotate (&state->rot_matrix0, 10.0, 0, 0, 1.0);
|
&GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0));
|
||||||
cogl_matrix_translate (&state->rot_matrix0, -0.5, -0.5, 0);
|
graohene_matrix_rotate (&state->rot_matrix0, 10.0, graphene_vec3_z_axis ());
|
||||||
|
graphene_matrix_translate (&state->rot_matrix0,
|
||||||
|
&GRAPHENE_POINT3D_INIT (0.5, 0.5, 0));
|
||||||
|
|
||||||
cogl_matrix_translate (&state->rot_matrix1, 0.5, 0.5, 0);
|
graphene_matrix_translate (&state->rot_matrix1,
|
||||||
cogl_matrix_rotate (&state->rot_matrix1, -10.0, 0, 0, 1.0);
|
&GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0));
|
||||||
cogl_matrix_translate (&state->rot_matrix1, -0.5, -0.5, 0);
|
graohene_matrix_rotate (&state->rot_matrix1, -10.0, graphene_vec3_z_axis ());
|
||||||
|
graphene_matrix_translate (&state->rot_matrix1,
|
||||||
|
&GRAPHENE_POINT3D_INIT (0.5, 0.5, 0));
|
||||||
|
|
||||||
clutter_actor_set_translation (data->parent_container, -86.f, -125.f, 0.f);
|
clutter_actor_set_translation (data->parent_container, -86.f, -125.f, 0.f);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER(stage),
|
clutter_container_add_actor (CLUTTER_CONTAINER(stage),
|
||||||
|
@ -232,12 +232,15 @@ setup_viewport (CoglFramebuffer *framebuffer,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cogl_framebuffer_get_projection_matrix (framebuffer, &projection_matrix);
|
cogl_framebuffer_get_projection_matrix (framebuffer, &projection_matrix);
|
||||||
z_camera = 0.5 * cogl_matrix_get_value (&projection_matrix, 0, 0);
|
z_camera = 0.5 * graphene_matrix_get_value (&projection_matrix, 0, 0);
|
||||||
|
|
||||||
cogl_matrix_init_identity (&mv_matrix);
|
graphene_matrix_init_translate (&mv_matrix,
|
||||||
cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera);
|
&GRAPHENE_POINT3D_INIT (0.0f,
|
||||||
cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
|
-1.0 * height,
|
||||||
cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f);
|
0.0f));
|
||||||
|
graphene_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
|
||||||
|
graphene_matrix_translate (&mv_matrix,
|
||||||
|
&GRAPHENE_POINT3D_INIT (-0.5f, -0.5f, -z_camera));
|
||||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &mv_matrix);
|
cogl_framebuffer_set_modelview_matrix (framebuffer, &mv_matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ paint_cb (ClutterActor *stage,
|
|||||||
|
|
||||||
cogl_framebuffer_get_projection_matrix (framebuffer, &old_matrix);
|
cogl_framebuffer_get_projection_matrix (framebuffer, &old_matrix);
|
||||||
/* Use an orthogonal projection from -1 -> 1 in both axes */
|
/* Use an orthogonal projection from -1 -> 1 in both axes */
|
||||||
cogl_matrix_init_identity (&new_matrix);
|
graphene_matrix_init_identity (&new_matrix);
|
||||||
cogl_framebuffer_set_projection_matrix (framebuffer, &new_matrix);
|
cogl_framebuffer_set_projection_matrix (framebuffer, &new_matrix);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (framebuffer);
|
cogl_framebuffer_push_matrix (framebuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user