goat3d
diff exporters/maxgoat/src/maxgoat.cc @ 30:0fe02696fb1e
yeeay, the max plugin works :)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 29 Sep 2013 23:05:44 +0300 |
parents | 9ba3e2fb8a33 |
children | d317eb4f83da |
line diff
1.1 --- a/exporters/maxgoat/src/maxgoat.cc Sun Sep 29 21:53:03 2013 +0300 1.2 +++ b/exporters/maxgoat/src/maxgoat.cc Sun Sep 29 23:05:44 2013 +0300 1.3 @@ -286,6 +286,7 @@ 1.4 } 1.5 1.6 process_mesh(goat, mesh, maxobj); 1.7 + goat3d_add_mesh(goat, mesh); 1.8 } 1.9 break; 1.10 1.11 @@ -296,6 +297,7 @@ 1.12 goat3d_set_node_object(node, GOAT3D_NODE_LIGHT, light); 1.13 1.14 process_light(goat, light, maxobj); 1.15 + goat3d_add_light(goat, light); 1.16 } 1.17 break; 1.18 1.19 @@ -306,6 +308,7 @@ 1.20 goat3d_set_node_object(node, GOAT3D_NODE_CAMERA, cam); 1.21 1.22 process_camera(goat, cam, maxobj); 1.23 + goat3d_add_camera(goat, cam); 1.24 } 1.25 break; 1.26 1.27 @@ -328,11 +331,13 @@ 1.28 maxobj->InitializeData(); 1.29 1.30 int num_verts = maxmesh->GetNumberOfVerts(); 1.31 + int num_faces = maxmesh->GetNumberOfFaces(); 1.32 //assert(maxmesh->GetNumberOfTexVerts() == num_verts); 1.33 1.34 float *vertices = new float[num_verts * 3]; 1.35 float *normals = new float[num_verts * 3]; 1.36 //float *texcoords = new float[num_verts * 2]; 1.37 + int *indices = new int[num_faces * 3]; 1.38 1.39 for(int i=0; i<num_verts; i++) { 1.40 Point3 v = maxmesh->GetVertex(i, true); 1.41 @@ -357,13 +362,24 @@ 1.42 texcoords[i * 2 + 1] = tex.y; 1.43 }*/ 1.44 1.45 + // get the faces 1.46 + for(int i=0; i<num_faces; i++) { 1.47 + FaceEx *face = maxmesh->GetFace(i); 1.48 + indices[i * 3] = face->vert[0]; 1.49 + indices[i * 3 + 1] = face->vert[1]; 1.50 + indices[i * 3 + 2] = face->vert[2]; 1.51 + // TODO at some point I'll have to split based on normal/texcoord indices 1.52 + } 1.53 + 1.54 goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_VERTEX, vertices, num_verts); 1.55 goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_NORMAL, normals, num_verts); 1.56 //goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_TEXCOORD, texcoords, num_verts); 1.57 + goat3d_set_mesh_faces(mesh, indices, num_faces); 1.58 1.59 delete [] vertices; 1.60 delete [] normals; 1.61 //delete [] texcoords; 1.62 + delete [] indices; 1.63 } 1.64 1.65 void GoatExporter::process_light(goat3d *goat, goat3d_light *light, IGameObject *maxobj)