Skip to content

Instantly share code, notes, and snippets.

@silasb
Created April 28, 2010 03:28
Show Gist options
  • Save silasb/381682 to your computer and use it in GitHub Desktop.
Save silasb/381682 to your computer and use it in GitHub Desktop.
scene->pList = (polygon_t *)malloc(scene->nPolygons * sizeof(polygon_t));
for(int i = 0; i < scene->nPolygons; i++)
{
polygon_t poly;
scene->pList[i] = poly;
loadPolygon(&file, &scene->pList[i], scene->vList);
void loadPolygon(FILE **file, polygon_t *polygon, vertex_t *vList)
{
fscanf(*file, "%i", &polygon->nVertices);
polygon->vList = (vertex_t *)malloc(polygon->nVertices * sizeof(vertex_t));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment