|
I have fixed my problem using this check: if (!found && k >= 128 ) /*k >= 128*/{ if (f->smoothing & p->face->smoothing) { lib3ds_vector_add(n,n, p->face->normal); lib3ds_vector_copy(N[k], p->face->normal); ++k; } } Is it ok? (any side effects) Hello, about lib3ds_mesh_calculate_normals Intresting place: for (i=0; i<mesh->faces; ++i) { Lib3dsFace *f=&mesh->faceL[i]; for (j=0; j<3; ++j) { // FIXME: static array needs at least check!! Lib3dsVector n,N[128]; // <- N[128] ??? //////////////////////////////////// First question: why 128??? And I have problem here(lib3ds_mesh_calculate_normals): Here variable "k" can be more than 128 if (!found) { if (f->smoothing & p->face->smoothing) { lib3ds_vector_add(n,n, p->face->normal); // on this line program fails... with memory lib3ds_vector_copy(N[k], p->face->normal); ++k; } } Now, how to fix this I don't know, because I can not understand why 128 used for the array size.. (To fix this array size should be known (maybe...)) Any solutions? (I can send a sample 3ds file). Tomas |
