[vertex-buffer] Add cogl_vertex_buffer_indices_get_type API
cogl_vertex_buffer_indices lets you query back the data type used for the given indices handle.
This commit is contained in:
parent
555159776b
commit
8f734ccbb4
@ -332,6 +332,17 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
|||||||
const void *indices_array,
|
const void *indices_array,
|
||||||
int indices_len);
|
int indices_len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_vertex_buffer_indices_get_type:
|
||||||
|
* @handle: An indices handle
|
||||||
|
*
|
||||||
|
* Queries back the data type used for the given indices
|
||||||
|
*
|
||||||
|
* Returns: The CoglIndicesType used
|
||||||
|
*/
|
||||||
|
CoglIndicesType
|
||||||
|
cogl_vertex_buffer_indices_get_type (CoglHandle indices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_vertex_buffer_delete_indices:
|
* cogl_vertex_buffer_delete_indices:
|
||||||
* @handle: A vertex buffer handle
|
* @handle: A vertex buffer handle
|
||||||
|
@ -1802,6 +1802,27 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
|||||||
return _cogl_vertex_buffer_indices_handle_new (indices);
|
return _cogl_vertex_buffer_indices_handle_new (indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoglIndicesType
|
||||||
|
cogl_vertex_buffer_indices_get_type (CoglHandle indices_handle)
|
||||||
|
{
|
||||||
|
CoglVertexBufferIndices *indices = NULL;
|
||||||
|
|
||||||
|
if (!cogl_is_vertex_buffer_indices (indices_handle))
|
||||||
|
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
|
||||||
|
|
||||||
|
indices = _cogl_vertex_buffer_indices_pointer_from_handle (indices_handle);
|
||||||
|
|
||||||
|
if (indices->type == GL_UNSIGNED_BYTE)
|
||||||
|
return COGL_INDICES_TYPE_UNSIGNED_BYTE;
|
||||||
|
else if (indices->type == GL_UNSIGNED_SHORT)
|
||||||
|
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_critical ("unknown indices type %d", indices->type);
|
||||||
|
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *indices)
|
_cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *indices)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user