39 static int mcomp(
const void* a,
const void* b)
56 if (model && scale > 0 && strlen(
filename) > 0) {
62 ::MessageBox(0,
"3DS Import Failed: Magic could not open the file for reading",
"ERROR", MB_OK);
73 int* mesh_verts =
new int[nmeshs];
75 for (
int m = 0; m < nmeshs; m++) {
78 mesh_verts[m] = nverts;
86 ::MessageBox(0,
"3DS Import Failed: model was too large (max 16000 polys)",
"ERROR", MB_OK);
94 for (
int i = 0; i < nmatls; i++) {
154 for (
int m = 0; m < nmeshs && v < nverts; m++) {
179 model->
ScaleBy(256.0f / radius);
185 for (
int m = 0; m < nmeshs && n < npolys; m++) {
190 for (
int i = 0; i < mesh_tris && n < npolys; i++) {
197 p->
verts[0] = tri.
a + mesh_verts[m];
198 p->
verts[1] = tri.
b + mesh_verts[m];
199 p->
verts[2] = tri.
c + mesh_verts[m];
201 if (p->
verts[0] > nverts || p->
verts[1] > nverts || p->
verts[2] > nverts) {
226 qsort((
void*) polys, npolys,
sizeof(
Poly), mcomp);
231 for (
int n = 0; n < npolys; n++) {
243 segment->
polys = &polys[n];
271 ::MessageBox(0,
"3DS Export Failed: Magic could not open the file for writing",
"ERROR", MB_OK);