mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
clutter_actor_project_point(): separated input from output parameters
This commit is contained in:
parent
ea14a6b62d
commit
e10a0ad025
@ -1,3 +1,11 @@
|
|||||||
|
2007-06-27 Tomas Frydrych <tf@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-actor.h:
|
||||||
|
* clutter/clutter-actor.c:
|
||||||
|
* tests/test-project.c:
|
||||||
|
(clutter_actor_project_point):
|
||||||
|
Separated input from output parameters.
|
||||||
|
|
||||||
2007-06-27 Matthew Allum <mallum@openedhand.com>
|
2007-06-27 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
* Makefile.am:
|
* Makefile.am:
|
||||||
|
@ -383,20 +383,26 @@ clutter_actor_transform_point (ClutterActor *actor,
|
|||||||
/**
|
/**
|
||||||
* clutter_actor_project_point:
|
* clutter_actor_project_point:
|
||||||
* @self: A #ClutterActor
|
* @self: A #ClutterActor
|
||||||
* @x: in/out X
|
* @x: x coordinance of the point to project
|
||||||
* @y: in/out Y
|
* @y: y coordinance of the point to project
|
||||||
* @z: in
|
* @z: z coordinance of the point to project
|
||||||
|
* @x2: projected x coordinance
|
||||||
|
* @y2: projected y coordinance
|
||||||
|
* @z2: projected z coordinance
|
||||||
*
|
*
|
||||||
* Transforms point [x,y,z] in coordinance relative to the actor
|
* Transforms point [x,y,z] in coordinance relative to the actor
|
||||||
* into screen coordiances [x,y]
|
* into screen coordiances [x2,y2,z2]
|
||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
clutter_actor_project_point (ClutterActor *self,
|
clutter_actor_project_point (ClutterActor *self,
|
||||||
ClutterUnit *x,
|
ClutterUnit x,
|
||||||
ClutterUnit *y,
|
ClutterUnit y,
|
||||||
ClutterUnit *z)
|
ClutterUnit z,
|
||||||
|
ClutterUnit *x2,
|
||||||
|
ClutterUnit *y2,
|
||||||
|
ClutterUnit *z2)
|
||||||
{
|
{
|
||||||
ClutterFixed mtx_p[16];
|
ClutterFixed mtx_p[16];
|
||||||
ClutterFixed v[4];
|
ClutterFixed v[4];
|
||||||
@ -405,18 +411,18 @@ clutter_actor_project_point (ClutterActor *self,
|
|||||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||||
|
|
||||||
/* First we tranform the point using the OpenGL modelview matrix */
|
/* First we tranform the point using the OpenGL modelview matrix */
|
||||||
clutter_actor_transform_point (self, x, y, z, &w);
|
clutter_actor_transform_point (self, &x, &y, &z, &w);
|
||||||
|
|
||||||
cogl_get_projection_matrix (mtx_p);
|
cogl_get_projection_matrix (mtx_p);
|
||||||
cogl_get_viewport (v);
|
cogl_get_viewport (v);
|
||||||
|
|
||||||
/* Now, transform it again with the projection matrix */
|
/* Now, transform it again with the projection matrix */
|
||||||
mtx_transform (mtx_p, x, y, z, &w);
|
mtx_transform (mtx_p, &x, &y, &z, &w);
|
||||||
|
|
||||||
/* Finaly translate from OpenGL coords to window coords */
|
/* Finaly translate from OpenGL coords to window coords */
|
||||||
*x = MTX_GL_SCALE_X(*x,w,v[2],v[0]);
|
*x2 = MTX_GL_SCALE_X(x,w,v[2],v[0]);
|
||||||
*y = MTX_GL_SCALE_Y(*y,w,v[3],v[1]);
|
*y2 = MTX_GL_SCALE_Y(y,w,v[3],v[1]);
|
||||||
*z = MTX_GL_SCALE_Z(*z,w,v[2],v[0]);
|
*z2 = MTX_GL_SCALE_Z(z,w,v[2],v[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recursively tranform supplied vertices with the tranform for the current
|
/* Recursively tranform supplied vertices with the tranform for the current
|
||||||
@ -499,8 +505,13 @@ clutter_actor_transform_vertices (ClutterActor * self,
|
|||||||
* store the result.
|
* store the result.
|
||||||
*
|
*
|
||||||
* Calculates the tranformed screen coordinaces of the four corners of
|
* Calculates the tranformed screen coordinaces of the four corners of
|
||||||
* the actor; the returned corners are in the following order:
|
* the actor; the returned vertices relate to the ClutterActoBox
|
||||||
* bottomleft, bottomright, topright, topleft.
|
* coordinances as follows:
|
||||||
|
*
|
||||||
|
* v[0] ~ <x1,y1>
|
||||||
|
* v[1] ~ <x2,y1>
|
||||||
|
* v[2] ~ <x1,y2>
|
||||||
|
* v[3] ~ <x2,y2>.
|
||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
**/
|
**/
|
||||||
@ -1423,10 +1434,10 @@ clutter_actor_get_abs_position_units (ClutterActor *self,
|
|||||||
gint32 *x,
|
gint32 *x,
|
||||||
gint32 *y)
|
gint32 *y)
|
||||||
{
|
{
|
||||||
ClutterUnit zu = 0;
|
ClutterUnit zu;
|
||||||
|
|
||||||
*x = *y = 0;
|
*x = *y = 0;
|
||||||
clutter_actor_project_point (self, x, y, &zu);
|
clutter_actor_project_point (self, 0, 0, 0, x, y, &zu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,9 +298,12 @@ void clutter_actor_project_vertices (ClutterActor *sel
|
|||||||
ClutterVertex verts[4]);
|
ClutterVertex verts[4]);
|
||||||
|
|
||||||
void clutter_actor_project_point (ClutterActor *actor,
|
void clutter_actor_project_point (ClutterActor *actor,
|
||||||
ClutterUnit *x,
|
ClutterUnit x,
|
||||||
ClutterUnit *y,
|
ClutterUnit y,
|
||||||
ClutterUnit *z);
|
ClutterUnit z,
|
||||||
|
ClutterUnit *x2,
|
||||||
|
ClutterUnit *y2,
|
||||||
|
ClutterUnit *z2);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ init_handles ()
|
|||||||
yp = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
|
yp = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
|
||||||
zp = 0;
|
zp = 0;
|
||||||
|
|
||||||
clutter_actor_project_point (rect, &xp, &yp, &zp);
|
clutter_actor_project_point (rect, xp, yp, zp, &xp, &yp, &zp);
|
||||||
p[4] = clutter_rectangle_new_with_color (&blue);
|
p[4] = clutter_rectangle_new_with_color (&blue);
|
||||||
clutter_actor_set_size (p[4], 5, 5);
|
clutter_actor_set_size (p[4], 5, 5);
|
||||||
clutter_actor_set_position (p[4], 0, 0);
|
clutter_actor_set_position (p[4], 0, 0);
|
||||||
@ -74,7 +74,7 @@ place_handles ()
|
|||||||
yp = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
|
yp = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
|
||||||
zp = 0;
|
zp = 0;
|
||||||
|
|
||||||
clutter_actor_project_point (rect, &xp, &yp, &zp);
|
clutter_actor_project_point (rect, xp, yp, zp, &xp, &yp, &zp);
|
||||||
clutter_actor_set_position (p[4],
|
clutter_actor_set_position (p[4],
|
||||||
CLUTTER_FIXED_INT (xp) -
|
CLUTTER_FIXED_INT (xp) -
|
||||||
clutter_actor_get_width (p[4])/2,
|
clutter_actor_get_width (p[4])/2,
|
||||||
|
Loading…
Reference in New Issue
Block a user