[clutter] Remove use of CoglVector3
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] Remove use of CoglVector3
- Date: Mon, 16 Jan 2012 23:09:17 +0000 (UTC)
commit 0396d3e7e6243037503d0bf220448caea13fea88
Author: Neil Roberts <neil linux intel com>
Date: Mon Jan 16 15:22:43 2012 +0000
Remove use of CoglVector3
Cogl has removed the CoglVector3 type in favour of directly using an
array of 3 floats.
Reviewed-by: Robert Bragg <robert linux intel com>
clutter/clutter-paint-volume.c | 11 ++++++-----
clutter/clutter-private.h | 4 ++--
clutter/clutter-stage.c | 32 ++++++++++++++++----------------
3 files changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/clutter/clutter-paint-volume.c b/clutter/clutter-paint-volume.c
index 512c49c..5b54274 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 51841cf..df17d6a 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 ec4c73f..bb016f8 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]