1
0
Fork 0

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>
This commit is contained in:
Neil Roberts 2012-01-16 15:22:43 +00:00 committed by Robert Bragg
parent 7c14ba7d37
commit 0396d3e7e6
3 changed files with 24 additions and 23 deletions

View file

@ -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++;

View file

@ -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

View file

@ -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