//************************************************************************* //*** free IMD shape memory //* //* pre shape successfully allocated //* //* params shape = pointer to IMD shape //* //****** void iV_IMDRelease(iIMDShape *s) { unsigned int i; iIMDShape *d; if (s) { if (s->points) { free(s->points); } if (s->connectors) { free(s->connectors); } if (s->polys) { for (i = 0; i < s->npolys; i++) { if (s->polys[i].pindex) { free(s->polys[i].pindex); } if (s->polys[i].texCoord) { free(s->polys[i].texCoord); } } free(s->polys); } if (s->shadowEdgeList) { free(s->shadowEdgeList); s->shadowEdgeList = NULL; } d = s->next; free(s); iV_IMDRelease(d); } }
void modelShutdown() { for (MODELMAP::iterator i = models.begin(); i != models.end(); i = models.erase(i)) { iV_IMDRelease(i.value()); } models.clear(); }
static void iV_IMDRelease(iIMDShape *s) { unsigned int i; iIMDShape *d; if (s) { if (s->points) { free(s->points); } if (s->connectors) { free(s->connectors); } if (s->polys) { for (i = 0; i < s->npolys; i++) { if (s->polys[i].texCoord) { free(s->polys[i].texCoord); } } free(s->polys); } if (s->shadowEdgeList) { free(s->shadowEdgeList); s->shadowEdgeList = nullptr; } glDeleteBuffers(VBO_COUNT, s->buffers); // shader deleted later, if any d = s->next; delete s; iV_IMDRelease(d); } }
//************************************************************************* //*** free IMD shape memory //* //* pre shape successfully allocated //* //* params shape = pointer to IMD shape //* //****** void iV_IMDRelease(iIMDShape *s) { int i; iIMDShape *d; if (s) { if (s->points) { free(s->points); } if (s->connectors) { free(s->connectors); } if (s->polys) { for (i = 0; i < s->npolys; i++) { if (s->polys[i].pindex) { free(s->polys[i].pindex); } if (s->polys[i].pTexAnim) { free(s->polys[i].pTexAnim); } if (s->polys[i].texCoord) { free(s->polys[i].texCoord); } } free(s->polys); } if (s->shadowEdgeList) { free(s->shadowEdgeList); s->shadowEdgeList = NULL; } fprintf(stderr, "imd[IMDRelease] = release successful\n"); d = s->next; free(s); iV_IMDRelease(d); } }