Commit d80c0a9f authored by Lubosz Sarnecki's avatar Lubosz Sarnecki

graphene-ext: Prefix functions with ext.

parent ca93e8d6
......@@ -12,8 +12,8 @@
// TODO: Move to upstream
void
graphene_quaternion_to_float (const graphene_quaternion_t *q,
float *dest)
graphene_ext_quaternion_to_float (const graphene_quaternion_t *q,
float *dest)
{
graphene_vec4_t v;
graphene_quaternion_to_vec4 (q, &v);
......@@ -21,17 +21,17 @@ graphene_quaternion_to_float (const graphene_quaternion_t *q,
}
void
graphene_quaternion_print (const graphene_quaternion_t *q)
graphene_ext_quaternion_print (const graphene_quaternion_t *q)
{
float f[4];
graphene_quaternion_to_float (q, f);
graphene_ext_quaternion_to_float (q, f);
g_print ("| %f %f %f %f |\n",
(double) f[0], (double) f[1], (double) f[2], (double) f[3]);
}
void
graphene_matrix_get_translation_vec3 (const graphene_matrix_t *m,
graphene_vec3_t *res)
graphene_ext_matrix_get_translation_vec3 (const graphene_matrix_t *m,
graphene_vec3_t *res)
{
float f[16];
graphene_matrix_to_float (m, f);
......@@ -39,8 +39,8 @@ graphene_matrix_get_translation_vec3 (const graphene_matrix_t *m,
}
void
graphene_matrix_get_translation_point3d (const graphene_matrix_t *m,
graphene_point3d_t *res)
graphene_ext_matrix_get_translation_point3d (const graphene_matrix_t *m,
graphene_point3d_t *res)
{
float f[16];
graphene_matrix_to_float (m, f);
......@@ -48,8 +48,8 @@ graphene_matrix_get_translation_point3d (const graphene_matrix_t *m,
}
void
graphene_matrix_set_translation_vec3 (graphene_matrix_t *m,
const graphene_vec3_t *t)
graphene_ext_matrix_set_translation_vec3 (graphene_matrix_t *m,
const graphene_vec3_t *t)
{
float f[16];
graphene_matrix_to_float (m, f);
......@@ -60,8 +60,8 @@ graphene_matrix_set_translation_vec3 (graphene_matrix_t *m,
}
void
graphene_matrix_set_translation_point3d (graphene_matrix_t *m,
const graphene_point3d_t *t)
graphene_ext_matrix_set_translation_point3d (graphene_matrix_t *m,
const graphene_point3d_t *t)
{
float f[16];
graphene_matrix_to_float (m, f);
......@@ -72,8 +72,8 @@ graphene_matrix_set_translation_point3d (graphene_matrix_t *m,
}
void
graphene_matrix_get_scale (const graphene_matrix_t *m,
graphene_vec3_t *res)
graphene_ext_matrix_get_scale (const graphene_matrix_t *m,
graphene_vec3_t *res)
{
float f[16];
graphene_matrix_to_float (m, f);
......@@ -90,14 +90,14 @@ graphene_matrix_get_scale (const graphene_matrix_t *m,
}
void
graphene_matrix_get_rotation_matrix (const graphene_matrix_t *m,
graphene_matrix_t *res)
graphene_ext_matrix_get_rotation_matrix (const graphene_matrix_t *m,
graphene_matrix_t *res)
{
float f[16];
graphene_matrix_to_float (m, f);
graphene_vec3_t s_vec;
graphene_matrix_get_scale (m, &s_vec);
graphene_ext_matrix_get_scale (m, &s_vec);
float s[3];
graphene_vec3_to_float (&s_vec, s);
......@@ -111,22 +111,22 @@ graphene_matrix_get_rotation_matrix (const graphene_matrix_t *m,
}
void
graphene_matrix_get_rotation_quaternion (const graphene_matrix_t *m,
graphene_quaternion_t *res)
graphene_ext_matrix_get_rotation_quaternion (const graphene_matrix_t *m,
graphene_quaternion_t *res)
{
graphene_matrix_t rot_m;
graphene_matrix_get_rotation_matrix (m, &rot_m);
graphene_ext_matrix_get_rotation_matrix (m, &rot_m);
graphene_quaternion_init_from_matrix (res, &rot_m);
}
void
graphene_matrix_get_rotation_angles (const graphene_matrix_t *m,
float *deg_x,
float *deg_y,
float *deg_z)
graphene_ext_matrix_get_rotation_angles (const graphene_matrix_t *m,
float *deg_x,
float *deg_y,
float *deg_z)
{
graphene_quaternion_t q;
graphene_matrix_get_rotation_quaternion (m, &q);
graphene_ext_matrix_get_rotation_quaternion (m, &q);
graphene_quaternion_to_angles (&q, deg_x, deg_y, deg_z);
}
......@@ -140,26 +140,26 @@ graphene_matrix_get_rotation_angles (const graphene_matrix_t *m,
* the given @factor.
*/
void
graphene_point_scale (const graphene_point_t *p,
float factor,
graphene_point_t *res)
graphene_ext_point_scale (const graphene_point_t *p,
float factor,
graphene_point_t *res)
{
graphene_point_init (res, p->x * factor, p->y * factor);
}
void
graphene_ray_get_origin_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res)
graphene_ext_ray_get_origin_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res)
{
graphene_vec3_t o;
graphene_ray_get_origin_vec3 (r, &o);
graphene_ext_ray_get_origin_vec3 (r, &o);
graphene_vec4_init_from_vec3 (res, &o, w);
}
void
graphene_ray_get_origin_vec3 (const graphene_ray_t *r,
graphene_vec3_t *res)
graphene_ext_ray_get_origin_vec3 (const graphene_ray_t *r,
graphene_vec3_t *res)
{
graphene_point3d_t o;
graphene_ray_get_origin (r, &o);
......@@ -167,9 +167,9 @@ graphene_ray_get_origin_vec3 (const graphene_ray_t *r,
}
void
graphene_ray_get_direction_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res)
graphene_ext_ray_get_direction_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res)
{
graphene_vec3_t d;
graphene_ray_get_direction (r, &d);
......@@ -177,7 +177,7 @@ graphene_ray_get_direction_vec4 (const graphene_ray_t *r,
}
void
graphene_vec4_print (const graphene_vec4_t *v)
graphene_ext_vec4_print (const graphene_vec4_t *v)
{
float f[4];
graphene_vec4_to_float (v, f);
......@@ -186,7 +186,7 @@ graphene_vec4_print (const graphene_vec4_t *v)
}
void
graphene_vec3_print (const graphene_vec3_t *v)
graphene_ext_vec3_print (const graphene_vec3_t *v)
{
float f[3];
graphene_vec3_to_float (v, f);
......@@ -194,8 +194,8 @@ graphene_vec3_print (const graphene_vec3_t *v)
}
bool
graphene_matrix_equals (graphene_matrix_t *a,
graphene_matrix_t *b)
graphene_ext_matrix_equals (graphene_matrix_t *a,
graphene_matrix_t *b)
{
float a_f[16];
float b_f[16];
......@@ -211,10 +211,10 @@ graphene_matrix_equals (graphene_matrix_t *a,
}
void
graphene_matrix_interpolate_simple (const graphene_matrix_t *from,
const graphene_matrix_t *to,
float factor,
graphene_matrix_t *result)
graphene_ext_matrix_interpolate_simple (const graphene_matrix_t *from,
const graphene_matrix_t *to,
float factor,
graphene_matrix_t *result)
{
float from_f[16];
float to_f[16];
......
......@@ -11,78 +11,78 @@
#include <graphene.h>
void
graphene_quaternion_to_float (const graphene_quaternion_t *q,
float *dest);
graphene_ext_quaternion_to_float (const graphene_quaternion_t *q,
float *dest);
void
graphene_quaternion_print (const graphene_quaternion_t *q);
graphene_ext_quaternion_print (const graphene_quaternion_t *q);
void
graphene_matrix_get_translation_vec3 (const graphene_matrix_t *m,
graphene_vec3_t *res);
graphene_ext_matrix_get_translation_vec3 (const graphene_matrix_t *m,
graphene_vec3_t *res);
void
graphene_matrix_get_translation_point3d (const graphene_matrix_t *m,
graphene_point3d_t *res);
graphene_ext_matrix_get_translation_point3d (const graphene_matrix_t *m,
graphene_point3d_t *res);
void
graphene_matrix_set_translation_vec3 (graphene_matrix_t *m,
const graphene_vec3_t *t);
graphene_ext_matrix_set_translation_vec3 (graphene_matrix_t *m,
const graphene_vec3_t *t);
void
graphene_matrix_set_translation_point3d (graphene_matrix_t *m,
const graphene_point3d_t *t);
graphene_ext_matrix_set_translation_point3d (graphene_matrix_t *m,
const graphene_point3d_t *t);
void
graphene_matrix_get_scale (const graphene_matrix_t *m,
graphene_vec3_t *res);
graphene_ext_matrix_get_scale (const graphene_matrix_t *m,
graphene_vec3_t *res);
void
graphene_matrix_get_rotation_matrix (const graphene_matrix_t *m,
graphene_matrix_t *res);
graphene_ext_matrix_get_rotation_matrix (const graphene_matrix_t *m,
graphene_matrix_t *res);
void
graphene_matrix_get_rotation_quaternion (const graphene_matrix_t *m,
graphene_quaternion_t *res);
graphene_ext_matrix_get_rotation_quaternion (const graphene_matrix_t *m,
graphene_quaternion_t *res);
void
graphene_matrix_get_rotation_angles (const graphene_matrix_t *m,
float *deg_x,
float *deg_y,
float *deg_z);
graphene_ext_matrix_get_rotation_angles (const graphene_matrix_t *m,
float *deg_x,
float *deg_y,
float *deg_z);
void
graphene_point_scale (const graphene_point_t *p,
float factor,
graphene_point_t *res);
graphene_ext_point_scale (const graphene_point_t *p,
float factor,
graphene_point_t *res);
void
graphene_ray_get_origin_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res);
graphene_ext_ray_get_origin_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res);
void
graphene_ray_get_origin_vec3 (const graphene_ray_t *r,
graphene_vec3_t *res);
graphene_ext_ray_get_origin_vec3 (const graphene_ray_t *r,
graphene_vec3_t *res);
void
graphene_ray_get_direction_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res);
graphene_ext_ray_get_direction_vec4 (const graphene_ray_t *r,
float w,
graphene_vec4_t *res);
void
graphene_vec4_print (const graphene_vec4_t *v);
graphene_ext_vec4_print (const graphene_vec4_t *v);
void
graphene_vec3_print (const graphene_vec3_t *v);
graphene_ext_vec3_print (const graphene_vec3_t *v);
bool
graphene_matrix_equals (graphene_matrix_t *a,
graphene_matrix_t *b);
graphene_ext_matrix_equals (graphene_matrix_t *a,
graphene_matrix_t *b);
void
graphene_matrix_interpolate_simple (const graphene_matrix_t *from,
const graphene_matrix_t *to,
float factor,
graphene_matrix_t *result);
graphene_ext_matrix_interpolate_simple (const graphene_matrix_t *from,
const graphene_matrix_t *to,
float factor,
graphene_matrix_t *result);
#endif /* XRD_GRAPHENE_QUATERNION_H_ */
......@@ -209,11 +209,11 @@ _get_transformation (XrdWindow *window,
graphene_matrix_init_scale (mat, height_meters, height_meters, height_meters);
graphene_quaternion_t orientation;
graphene_matrix_get_rotation_quaternion (&mat_no_scale, &orientation);
graphene_ext_matrix_get_rotation_quaternion (&mat_no_scale, &orientation);
graphene_matrix_rotate_quaternion (mat, &orientation);
graphene_point3d_t position;
graphene_matrix_get_translation_point3d (&mat_no_scale, &position);
graphene_ext_matrix_get_translation_point3d (&mat_no_scale, &position);
graphene_matrix_translate (mat, &position);
return TRUE;
......
......@@ -270,8 +270,8 @@ xrd_scene_object_set_transformation (XrdSceneObject *self,
graphene_matrix_t *mat)
{
XrdSceneObjectPrivate *priv = xrd_scene_object_get_instance_private (self);
graphene_matrix_get_rotation_quaternion (mat, &priv->orientation);
graphene_matrix_get_translation_point3d (mat, &priv->position);
graphene_ext_matrix_get_rotation_quaternion (mat, &priv->orientation);
graphene_ext_matrix_get_translation_point3d (mat, &priv->position);
// graphene_vec3_t scale;
// graphene_matrix_get_scale (mat, &scale);
......
......@@ -1644,8 +1644,8 @@ _manager_no_hover_cb (XrdWindowManager *manager,
graphene_quaternion_init_from_matrix (&controller_rotation, &event->pose);
graphene_point3d_t controller_translation_point;
graphene_matrix_get_translation_point3d (&event->pose,
&controller_translation_point);
graphene_ext_matrix_get_translation_point3d (&event->pose,
&controller_translation_point);
graphene_matrix_init_identity (&tip_pose);
graphene_matrix_translate (&tip_pose, &distance_translation_point);
......
......@@ -139,7 +139,7 @@ _hmd_facing_pose (graphene_matrix_t *hmd_pose,
graphene_matrix_t *pose_ws)
{
graphene_point3d_t hmd_location;
graphene_matrix_get_translation_point3d (hmd_pose, &hmd_location);
graphene_ext_matrix_get_translation_point3d (hmd_pose, &hmd_location);
graphene_point3d_t look_at_from_hmd = {
.x = look_at_point_ws->x - hmd_location.x,
......@@ -288,7 +288,7 @@ _step_fov (XrdContainer *self)
&wc_transform_cs);
graphene_vec3_t wc_vec_cs;
graphene_matrix_get_translation_vec3 (&wc_transform_cs, &wc_vec_cs);
graphene_ext_matrix_get_translation_vec3 (&wc_transform_cs, &wc_vec_cs);
float left, right, top, bottom;
xrd_math_get_frustum_angles (&left, &right, &top, &bottom);
......
......@@ -100,7 +100,8 @@ _update_keep_apparent_size (GSettings *settings, gchar *key, gpointer _data)
xrd_desktop_cursor_get_transformation (self, &cursor_pose);
graphene_vec3_t cursor_point_vec;
graphene_matrix_get_translation_vec3 (&cursor_pose, &cursor_point_vec);
graphene_ext_matrix_get_translation_vec3 (&cursor_pose,
&cursor_point_vec);
graphene_point3d_t cursor_point;
graphene_point3d_init_from_vec3 (&cursor_point, &cursor_point_vec);
......@@ -203,7 +204,7 @@ xrd_desktop_cursor_update_apparent_size (XrdDesktopCursor *self,
}
graphene_point3d_t hmd_point;
graphene_matrix_get_translation_point3d (&hmd_pose, &hmd_point);
graphene_ext_matrix_get_translation_point3d (&hmd_pose, &hmd_point);
float distance = graphene_point3d_distance (cursor_point, &hmd_point, NULL);
......
......@@ -255,13 +255,13 @@ xrd_math_hmd_window_distance (XrdWindow *window)
graphene_point3d_t hmd_location;
graphene_matrix_get_translation_point3d (&hmd_pose, &hmd_location);
graphene_ext_matrix_get_translation_point3d (&hmd_pose, &hmd_location);
graphene_matrix_t window_pose;
xrd_window_get_transformation (window, &window_pose);
graphene_point3d_t window_location;
graphene_matrix_get_translation_point3d (&window_pose, &window_location);
graphene_ext_matrix_get_translation_point3d (&window_pose, &window_location);
return graphene_point3d_distance (&hmd_location, &window_location, NULL);
}
......@@ -447,7 +447,7 @@ xrd_pointer_tip_update_apparent_size (XrdPointerTip *self)
xrd_pointer_tip_get_transformation (self, &tip_pose);
graphene_point3d_t tip_point;
graphene_matrix_get_translation_point3d (&tip_pose, &tip_point);
graphene_ext_matrix_get_translation_point3d (&tip_pose, &tip_point);
graphene_matrix_t hmd_pose;
gboolean has_pose = openvr_system_get_hmd_pose (&hmd_pose);
......@@ -458,7 +458,7 @@ xrd_pointer_tip_update_apparent_size (XrdPointerTip *self)
}
graphene_point3d_t hmd_point;
graphene_matrix_get_translation_point3d (&hmd_pose, &hmd_point);
graphene_ext_matrix_get_translation_point3d (&hmd_pose, &hmd_point);
float distance = graphene_point3d_distance (&tip_point, &hmd_point, NULL);
......
......@@ -139,7 +139,7 @@ xrd_pointer_get_intersection (XrdPointer *self,
graphene_vec3_scale (res, *distance, res);
graphene_vec3_t origin;
graphene_ray_get_origin_vec3 (&ray, &origin);
graphene_ext_ray_get_origin_vec3 (&ray, &origin);
graphene_vec3_add (&origin, res, res);
graphene_matrix_t inverse;
......
......@@ -105,7 +105,8 @@ xrd_shake_compensator_is_drag (XrdShakeCompensator *self,
graphene_point3d_t controller_point;
graphene_matrix_get_translation_point3d (controller_pose, &controller_point);
graphene_ext_matrix_get_translation_point3d (controller_pose,
&controller_point);
float window_controller_dist = graphene_point3d_distance (intersection,
&controller_point,
......
......@@ -112,10 +112,10 @@ _interpolate_cb (gpointer _transition)
float curve = - (float)pow ((double)transition->interpolate - 1.0, 4) + 1;
graphene_matrix_t interpolated;
graphene_matrix_interpolate_simple (&transition->from,
&transition->to,
curve,
&interpolated);
graphene_ext_matrix_interpolate_simple (&transition->from,
&transition->to,
curve,
&interpolated);
xrd_window_set_transformation (window, &interpolated);
float interpolated_scaling =
......@@ -180,7 +180,7 @@ xrd_window_manager_arrange_reset (XrdWindowManager *self)
g_object_get (G_OBJECT(window), "scale", &transition->from_scaling, NULL);
if (!graphene_matrix_equals (&transition->from, &data->reset_transform))
if (!graphene_ext_matrix_equals (&transition->from, &data->reset_transform))
{
transition->interpolate = 0;
transition->window = window;
......@@ -208,7 +208,7 @@ static float
_azimuth_from_pose (graphene_matrix_t *mat)
{
graphene_matrix_t rotation_matrix;
graphene_matrix_get_rotation_matrix (mat, &rotation_matrix);
graphene_ext_matrix_get_rotation_matrix (mat, &rotation_matrix);
graphene_vec3_t start;
graphene_vec3_init (&start, 0, 0,- 1);
......@@ -235,7 +235,7 @@ xrd_window_manager_arrange_sphere (XrdWindowManager *self)
graphene_matrix_t hmd_pose;
openvr_system_get_hmd_pose (&hmd_pose);
graphene_vec3_t hmd_vec;
graphene_matrix_get_translation_vec3 (&hmd_pose, &hmd_vec);
graphene_ext_matrix_get_translation_vec3 (&hmd_pose, &hmd_vec);
graphene_vec3_t hmd_vec_neg;
graphene_vec3_negate (&hmd_vec, &hmd_vec_neg);
......@@ -298,7 +298,7 @@ xrd_window_manager_arrange_sphere (XrdWindowManager *self)
g_object_get (G_OBJECT(window), "scale", &transition->from_scaling, NULL);
if (!graphene_matrix_equals (&transition->from, &transform))
if (!graphene_ext_matrix_equals (&transition->from, &transform))
{
transition->interpolate = 0;
transition->window = window;
......@@ -527,7 +527,8 @@ _drag_window (XrdWindowManager *self,
XrdGrabState *grab_state = xrd_controller_get_grab_state (controller);
graphene_point3d_t controller_translation_point;
graphene_matrix_get_translation_point3d (pose, &controller_translation_point);
graphene_ext_matrix_get_translation_point3d (pose,
&controller_translation_point);
graphene_quaternion_t controller_rotation;
graphene_quaternion_init_from_matrix (&controller_rotation, pose);
......@@ -605,14 +606,14 @@ xrd_window_manager_drag_start (XrdWindowManager *self,
grab_state->window = hover_state->window;
graphene_quaternion_t controller_rotation;
graphene_matrix_get_rotation_quaternion (&hover_state->pose,
&controller_rotation);
graphene_ext_matrix_get_rotation_quaternion (&hover_state->pose,
&controller_rotation);
graphene_matrix_t window_transform;
xrd_window_get_transformation_no_scale (grab_state->window, &window_transform);
graphene_matrix_get_rotation_quaternion (&window_transform,
&grab_state->window_rotation);
graphene_ext_matrix_get_rotation_quaternion (&window_transform,
&grab_state->window_rotation);
graphene_point3d_t distance_translation_point;
graphene_point3d_init (&distance_translation_point,
......
......@@ -612,9 +612,9 @@ xrd_window_update_child (XrdWindow *self)
float initial_ppm = xrd_window_get_initial_ppm (XRD_WINDOW (self));
graphene_point_t scaled_offset;
graphene_point_scale (&data->child_offset_center,
data->scale / initial_ppm,
&scaled_offset);
graphene_ext_point_scale (&data->child_offset_center,
data->scale / initial_ppm,
&scaled_offset);
graphene_point3d_t scaled_offset3d = {
.x = scaled_offset.x,
......@@ -643,8 +643,8 @@ xrd_window_get_normal (XrdWindow *self,
xrd_window_get_transformation (self, &model_matrix);
graphene_matrix_t rotation_matrix;
graphene_matrix_get_rotation_matrix (&model_matrix,
&rotation_matrix);
graphene_ext_matrix_get_rotation_matrix (&model_matrix,
&rotation_matrix);
graphene_matrix_transform_vec3 (&rotation_matrix, normal, normal);
}
......@@ -660,7 +660,7 @@ xrd_window_get_plane (XrdWindow *self,
xrd_window_get_transformation (self, &model_matrix);
graphene_point3d_t position;
graphene_matrix_get_translation_point3d (&model_matrix, &position);
graphene_ext_matrix_get_translation_point3d (&model_matrix, &position);
graphene_plane_init_from_point (res, &normal, &position);
}
......
......@@ -13,7 +13,7 @@ static void
_print_translation (graphene_matrix_t *m)
{
graphene_vec3_t t;
graphene_matrix_get_translation_vec3 (m, &t);
graphene_ext_matrix_get_translation_vec3 (m, &t);
float f[3];
graphene_vec3_to_float (&t, f);
......@@ -28,7 +28,7 @@ static void
_print_scale (graphene_matrix_t *m)
{
graphene_vec3_t s;
graphene_matrix_get_scale (m, &s);
graphene_ext_matrix_get_scale (m, &s);
float f[3];
graphene_vec3_to_float (&s, f);
......@@ -43,7 +43,7 @@ static void
_print_rotation (graphene_matrix_t *m)
{
float x, y, z;
graphene_matrix_get_rotation_angles (m, &x, &y, &z);
graphene_ext_matrix_get_rotation_angles (m, &x, &y, &z);
g_print ("Angles: [%f %f %f]\n", (double) x, (double) y, (double) z);
}
......@@ -90,11 +90,11 @@ main ()
_print_rotation (&mat);
g_print ("Rotation quat: ");
graphene_quaternion_print (&orientation);
graphene_ext_quaternion_print (&orientation);
graphene_quaternion_t q;
graphene_matrix_get_rotation_quaternion (&mat, &q);
graphene_ext_matrix_get_rotation_quaternion (&mat, &q);
g_print ("Result quat: ");
graphene_quaternion_print (&q);
graphene_ext_quaternion_print (&q);
graphene_quaternion_init_from_angles (&orientation, 1, 2, 3);
......@@ -109,9 +109,9 @@ main ()
_print_rotation (&mat);
g_print ("Rotation quat: ");
graphene_quaternion_print (&orientation);
graphene_matrix_get_rotation_quaternion (&mat, &q);
graphene_ext_quaternion_print (&orientation);
graphene_ext_matrix_get_rotation_quaternion (&mat, &q);
g_print ("Result quat: ");
graphene_quaternion_print (&q);
graphene_ext_quaternion_print (&q);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment