mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
clutter_actor_project_point/vertices
This commit is contained in:
parent
c2236bb72a
commit
70a3c9fbe6
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
||||
2007-06-12 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-fixed.h:
|
||||
Added shorthand CFX_QMUL macro.
|
||||
|
||||
* clutter/clutter-private.h:
|
||||
* clutter/clutter-actor.h:
|
||||
* clutter/clutter-actor.c:
|
||||
Replaced ClutterVertices with ClutterVertex;
|
||||
|
||||
(clutter_actor_get_transformed_vertices):
|
||||
(clutter_actor_get_transformed_point):
|
||||
Replaced with clutter_actor_projected_vertices and
|
||||
clutter_actor_projected_point.
|
||||
|
||||
(_clutter_actor_apply_modelview_transform):
|
||||
(_clutter_actor_apply_modelview_transform_recursive):
|
||||
Private functions to push actor modelview transforms on OpenGL
|
||||
stack.
|
||||
|
||||
* clutter/cogl/cogl.h:
|
||||
* clutter/cogl/gl/cogl.c:
|
||||
* clutter/cogl/gles/cogl.c:
|
||||
(cogl_get_viewport):
|
||||
(cogl_get_modelview_matrix):
|
||||
(cogl_get_projection_matrix):
|
||||
Functions to access OpenGL transforms.
|
||||
|
||||
2007-06-12 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter/clutter-alpha.c:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -77,7 +77,7 @@ typedef struct _ClutterActorClass ClutterActorClass;
|
||||
typedef struct _ClutterActorBox ClutterActorBox;
|
||||
typedef struct _ClutterActorPrivate ClutterActorPrivate;
|
||||
typedef struct _ClutterGeometry ClutterGeometry;
|
||||
typedef struct _ClutterVertices ClutterVertices;
|
||||
typedef struct _ClutterVertex ClutterVertex;
|
||||
|
||||
typedef void (*ClutterCallback) (ClutterActor *actor, gpointer data);
|
||||
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
|
||||
@ -108,35 +108,11 @@ struct _ClutterActorBox { ClutterUnit x1, y1, x2, y2; };
|
||||
|
||||
GType clutter_actor_box_get_type (void) G_GNUC_CONST;
|
||||
|
||||
struct _ClutterVertices
|
||||
struct _ClutterVertex
|
||||
{
|
||||
struct
|
||||
{
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
}topleft;
|
||||
|
||||
struct
|
||||
{
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
}topright;
|
||||
|
||||
struct
|
||||
{
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
}bottomleft;
|
||||
|
||||
struct
|
||||
{
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
}bottomright;
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
};
|
||||
|
||||
GType clutter_vertices_get_type (void) G_GNUC_CONST;
|
||||
@ -306,15 +282,13 @@ void clutter_actor_move_by (ClutterActor *sel
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
void clutter_actor_get_transformed_vertices (ClutterActor *self,
|
||||
ClutterVertices * verts);
|
||||
void clutter_actor_project_vertices (ClutterActor *self,
|
||||
ClutterVertex verts[4]);
|
||||
|
||||
void clutter_actor_get_transformed_point (ClutterActor *actor,
|
||||
gint x,
|
||||
gint y,
|
||||
ClutterUnit *x_return,
|
||||
ClutterUnit *y_return,
|
||||
ClutterUnit *z_return);
|
||||
void clutter_actor_project_point (ClutterActor *actor,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y,
|
||||
ClutterUnit *z);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -143,6 +143,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */
|
||||
#define CFX_INT CLUTTER_FIXED_INT
|
||||
#define CFX_MUL CLUTTER_FIXED_MUL
|
||||
#define CFX_DIV CLUTTER_FIXED_DIV
|
||||
#define CFX_QMUL(x,y) clutter_qmulx (x,y)
|
||||
|
||||
/* Fixed point math routines */
|
||||
extern inline
|
||||
|
@ -123,6 +123,10 @@ void _clutter_feature_init (void);
|
||||
/* Does this need to be private ? */
|
||||
void clutter_do_event (ClutterEvent *event);
|
||||
|
||||
void _clutter_actor_apply_modelview_transform (ClutterActor * self);
|
||||
|
||||
void _clutter_actor_apply_modelview_transform_recursive (ClutterActor * self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _HAVE_CLUTTER_PRIVATE_H */
|
||||
|
@ -189,6 +189,15 @@ cogl_alpha_func (COGLenum func,
|
||||
ClutterFeatureFlags
|
||||
cogl_get_features ();
|
||||
|
||||
void
|
||||
cogl_get_modelview_matrix (ClutterFixed m[16]);
|
||||
|
||||
void
|
||||
cogl_get_projection_matrix (ClutterFixed m[16]);
|
||||
|
||||
void
|
||||
cogl_get_viewport (ClutterFixed v[4]);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_H__ */
|
||||
|
@ -506,7 +506,7 @@ cogl_perspective (ClutterAngle fovy,
|
||||
M(2,2) = CLUTTER_FIXED_TO_FLOAT (c);
|
||||
M(2,3) = CLUTTER_FIXED_TO_FLOAT (d);
|
||||
M(3,2) = -1.0F;
|
||||
|
||||
|
||||
GE( glMultMatrixf (m) );
|
||||
#undef M
|
||||
}
|
||||
@ -533,7 +533,6 @@ cogl_setup_viewport (guint width,
|
||||
|
||||
/* camera distance from screen, 0.5 * tan (FOV) */
|
||||
#define DEFAULT_Z_CAMERA 0.866025404f
|
||||
|
||||
z_camera = CLUTTER_FIXED_TO_FLOAT (clutter_tani (fovy) >> 1);
|
||||
|
||||
GE( glTranslatef (-0.5f, -0.5f, -z_camera) );
|
||||
@ -585,3 +584,74 @@ cogl_get_features ()
|
||||
return flags;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_modelview_matrix (ClutterFixed m[16])
|
||||
{
|
||||
GLdouble md[16];
|
||||
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, &md[0]);
|
||||
|
||||
#define M(m,row,col) m[col*4+row]
|
||||
M(m,0,0) = CLUTTER_FLOAT_TO_FIXED (M(md,0,0));
|
||||
M(m,0,1) = CLUTTER_FLOAT_TO_FIXED (M(md,0,1));
|
||||
M(m,0,2) = CLUTTER_FLOAT_TO_FIXED (M(md,0,2));
|
||||
M(m,0,3) = CLUTTER_FLOAT_TO_FIXED (M(md,0,3));
|
||||
|
||||
M(m,1,0) = CLUTTER_FLOAT_TO_FIXED (M(md,1,0));
|
||||
M(m,1,1) = CLUTTER_FLOAT_TO_FIXED (M(md,1,1));
|
||||
M(m,1,2) = CLUTTER_FLOAT_TO_FIXED (M(md,1,2));
|
||||
M(m,1,3) = CLUTTER_FLOAT_TO_FIXED (M(md,1,3));
|
||||
|
||||
M(m,2,0) = CLUTTER_FLOAT_TO_FIXED (M(md,2,0));
|
||||
M(m,2,1) = CLUTTER_FLOAT_TO_FIXED (M(md,2,1));
|
||||
M(m,2,2) = CLUTTER_FLOAT_TO_FIXED (M(md,2,2));
|
||||
M(m,2,3) = CLUTTER_FLOAT_TO_FIXED (M(md,2,3));
|
||||
|
||||
M(m,3,0) = CLUTTER_FLOAT_TO_FIXED (M(md,3,0));
|
||||
M(m,3,1) = CLUTTER_FLOAT_TO_FIXED (M(md,3,1));
|
||||
M(m,3,2) = CLUTTER_FLOAT_TO_FIXED (M(md,3,2));
|
||||
M(m,3,3) = CLUTTER_FLOAT_TO_FIXED (M(md,3,3));
|
||||
#undef M
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_projection_matrix (ClutterFixed m[16])
|
||||
{
|
||||
GLdouble md[16];
|
||||
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, &md[0]);
|
||||
|
||||
#define M(m,row,col) m[col*4+row]
|
||||
M(m,0,0) = CLUTTER_FLOAT_TO_FIXED (M(md,0,0));
|
||||
M(m,0,1) = CLUTTER_FLOAT_TO_FIXED (M(md,0,1));
|
||||
M(m,0,2) = CLUTTER_FLOAT_TO_FIXED (M(md,0,2));
|
||||
M(m,0,3) = CLUTTER_FLOAT_TO_FIXED (M(md,0,3));
|
||||
|
||||
M(m,1,0) = CLUTTER_FLOAT_TO_FIXED (M(md,1,0));
|
||||
M(m,1,1) = CLUTTER_FLOAT_TO_FIXED (M(md,1,1));
|
||||
M(m,1,2) = CLUTTER_FLOAT_TO_FIXED (M(md,1,2));
|
||||
M(m,1,3) = CLUTTER_FLOAT_TO_FIXED (M(md,1,3));
|
||||
|
||||
M(m,2,0) = CLUTTER_FLOAT_TO_FIXED (M(md,2,0));
|
||||
M(m,2,1) = CLUTTER_FLOAT_TO_FIXED (M(md,2,1));
|
||||
M(m,2,2) = CLUTTER_FLOAT_TO_FIXED (M(md,2,2));
|
||||
M(m,2,3) = CLUTTER_FLOAT_TO_FIXED (M(md,2,3));
|
||||
|
||||
M(m,3,0) = CLUTTER_FLOAT_TO_FIXED (M(md,3,0));
|
||||
M(m,3,1) = CLUTTER_FLOAT_TO_FIXED (M(md,3,1));
|
||||
M(m,3,2) = CLUTTER_FLOAT_TO_FIXED (M(md,3,2));
|
||||
M(m,3,3) = CLUTTER_FLOAT_TO_FIXED (M(md,3,3));
|
||||
#undef M
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_viewport (ClutterFixed v[4])
|
||||
{
|
||||
GLdouble vd[4];
|
||||
glGetDoublev(GL_VIEWPORT, &vd[0]);
|
||||
|
||||
v[0] = CLUTTER_FLOAT_TO_FIXED (vd[0]);
|
||||
v[1] = CLUTTER_FLOAT_TO_FIXED (vd[1]);
|
||||
v[2] = CLUTTER_FLOAT_TO_FIXED (vd[2]);
|
||||
v[3] = CLUTTER_FLOAT_TO_FIXED (vd[3]);
|
||||
}
|
||||
|
@ -533,3 +533,21 @@ cogl_get_features ()
|
||||
/* Suck */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_modelview_matrix (ClutterFixed m[16])
|
||||
{
|
||||
glGetFixedv(GL_MODELVIEW_MATRIX, &m[0]);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_projection_matrix (ClutterFixed m[16])
|
||||
{
|
||||
glGetFixedv(GL_PROJECTION_MATRIX, &m[0]);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_viewport (ClutterFixed v[4])
|
||||
{
|
||||
glGetFixedv(GL_VIEWPORT, &v[0]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user