clmodel.c

00001 #include <cl.h>
00002 
00003 /* i must be less than model->num_meshes */
00004 /*
00005 CLmesh* clModelMesh(const CLmodel* model, GLuint i)
00006 {
00007   return model->context->meshes[model->mesh_indices[i]];
00008 }
00009 
00010 GLuint clModelAddMeshIndex(CLmodel* model, GLuint index)
00011 {
00012   GLuint i;
00013   
00014   if (!(model && (index > -1)))
00015     return -1;
00016   
00017   for (i = 0; i < model->num_meshes; i++)
00018     if (model->mesh_indices[i] == index)
00019       return i;
00020   
00021   model->num_meshes++;
00022   model->mesh_indices = (GLuint*)realloc(model->mesh_indices, 
00023                                          model->num_meshes * sizeof(GLuint));
00024   model->mesh_indices[model->num_meshes - 1] = index;
00025   
00026   return model->num_meshes - 1;
00027 }
00028 */
00029 
00030 unsigned int clModelAddMesh(CLmodel* model, CLmesh* mesh)
00031 {
00032   GLuint i;
00033 
00034   if (!(model && mesh))
00035     return -1;
00036 
00037   for (i = 0; i < model->num_meshes; i++)
00038     if (model->meshes[i] == mesh)
00039       return i;
00040 
00041   model->num_meshes++;
00042   model->meshes = (CLmesh**)realloc(model->meshes,
00043                                     model->num_meshes
00044                                     * sizeof(CLmesh*));
00045   model->meshes[model->num_meshes - 1] = mesh;
00046 
00047   return model->num_meshes - 1;
00048 }
00049 
00050 /*
00051 GLboolean clModelRemoveMeshIndex(CLmodel* model, GLuint index)
00052 {
00053   return GL_TRUE;
00054 }
00055 */

Generated on Thu Dec 27 13:53:41 2007 for CL by  doxygen 1.4.6