debug error when not enough memory in from_mesh
This commit is contained in:
parent
28ba6efdad
commit
c4638880ae
|
@ -201,6 +201,11 @@ void WMesh::from_mesh(const Mesh* mesh, int margin)
|
|||
v_length = mesh->v_length;
|
||||
v_length_allocated = mesh->v_length * margin;
|
||||
v = (Vertex*) malloc(v_length_allocated * sizeof(Vertex));
|
||||
if(v == NULL){
|
||||
debug_pop("FATAL ERROR IN \nALLOCATION OF VERTEX\n(WMesh::from_mesh)");
|
||||
debug_pop("TOTAL MALLOC SIZE : \n%i", v_length_allocated * sizeof(Vertex));
|
||||
exit(0);
|
||||
}
|
||||
for (int i = 0; i < mesh->v_length; i++)
|
||||
{
|
||||
//v[i].FromVertexPoint(mesh->v[i])
|
||||
|
@ -212,11 +217,21 @@ void WMesh::from_mesh(const Mesh* mesh, int margin)
|
|||
t_length = mesh->t_length;
|
||||
t_length_allocated = mesh->t_length * margin;
|
||||
t = (TexturePoint*) malloc(t_length_allocated * sizeof(TexturePoint));
|
||||
if(t == NULL){
|
||||
debug_pop("FATAL ERROR IN \nALLOCATION OF TEXTURE\n (WMesh::from_mesh)");
|
||||
debug_pop("TOTAL MALLOC SIZE : \n%i", t_length_allocated * sizeof(TexturePoint));
|
||||
exit(0);
|
||||
}
|
||||
memcpy(t, mesh->t, mesh->t_length * sizeof(TexturePoint));
|
||||
|
||||
f_length = mesh->f_length;
|
||||
f_length_allocated = mesh->f_length * margin;
|
||||
f = (Face*) malloc(f_length_allocated * sizeof(Face));
|
||||
if(f == NULL){
|
||||
debug_pop("FATAL ERROR IN \nALLOCATION OF FACE\nWMesh::from_mesh)");
|
||||
debug_pop("TOTAL MALLOC SIZE : \n%i" + f_length_allocated * sizeof(Face));
|
||||
exit(0);
|
||||
}
|
||||
memcpy(f, mesh->f, mesh->f_length * sizeof(Face));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue