summaryrefslogtreecommitdiff
path: root/cogl/cogl-attribute.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-03-02 15:01:41 +0000
committerRobert Bragg <robert@linux.intel.com>2011-05-16 14:31:31 +0100
commitce7c06dc039189f8d7ebe971864bf3d109fa6324 (patch)
tree27be84e2374825caf651ea8710e299e59e08fdbf /cogl/cogl-attribute.c
parent2da24ab86301ff75670beb4150b56d9339e590d1 (diff)
downloadcogl-ce7c06dc039189f8d7ebe971864bf3d109fa6324.tar.gz
Rename CoglVertexArray to CoglAttributeBuffer
This is part of a broader cleanup of some of the experimental Cogl API. One of the reasons for this particular rename is to switch away from using the term "Array" which implies a regular, indexable layout which isn't the case. We also want to have a strongly implied relationship between CoglAttributes and CoglAttributeBuffers.
Diffstat (limited to 'cogl/cogl-attribute.c')
-rw-r--r--cogl/cogl-attribute.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index 591313d7..e27c9e78 100644
--- a/cogl/cogl-attribute.c
+++ b/cogl/cogl-attribute.c
@@ -231,7 +231,7 @@ validate_cogl_attribute (const char *name,
}
CoglAttribute *
-cogl_attribute_new (CoglVertexArray *array,
+cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
const char *name,
gsize stride,
gsize offset,
@@ -241,7 +241,7 @@ cogl_attribute_new (CoglVertexArray *array,
CoglAttribute *attribute = g_slice_new (CoglAttribute);
gboolean status;
- attribute->array = cogl_object_ref (array);
+ attribute->attribute_buffer = cogl_object_ref (attribute_buffer);
attribute->name = g_strdup (name);
attribute->stride = stride;
attribute->offset = offset;
@@ -312,27 +312,27 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
attribute->normalized = normalized;
}
-CoglVertexArray *
-cogl_attribute_get_array (CoglAttribute *attribute)
+CoglAttributeBuffer *
+cogl_attribute_get_buffer (CoglAttribute *attribute)
{
g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
- return attribute->array;
+ return attribute->attribute_buffer;
}
void
cogl_attribute_set_array (CoglAttribute *attribute,
- CoglVertexArray *array)
+ CoglAttributeBuffer *attribute_buffer)
{
g_return_if_fail (cogl_is_attribute (attribute));
if (G_UNLIKELY (attribute->immutable_ref))
warn_about_midscene_changes ();
- cogl_object_ref (array);
+ cogl_object_ref (attribute_buffer);
- cogl_object_unref (attribute->array);
- attribute->array = array;
+ cogl_object_unref (attribute->attribute_buffer);
+ attribute->attribute_buffer = attribute_buffer;
}
CoglAttribute *
@@ -341,7 +341,7 @@ _cogl_attribute_immutable_ref (CoglAttribute *attribute)
g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
attribute->immutable_ref++;
- _cogl_buffer_immutable_ref (COGL_BUFFER (attribute->array));
+ _cogl_buffer_immutable_ref (COGL_BUFFER (attribute->attribute_buffer));
return attribute;
}
@@ -352,14 +352,14 @@ _cogl_attribute_immutable_unref (CoglAttribute *attribute)
g_return_if_fail (attribute->immutable_ref > 0);
attribute->immutable_ref--;
- _cogl_buffer_immutable_unref (COGL_BUFFER (attribute->array));
+ _cogl_buffer_immutable_unref (COGL_BUFFER (attribute->attribute_buffer));
}
static void
_cogl_attribute_free (CoglAttribute *attribute)
{
g_free (attribute->name);
- cogl_object_unref (attribute->array);
+ cogl_object_unref (attribute->attribute_buffer);
g_slice_free (CoglAttribute, attribute);
}
@@ -598,16 +598,16 @@ enable_gl_state (CoglDrawFlags flags,
for (i = 0; attributes[i]; i++)
{
CoglAttribute *attribute = attributes[i];
- CoglVertexArray *vertex_array;
+ CoglAttributeBuffer *attribute_buffer;
CoglBuffer *buffer;
guint8 *base;
#ifdef HAVE_COGL_GLES2
int attrib_location;
#endif
- vertex_array = cogl_attribute_get_array (attribute);
- buffer = COGL_BUFFER (vertex_array);
- base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_VERTEX_ARRAY);
+ attribute_buffer = cogl_attribute_get_buffer (attribute);
+ buffer = COGL_BUFFER (attribute_buffer);
+ base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER);
switch (attribute->name_id)
{
@@ -875,7 +875,7 @@ get_wire_lines (CoglAttribute *attribute,
int *n_vertices_out,
CoglIndices *_indices)
{
- CoglVertexArray *vertex_array = cogl_attribute_get_array (attribute);
+ CoglAttributeBuffer *attribute_buffer = cogl_attribute_get_buffer (attribute);
void *vertices;
CoglIndexArray *index_array;
void *indices;
@@ -884,7 +884,7 @@ get_wire_lines (CoglAttribute *attribute,
int n_lines;
CoglVertexP3 *out = NULL;
- vertices = cogl_buffer_map (COGL_BUFFER (vertex_array),
+ vertices = cogl_buffer_map (COGL_BUFFER (attribute_buffer),
COGL_BUFFER_ACCESS_READ, 0);
if (_indices)
{
@@ -982,7 +982,7 @@ get_wire_lines (CoglAttribute *attribute,
#endif
if (vertices != NULL)
- cogl_buffer_unmap (COGL_BUFFER (vertex_array));
+ cogl_buffer_unmap (COGL_BUFFER (attribute_buffer));
if (indices != NULL)
cogl_buffer_unmap (COGL_BUFFER (index_array));
@@ -1003,7 +1003,7 @@ draw_wireframe (CoglVerticesMode mode,
static CoglPipeline *wire_pipeline;
CoglAttribute *wire_attribute[2];
CoglVertexP3 *lines;
- CoglVertexArray *array;
+ CoglAttributeBuffer *attribute_buffer;
for (i = 0; attributes[i]; i++)
{
@@ -1021,16 +1021,17 @@ draw_wireframe (CoglVerticesMode mode,
n_vertices,
&n_line_vertices,
indices);
- array = cogl_vertex_array_new (sizeof (CoglVertexP3) * n_line_vertices,
- lines);
+ attribute_buffer =
+ cogl_attribute_buffer_new (sizeof (CoglVertexP3) * n_line_vertices,
+ lines);
wire_attribute[0] =
- cogl_attribute_new (array, "cogl_position_in",
+ cogl_attribute_new (attribute_buffer, "cogl_position_in",
sizeof (CoglVertexP3),
0,
3,
COGL_ATTRIBUTE_TYPE_FLOAT);
wire_attribute[1] = NULL;
- cogl_object_unref (array);
+ cogl_object_unref (attribute_buffer);
if (!wire_pipeline)
{