1
0
Fork 0

cogl: s/Cogl*Vertex/CoglVertex*/

We have a bunch of experimental convenience functions like
cogl_primitive_p2/p2t2 that have corresponding vertex structures but it
seemed a bit odd to have the vertex annotation e.g. "P2T2" be an infix
of the type like CoglP2T2Vertex instead of be a postfix like
CoglVertexP2T2. This switches them all to follow the postfix naming
style.
This commit is contained in:
Robert Bragg 2011-01-20 12:29:49 +00:00
parent 3f9e859167
commit b3775a7564
4 changed files with 106 additions and 106 deletions

View file

@ -123,17 +123,17 @@ cogl_primitive_new (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2 (CoglVerticesMode mode, cogl_primitive_new_p2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2Vertex *data) const CoglVertexP2 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP2Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP2), data);
CoglVertexAttribute *attributes[2]; CoglVertexAttribute *attributes[2];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP2Vertex), sizeof (CoglVertexP2),
offsetof (CoglP2Vertex, x), offsetof (CoglVertexP2, x),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = NULL; attributes[1] = NULL;
@ -147,17 +147,17 @@ cogl_primitive_new_p2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3 (CoglVerticesMode mode, cogl_primitive_new_p3 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3Vertex *data) const CoglVertexP3 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP3Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP3), data);
CoglVertexAttribute *attributes[2]; CoglVertexAttribute *attributes[2];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP3Vertex), sizeof (CoglVertexP3),
offsetof (CoglP3Vertex, x), offsetof (CoglVertexP3, x),
3, 3,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = NULL; attributes[1] = NULL;
@ -171,24 +171,24 @@ cogl_primitive_new_p3 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2c4 (CoglVerticesMode mode, cogl_primitive_new_p2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2C4Vertex *data) const CoglVertexP2C4 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP2C4Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP2C4), data);
CoglVertexAttribute *attributes[3]; CoglVertexAttribute *attributes[3];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP2C4Vertex), sizeof (CoglVertexP2C4),
offsetof (CoglP2C4Vertex, x), offsetof (CoglVertexP2C4, x),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_color_in", "cogl_color_in",
sizeof (CoglP2C4Vertex), sizeof (CoglVertexP2C4),
offsetof (CoglP2C4Vertex, r), offsetof (CoglVertexP2C4, r),
4, 4,
COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE); COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
attributes[2] = NULL; attributes[2] = NULL;
@ -202,24 +202,24 @@ cogl_primitive_new_p2c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3c4 (CoglVerticesMode mode, cogl_primitive_new_p3c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3C4Vertex *data) const CoglVertexP3C4 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP3C4Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP3C4), data);
CoglVertexAttribute *attributes[3]; CoglVertexAttribute *attributes[3];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP3C4Vertex), sizeof (CoglVertexP3C4),
offsetof (CoglP3C4Vertex, x), offsetof (CoglVertexP3C4, x),
3, 3,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_color_in", "cogl_color_in",
sizeof (CoglP3C4Vertex), sizeof (CoglVertexP3C4),
offsetof (CoglP3C4Vertex, r), offsetof (CoglVertexP3C4, r),
4, 4,
COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE); COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
attributes[2] = NULL; attributes[2] = NULL;
@ -233,24 +233,24 @@ cogl_primitive_new_p3c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2t2 (CoglVerticesMode mode, cogl_primitive_new_p2t2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2T2Vertex *data) const CoglVertexP2T2 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP2T2Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP2T2), data);
CoglVertexAttribute *attributes[3]; CoglVertexAttribute *attributes[3];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP2T2Vertex), sizeof (CoglVertexP2T2),
offsetof (CoglP2T2Vertex, x), offsetof (CoglVertexP2T2, x),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_tex_coord0_in", "cogl_tex_coord0_in",
sizeof (CoglP2T2Vertex), sizeof (CoglVertexP2T2),
offsetof (CoglP2T2Vertex, s), offsetof (CoglVertexP2T2, s),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[2] = NULL; attributes[2] = NULL;
@ -264,24 +264,24 @@ cogl_primitive_new_p2t2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3t2 (CoglVerticesMode mode, cogl_primitive_new_p3t2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3T2Vertex *data) const CoglVertexP3T2 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP3T2Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP3T2), data);
CoglVertexAttribute *attributes[3]; CoglVertexAttribute *attributes[3];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP3T2Vertex), sizeof (CoglVertexP3T2),
offsetof (CoglP3T2Vertex, x), offsetof (CoglVertexP3T2, x),
3, 3,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_tex_coord0_in", "cogl_tex_coord0_in",
sizeof (CoglP3T2Vertex), sizeof (CoglVertexP3T2),
offsetof (CoglP3T2Vertex, s), offsetof (CoglVertexP3T2, s),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[2] = NULL; attributes[2] = NULL;
@ -295,31 +295,31 @@ cogl_primitive_new_p3t2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2t2c4 (CoglVerticesMode mode, cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2T2C4Vertex *data) const CoglVertexP2T2C4 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP2T2C4Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP2T2C4), data);
CoglVertexAttribute *attributes[4]; CoglVertexAttribute *attributes[4];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP2T2C4Vertex), sizeof (CoglVertexP2T2C4),
offsetof (CoglP2T2C4Vertex, x), offsetof (CoglVertexP2T2C4, x),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_tex_coord0_in", "cogl_tex_coord0_in",
sizeof (CoglP2T2C4Vertex), sizeof (CoglVertexP2T2C4),
offsetof (CoglP2T2C4Vertex, s), offsetof (CoglVertexP2T2C4, s),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[2] = attributes[2] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_color_in", "cogl_color_in",
sizeof (CoglP2T2C4Vertex), sizeof (CoglVertexP2T2C4),
offsetof (CoglP2T2C4Vertex, r), offsetof (CoglVertexP2T2C4, r),
4, 4,
COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE); COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
attributes[3] = NULL; attributes[3] = NULL;
@ -333,31 +333,31 @@ cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3t2c4 (CoglVerticesMode mode, cogl_primitive_new_p3t2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3T2C4Vertex *data) const CoglVertexP3T2C4 *data)
{ {
CoglVertexArray *array = CoglVertexArray *array =
cogl_vertex_array_new (n_vertices * sizeof (CoglP3T2C4Vertex), data); cogl_vertex_array_new (n_vertices * sizeof (CoglVertexP3T2C4), data);
CoglVertexAttribute *attributes[4]; CoglVertexAttribute *attributes[4];
attributes[0] = attributes[0] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_position_in", "cogl_position_in",
sizeof (CoglP3T2C4Vertex), sizeof (CoglVertexP3T2C4),
offsetof (CoglP3T2C4Vertex, x), offsetof (CoglVertexP3T2C4, x),
3, 3,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = attributes[1] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_tex_coord0_in", "cogl_tex_coord0_in",
sizeof (CoglP3T2C4Vertex), sizeof (CoglVertexP3T2C4),
offsetof (CoglP3T2C4Vertex, s), offsetof (CoglVertexP3T2C4, s),
2, 2,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);
attributes[2] = attributes[2] =
cogl_vertex_attribute_new (array, cogl_vertex_attribute_new (array,
"cogl_color_in", "cogl_color_in",
sizeof (CoglP3T2C4Vertex), sizeof (CoglVertexP3T2C4),
offsetof (CoglP3T2C4Vertex, r), offsetof (CoglVertexP3T2C4, r),
4, 4,
COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE); COGL_VERTEX_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
attributes[3] = NULL; attributes[3] = NULL;

View file

@ -47,7 +47,7 @@ G_BEGIN_DECLS
typedef struct _CoglPrimitive CoglPrimitive; typedef struct _CoglPrimitive CoglPrimitive;
/** /**
* CoglP2Vertex: * CoglVertexP2:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* *
@ -60,10 +60,10 @@ typedef struct _CoglPrimitive CoglPrimitive;
typedef struct typedef struct
{ {
float x, y; float x, y;
} CoglP2Vertex; } CoglVertexP2;
/** /**
* CoglP3Vertex: * CoglVertexP3:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @z: The z component of a position attribute * @z: The z component of a position attribute
@ -77,10 +77,10 @@ typedef struct
typedef struct typedef struct
{ {
float x, y, z; float x, y, z;
} CoglP3Vertex; } CoglVertexP3;
/** /**
* CoglP2C4Vertex: * CoglVertexP2C4:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @r: The red component of a color attribute * @r: The red component of a color attribute
@ -98,10 +98,10 @@ typedef struct
{ {
float x, y; float x, y;
guint8 r, g, b, a; guint8 r, g, b, a;
} CoglP2C4Vertex; } CoglVertexP2C4;
/** /**
* CoglP3C4Vertex: * CoglVertexP3C4:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @z: The z component of a position attribute * @z: The z component of a position attribute
@ -120,10 +120,10 @@ typedef struct
{ {
float x, y, z; float x, y, z;
guint8 r, g, b, a; guint8 r, g, b, a;
} CoglP3C4Vertex; } CoglVertexP3C4;
/** /**
* CoglP2T2Vertex: * CoglVertexP2T2:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @s: The s component of a texture coordinate attribute * @s: The s component of a texture coordinate attribute
@ -139,10 +139,10 @@ typedef struct
{ {
float x, y; float x, y;
float s, t; float s, t;
} CoglP2T2Vertex; } CoglVertexP2T2;
/** /**
* CoglP3T2Vertex: * CoglVertexP3T2:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @z: The z component of a position attribute * @z: The z component of a position attribute
@ -159,11 +159,11 @@ typedef struct
{ {
float x, y, z; float x, y, z;
float s, t; float s, t;
} CoglP3T2Vertex; } CoglVertexP3T2;
/** /**
* CoglP2T2C4Vertex: * CoglVertexP2T2C4:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @s: The s component of a texture coordinate attribute * @s: The s component of a texture coordinate attribute
@ -184,10 +184,10 @@ typedef struct
float x, y; float x, y;
float s, t; float s, t;
guint8 r, g, b, a; guint8 r, g, b, a;
} CoglP2T2C4Vertex; } CoglVertexP2T2C4;
/** /**
* CoglP3T2C4Vertex: * CoglVertexP3T2C4:
* @x: The x component of a position attribute * @x: The x component of a position attribute
* @y: The y component of a position attribute * @y: The y component of a position attribute
* @z: The z component of a position attribute * @z: The z component of a position attribute
@ -209,7 +209,7 @@ typedef struct
float x, y, z; float x, y, z;
float s, t; float s, t;
guint8 r, g, b, a; guint8 r, g, b, a;
} CoglP3T2C4Vertex; } CoglVertexP3T2C4;
/** /**
* cogl_primitive_new: * cogl_primitive_new:
@ -241,7 +241,7 @@ cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
* cogl_primitive_new_p2: * cogl_primitive_new_p2:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP2Vertex vertices * @data: An array of #CoglVertexP2 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -250,7 +250,7 @@ cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
* *
* For example to draw a convex polygon you can do: * For example to draw a convex polygon you can do:
* |[ * |[
* CoglP2Vertex triangle[] = * CoglVertexP2 triangle[] =
* { * {
* { 0, 300 }, * { 0, 300 },
* { 150, 0, }, * { 150, 0, },
@ -279,13 +279,13 @@ cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2 (CoglVerticesMode mode, cogl_primitive_new_p2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2Vertex *data); const CoglVertexP2 *data);
/** /**
* cogl_primitive_new_p3: * cogl_primitive_new_p3:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP3Vertex vertices * @data: An array of #CoglVertexP3 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -294,7 +294,7 @@ cogl_primitive_new_p2 (CoglVerticesMode mode,
* *
* For example to draw a convex polygon you can do: * For example to draw a convex polygon you can do:
* |[ * |[
* CoglP3Vertex triangle[] = * CoglVertexP3 triangle[] =
* { * {
* { 0, 300, 0 }, * { 0, 300, 0 },
* { 150, 0, 0 }, * { 150, 0, 0 },
@ -323,13 +323,13 @@ cogl_primitive_new_p2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3 (CoglVerticesMode mode, cogl_primitive_new_p3 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3Vertex *data); const CoglVertexP3 *data);
/** /**
* cogl_primitive_new_p2c4: * cogl_primitive_new_p2c4:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP2C4Vertex vertices * @data: An array of #CoglVertexP2C4 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -340,7 +340,7 @@ cogl_primitive_new_p3 (CoglVerticesMode mode,
* For example to draw a convex polygon with a linear gradient you * For example to draw a convex polygon with a linear gradient you
* can do: * can do:
* |[ * |[
* CoglP2C4Vertex triangle[] = * CoglVertexP2C4 triangle[] =
* { * {
* { 0, 300, 0xff, 0x00, 0x00, 0xff }, * { 0, 300, 0xff, 0x00, 0x00, 0xff },
* { 150, 0, 0x00, 0xff, 0x00, 0xff }, * { 150, 0, 0x00, 0xff, 0x00, 0xff },
@ -369,13 +369,13 @@ cogl_primitive_new_p3 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2c4 (CoglVerticesMode mode, cogl_primitive_new_p2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2C4Vertex *data); const CoglVertexP2C4 *data);
/** /**
* cogl_primitive_new_p3c4: * cogl_primitive_new_p3c4:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP3C4Vertex vertices * @data: An array of #CoglVertexP3C4 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -386,7 +386,7 @@ cogl_primitive_new_p2c4 (CoglVerticesMode mode,
* For example to draw a convex polygon with a linear gradient you * For example to draw a convex polygon with a linear gradient you
* can do: * can do:
* |[ * |[
* CoglP3C4Vertex triangle[] = * CoglVertexP3C4 triangle[] =
* { * {
* { 0, 300, 0, 0xff, 0x00, 0x00, 0xff }, * { 0, 300, 0, 0xff, 0x00, 0x00, 0xff },
* { 150, 0, 0, 0x00, 0xff, 0x00, 0xff }, * { 150, 0, 0, 0x00, 0xff, 0x00, 0xff },
@ -415,13 +415,13 @@ cogl_primitive_new_p2c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3c4 (CoglVerticesMode mode, cogl_primitive_new_p3c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3C4Vertex *data); const CoglVertexP3C4 *data);
/** /**
* cogl_primitive_new_p2t2: * cogl_primitive_new_p2t2:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP2T2Vertex vertices * @data: An array of #CoglVertexP2T2 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -432,7 +432,7 @@ cogl_primitive_new_p3c4 (CoglVerticesMode mode,
* For example to draw a convex polygon with texture mapping you can * For example to draw a convex polygon with texture mapping you can
* do: * do:
* |[ * |[
* CoglP2T2Vertex triangle[] = * CoglVertexP2T2 triangle[] =
* { * {
* { 0, 300, 0.0, 1.0}, * { 0, 300, 0.0, 1.0},
* { 150, 0, 0.5, 0.0}, * { 150, 0, 0.5, 0.0},
@ -461,13 +461,13 @@ cogl_primitive_new_p3c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2t2 (CoglVerticesMode mode, cogl_primitive_new_p2t2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2T2Vertex *data); const CoglVertexP2T2 *data);
/** /**
* cogl_primitive_new_p3t2: * cogl_primitive_new_p3t2:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP3T2Vertex vertices * @data: An array of #CoglVertexP3T2 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -478,7 +478,7 @@ cogl_primitive_new_p2t2 (CoglVerticesMode mode,
* For example to draw a convex polygon with texture mapping you can * For example to draw a convex polygon with texture mapping you can
* do: * do:
* |[ * |[
* CoglP3T2Vertex triangle[] = * CoglVertexP3T2 triangle[] =
* { * {
* { 0, 300, 0, 0.0, 1.0}, * { 0, 300, 0, 0.0, 1.0},
* { 150, 0, 0, 0.5, 0.0}, * { 150, 0, 0, 0.5, 0.0},
@ -507,13 +507,13 @@ cogl_primitive_new_p2t2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3t2 (CoglVerticesMode mode, cogl_primitive_new_p3t2 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3T2Vertex *data); const CoglVertexP3T2 *data);
/** /**
* cogl_primitive_new_p2t2c4: * cogl_primitive_new_p2t2c4:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP2T2C4Vertex vertices * @data: An array of #CoglVertexP2T2C4 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -524,7 +524,7 @@ cogl_primitive_new_p3t2 (CoglVerticesMode mode,
* For example to draw a convex polygon with texture mapping and a * For example to draw a convex polygon with texture mapping and a
* linear gradient you can do: * linear gradient you can do:
* |[ * |[
* CoglP2T2C4Vertex triangle[] = * CoglVertexP2T2C4 triangle[] =
* { * {
* { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, * { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
* { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, * { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
@ -553,13 +553,13 @@ cogl_primitive_new_p3t2 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p2t2c4 (CoglVerticesMode mode, cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP2T2C4Vertex *data); const CoglVertexP2T2C4 *data);
/** /**
* cogl_primitive_new_p3t2c4: * cogl_primitive_new_p3t2c4:
* @mode: A #CoglVerticesMode defining how to draw the vertices * @mode: A #CoglVerticesMode defining how to draw the vertices
* @n_vertices: The number of vertices to process when drawing * @n_vertices: The number of vertices to process when drawing
* @data: An array of #CoglP3T2C4Vertex vertices * @data: An array of #CoglVertexP3T2C4 vertices
* *
* Provides a convenient way to describe a primitive, such as a single * Provides a convenient way to describe a primitive, such as a single
* triangle strip or a triangle fan, that will internally allocate the * triangle strip or a triangle fan, that will internally allocate the
@ -570,7 +570,7 @@ cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
* For example to draw a convex polygon with texture mapping and a * For example to draw a convex polygon with texture mapping and a
* linear gradient you can do: * linear gradient you can do:
* |[ * |[
* CoglP3T2C4Vertex triangle[] = * CoglVertexP3T2C4 triangle[] =
* { * {
* { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, * { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
* { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, * { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
@ -599,7 +599,7 @@ cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
CoglPrimitive * CoglPrimitive *
cogl_primitive_new_p3t2c4 (CoglVerticesMode mode, cogl_primitive_new_p3t2c4 (CoglVerticesMode mode,
int n_vertices, int n_vertices,
const CoglP3T2C4Vertex *data); const CoglVertexP3T2C4 *data);
int int
cogl_primitive_get_first_vertex (CoglPrimitive *primitive); cogl_primitive_get_first_vertex (CoglPrimitive *primitive);

View file

@ -845,7 +845,7 @@ add_line (void *vertices,
CoglVertexAttribute *attribute, CoglVertexAttribute *attribute,
int start, int start,
int end, int end,
CoglP3Vertex *lines, CoglVertexP3 *lines,
int *n_line_vertices) int *n_line_vertices)
{ {
int start_index = get_index (indices, indices_type, start); int start_index = get_index (indices, indices_type, start);
@ -868,7 +868,7 @@ add_line (void *vertices,
*n_line_vertices += 2; *n_line_vertices += 2;
} }
static CoglP3Vertex * static CoglVertexP3 *
get_wire_lines (CoglVertexAttribute *attribute, get_wire_lines (CoglVertexAttribute *attribute,
CoglVerticesMode mode, CoglVerticesMode mode,
int n_vertices_in, int n_vertices_in,
@ -882,7 +882,7 @@ get_wire_lines (CoglVertexAttribute *attribute,
CoglIndicesType indices_type; CoglIndicesType indices_type;
int i; int i;
int n_lines; int n_lines;
CoglP3Vertex *out; CoglVertexP3 *out;
vertices = cogl_buffer_map (COGL_BUFFER (vertex_array), vertices = cogl_buffer_map (COGL_BUFFER (vertex_array),
COGL_BUFFER_ACCESS_READ, 0); COGL_BUFFER_ACCESS_READ, 0);
@ -902,7 +902,7 @@ get_wire_lines (CoglVertexAttribute *attribute,
(n_vertices_in % 3) == 0) (n_vertices_in % 3) == 0)
{ {
n_lines = n_vertices_in; n_lines = n_vertices_in;
out = g_new (CoglP3Vertex, n_lines * 2); out = g_new (CoglVertexP3, n_lines * 2);
for (i = 0; i < n_vertices_in; i += 3) for (i = 0; i < n_vertices_in; i += 3)
{ {
add_line (vertices, indices, indices_type, attribute, add_line (vertices, indices, indices_type, attribute,
@ -917,7 +917,7 @@ get_wire_lines (CoglVertexAttribute *attribute,
n_vertices_in >= 3) n_vertices_in >= 3)
{ {
n_lines = 2 * n_vertices_in - 3; n_lines = 2 * n_vertices_in - 3;
out = g_new (CoglP3Vertex, n_lines * 2); out = g_new (CoglVertexP3, n_lines * 2);
add_line (vertices, indices, indices_type, attribute, add_line (vertices, indices, indices_type, attribute,
0, 1, out, n_vertices_out); 0, 1, out, n_vertices_out);
@ -938,7 +938,7 @@ get_wire_lines (CoglVertexAttribute *attribute,
n_vertices_in >= 3) n_vertices_in >= 3)
{ {
n_lines = 2 * n_vertices_in - 3; n_lines = 2 * n_vertices_in - 3;
out = g_new (CoglP3Vertex, n_lines * 2); out = g_new (CoglVertexP3, n_lines * 2);
add_line (vertices, indices, indices_type, attribute, add_line (vertices, indices, indices_type, attribute,
0, 1, out, n_vertices_out); 0, 1, out, n_vertices_out);
@ -961,7 +961,7 @@ get_wire_lines (CoglVertexAttribute *attribute,
else if (mode == GL_QUADS && (n_vertices_in % 4) == 0) else if (mode == GL_QUADS && (n_vertices_in % 4) == 0)
{ {
n_lines = n_vertices_in; n_lines = n_vertices_in;
out = g_new (CoglP3Vertex, n_lines * 2); out = g_new (CoglVertexP3, n_lines * 2);
for (i = 0; i < n_vertices_in; i += 4) for (i = 0; i < n_vertices_in; i += 4)
{ {
@ -996,7 +996,7 @@ draw_wireframe (CoglVerticesMode mode,
int n_line_vertices; int n_line_vertices;
static CoglPipeline *wire_pipeline; static CoglPipeline *wire_pipeline;
CoglVertexAttribute *wire_attribute[2]; CoglVertexAttribute *wire_attribute[2];
CoglP3Vertex *lines; CoglVertexP3 *lines;
CoglVertexArray *array; CoglVertexArray *array;
for (i = 0; attributes[i]; i++) for (i = 0; attributes[i]; i++)
@ -1015,11 +1015,11 @@ draw_wireframe (CoglVerticesMode mode,
n_vertices, n_vertices,
&n_line_vertices, &n_line_vertices,
indices); indices);
array = cogl_vertex_array_new (sizeof (CoglP3Vertex) * n_line_vertices, array = cogl_vertex_array_new (sizeof (CoglVertexP3) * n_line_vertices,
lines); lines);
wire_attribute[0] = wire_attribute[0] =
cogl_vertex_attribute_new (array, "cogl_position_in", cogl_vertex_attribute_new (array, "cogl_position_in",
sizeof (CoglP3Vertex), sizeof (CoglVertexP3),
0, 0,
3, 3,
COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT); COGL_VERTEX_ATTRIBUTE_TYPE_FLOAT);

View file

@ -12,7 +12,7 @@ typedef CoglPrimitive * (* TestPrimFunc) (ClutterColor *expected_color);
static CoglPrimitive * static CoglPrimitive *
test_prim_p2 (ClutterColor *expected_color) test_prim_p2 (ClutterColor *expected_color)
{ {
static const CoglP2Vertex verts[] = static const CoglVertexP2 verts[] =
{ { 0, 0 }, { 0, 10 }, { 10, 0 } }; { { 0, 0 }, { 0, 10 }, { 10, 0 } };
return cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLES, return cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLES,
@ -23,7 +23,7 @@ test_prim_p2 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p3 (ClutterColor *expected_color) test_prim_p3 (ClutterColor *expected_color)
{ {
static const CoglP3Vertex verts[] = static const CoglVertexP3 verts[] =
{ { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } }; { { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } };
return cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLES, return cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLES,
@ -34,7 +34,7 @@ test_prim_p3 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p2c4 (ClutterColor *expected_color) test_prim_p2c4 (ClutterColor *expected_color)
{ {
static const CoglP2C4Vertex verts[] = static const CoglVertexP2C4 verts[] =
{ { 0, 0, 255, 255, 0, 255 }, { { 0, 0, 255, 255, 0, 255 },
{ 0, 10, 255, 255, 0, 255 }, { 0, 10, 255, 255, 0, 255 },
{ 10, 0, 255, 255, 0, 255 } }; { 10, 0, 255, 255, 0, 255 } };
@ -51,7 +51,7 @@ test_prim_p2c4 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p3c4 (ClutterColor *expected_color) test_prim_p3c4 (ClutterColor *expected_color)
{ {
static const CoglP3C4Vertex verts[] = static const CoglVertexP3C4 verts[] =
{ { 0, 0, 0, 255, 255, 0, 255 }, { { 0, 0, 0, 255, 255, 0, 255 },
{ 0, 10, 0, 255, 255, 0, 255 }, { 0, 10, 0, 255, 255, 0, 255 },
{ 10, 0, 0, 255, 255, 0, 255 } }; { 10, 0, 0, 255, 255, 0, 255 } };
@ -68,7 +68,7 @@ test_prim_p3c4 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p2t2 (ClutterColor *expected_color) test_prim_p2t2 (ClutterColor *expected_color)
{ {
static const CoglP2T2Vertex verts[] = static const CoglVertexP2T2 verts[] =
{ { 0, 0, 1, 0 }, { { 0, 0, 1, 0 },
{ 0, 10, 1, 0 }, { 0, 10, 1, 0 },
{ 10, 0, 1, 0 } }; { 10, 0, 1, 0 } };
@ -83,7 +83,7 @@ test_prim_p2t2 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p3t2 (ClutterColor *expected_color) test_prim_p3t2 (ClutterColor *expected_color)
{ {
static const CoglP3T2Vertex verts[] = static const CoglVertexP3T2 verts[] =
{ { 0, 0, 0, 1, 0 }, { { 0, 0, 0, 1, 0 },
{ 0, 10, 0, 1, 0 }, { 0, 10, 0, 1, 0 },
{ 10, 0, 0, 1, 0 } }; { 10, 0, 0, 1, 0 } };
@ -98,7 +98,7 @@ test_prim_p3t2 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p2t2c4 (ClutterColor *expected_color) test_prim_p2t2c4 (ClutterColor *expected_color)
{ {
static const CoglP2T2C4Vertex verts[] = static const CoglVertexP2T2C4 verts[] =
{ { 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, { { 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff },
{ 0, 10, 1, 0, 0xff, 0xff, 0xf0, 0xff }, { 0, 10, 1, 0, 0xff, 0xff, 0xf0, 0xff },
{ 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; { 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } };
@ -114,7 +114,7 @@ test_prim_p2t2c4 (ClutterColor *expected_color)
static CoglPrimitive * static CoglPrimitive *
test_prim_p3t2c4 (ClutterColor *expected_color) test_prim_p3t2c4 (ClutterColor *expected_color)
{ {
static const CoglP3T2C4Vertex verts[] = static const CoglVertexP3T2C4 verts[] =
{ { 0, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, { { 0, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff },
{ 0, 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, { 0, 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff },
{ 10, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; { 10, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } };