summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-01-16 15:22:43 +0000
committerRobert Bragg <robert@linux.intel.com>2012-01-16 21:06:19 +0000
commit0396d3e7e6243037503d0bf220448caea13fea88 (patch)
tree0850dc62abdd9b8fd1df5296b37d3a06779de092
parent7c14ba7d374db06db737b5b5e2df154ae5564df2 (diff)
downloadclutter-0396d3e7e6243037503d0bf220448caea13fea88.tar.gz
Remove use of CoglVector3pre-apocalypse-1
Cogl has removed the CoglVector3 type in favour of directly using an array of 3 floats. Reviewed-by: Robert Bragg <robert@linux.intel.com>
-rw-r--r--clutter/clutter-paint-volume.c11
-rw-r--r--clutter/clutter-private.h4
-rw-r--r--clutter/clutter-stage.c32
3 files changed, 24 insertions, 23 deletions
diff --git a/clutter/clutter-paint-volume.c b/clutter/clutter-paint-volume.c
index 512c49c3d..5b5427460 100644
--- a/clutter/clutter-paint-volume.c
+++ b/clutter/clutter-paint-volume.c
@@ -1063,12 +1063,13 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
/* XXX: for perspective projections this can be optimized
* out because all the planes should pass through the origin
* so (0,0,0) is a valid v0. */
- p.x = vertices[j].x - planes[i].v0.x;
- p.y = vertices[j].y - planes[i].v0.y;
- p.z = vertices[j].z - planes[i].v0.z;
+ p.x = vertices[j].x - planes[i].v0[0];
+ p.y = vertices[j].y - planes[i].v0[1];
+ p.z = vertices[j].z - planes[i].v0[2];
- distance =
- planes[i].n.x * p.x + planes[i].n.y * p.y + planes[i].n.z * p.z;
+ distance = (planes[i].n[0] * p.x +
+ planes[i].n[1] * p.y +
+ planes[i].n[2] * p.z);
if (distance < 0)
out++;
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index 51841cf91..df17d6a00 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -253,8 +253,8 @@ void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
typedef struct _ClutterPlane
{
- CoglVector3 v0;
- CoglVector3 n;
+ float v0[3];
+ float n[3];
} ClutterPlane;
typedef enum _ClutterCullResult
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index ec4c73f77..bb016f8ac 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -439,8 +439,8 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
Vector4 *tmp_poly;
ClutterPlane *plane;
int i;
- CoglVector3 b;
- CoglVector3 c;
+ float b[3];
+ float c[3];
int count;
tmp_poly = g_alloca (sizeof (Vector4) * n_vertices * 2);
@@ -507,23 +507,23 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
for (i = 0; i < count; i++)
{
plane = &planes[i];
- plane->v0 = *(CoglVector3 *)&tmp_poly[i];
- b = *(CoglVector3 *)&tmp_poly[n_vertices + i];
- c = *(CoglVector3 *)&tmp_poly[n_vertices + i + 1];
- cogl_vector3_subtract (&b, &b, &plane->v0);
- cogl_vector3_subtract (&c, &c, &plane->v0);
- cogl_vector3_cross_product (&plane->n, &b, &c);
- cogl_vector3_normalize (&plane->n);
+ memcpy (plane->v0, tmp_poly + i, sizeof (float) * 3);
+ memcpy (b, tmp_poly + n_vertices + i, sizeof (float) * 3);
+ memcpy (c, tmp_poly + n_vertices + i + 1, sizeof (float) * 3);
+ cogl_vector3_subtract (b, b, plane->v0);
+ cogl_vector3_subtract (c, c, plane->v0);
+ cogl_vector3_cross_product (plane->n, b, c);
+ cogl_vector3_normalize (plane->n);
}
plane = &planes[n_vertices - 1];
- plane->v0 = *(CoglVector3 *)&tmp_poly[0];
- b = *(CoglVector3 *)&tmp_poly[2 * n_vertices - 1];
- c = *(CoglVector3 *)&tmp_poly[n_vertices];
- cogl_vector3_subtract (&b, &b, &plane->v0);
- cogl_vector3_subtract (&c, &c, &plane->v0);
- cogl_vector3_cross_product (&plane->n, &b, &c);
- cogl_vector3_normalize (&plane->n);
+ memcpy (plane->v0, tmp_poly + 0, sizeof (float) * 3);
+ memcpy (b, tmp_poly + (2 * n_vertices - 1), sizeof (float) * 3);
+ memcpy (c, tmp_poly + n_vertices, sizeof (float) * 3);
+ cogl_vector3_subtract (b, b, plane->v0);
+ cogl_vector3_subtract (c, c, plane->v0);
+ cogl_vector3_cross_product (plane->n, b, c);
+ cogl_vector3_normalize (plane->n);
}
static void