Hi guys,

I'm having problems exporting a simple mesh (vertices (xyzuv) and face indices). the code runs fine and the mesh is exported, but the file format seems invalid (So says blender and 3dsxmax), here's my code:

        Lib3dsFile* file=lib3ds_file_new();
        if (!file)
        {
            printf("can't create new 3ds file\n");
        }
        Lib3dsMaterial* mat=lib3ds_material_new();
        strcpy(mat->name,"drek_na_kvadrat");
        Lib3dsMesh* mesh=lib3ds_mesh_new("mapa_jebote");
        lib3ds_mesh_new_point_list(mesh,nv);
        lib3ds_mesh_new_texel_list(mesh, nv);
        lib3ds_mesh_new_face_list(mesh, ni/3);
        for (int i=0;i<nv;i++)
        {
            mesh->pointL[i].pos[0]=lv[i].x;
            mesh->pointL[i].pos[1]=lv[i].y;
            mesh->pointL[i].pos[2]=lv[i].z;
            mesh->texelL[i][0]=lv[i].u;
            mesh->texelL[i][1]=lv[i].v;
        }
        for (int i=0,j=0;i<ni;i+=3,j++)
        {
            strcpy(mesh->faceL[j].material,"drek_na_kvadrat");
            mesh->faceL[j].points[0]=lind[i];
            mesh->faceL[j].points[1]=lind[i+1];
            mesh->faceL[j].points[2]=lind[i+2];

        }
        lib3ds_file_insert_mesh(file,mesh);
        lib3ds_file_insert_material(file,mat);
        lib3ds_file_save(file,output);



--
---
Krešimir Špes
Cateia Games
Lead programmer
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
lib3ds-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel

Reply via email to