goat3d

diff exporters/maxgoat/src/maxgoat.cc @ 28:9ba3e2fb8a33

modified vmath to work with vs2012, still memory corruptions in 3dsmax...
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 29 Sep 2013 08:46:19 +0300
parents 4deb0b12fe14
children 0fe02696fb1e
line diff
     1.1 --- a/exporters/maxgoat/src/maxgoat.cc	Sun Sep 29 08:20:19 2013 +0300
     1.2 +++ b/exporters/maxgoat/src/maxgoat.cc	Sun Sep 29 08:46:19 2013 +0300
     1.3 @@ -36,8 +36,8 @@
     1.4  
     1.5  class GoatExporter : public SceneExport {
     1.6  private:
     1.7 -	//std::map<IGameMaterial*, goat3d_material*> mtlmap;
     1.8 -	//std::map<IGameNode*, goat3d_node*> nodemap;
     1.9 +	std::map<IGameMaterial*, goat3d_material*> mtlmap;
    1.10 +	std::map<IGameNode*, goat3d_node*> nodemap;
    1.11  
    1.12  public:
    1.13  	IGameScene *igame;
    1.14 @@ -118,8 +118,8 @@
    1.15  int GoatExporter::DoExport(const MCHAR *name, ExpInterface *eiface, Interface *iface,
    1.16  		BOOL non_interactive, DWORD opt)
    1.17  {
    1.18 -	//mtlmap.clear();
    1.19 -	//nodemap.clear();
    1.20 +	mtlmap.clear();
    1.21 +	nodemap.clear();
    1.22  
    1.23  	char fname[512];
    1.24  	wcstombs(fname, name, sizeof fname - 1);
    1.25 @@ -243,7 +243,7 @@
    1.26  			}
    1.27  
    1.28  			goat3d_add_mtl(goat, mtl);
    1.29 -			//mtlmap[maxmtl] = mtl;
    1.30 +			mtlmap[maxmtl] = mtl;
    1.31  		}
    1.32  	}
    1.33  }
    1.34 @@ -280,7 +280,7 @@
    1.35  
    1.36  			// get the node material and assign it to the mesh
    1.37  			IGameMaterial *maxmtl = maxnode->GetNodeMaterial();
    1.38 -			goat3d_material *mtl = 0;//mtlmap[maxmtl];
    1.39 +			goat3d_material *mtl = mtlmap[maxmtl];
    1.40  			if(mtl) {
    1.41  				goat3d_set_mesh_mtl(mesh, mtl);
    1.42  			}
    1.43 @@ -328,11 +328,11 @@
    1.44  	maxobj->InitializeData();
    1.45  
    1.46  	int num_verts = maxmesh->GetNumberOfVerts();
    1.47 -	assert(maxmesh->GetNumberOfTexVerts() == num_verts);
    1.48 +	//assert(maxmesh->GetNumberOfTexVerts() == num_verts);
    1.49  
    1.50  	float *vertices = new float[num_verts * 3];
    1.51  	float *normals = new float[num_verts * 3];
    1.52 -	float *texcoords = new float[num_verts * 2];
    1.53 +	//float *texcoords = new float[num_verts * 2];
    1.54  
    1.55  	for(int i=0; i<num_verts; i++) {
    1.56  		Point3 v = maxmesh->GetVertex(i, true);
    1.57 @@ -350,20 +350,20 @@
    1.58  		normals[vidx * 3 + 2] = norm.z;
    1.59  	}
    1.60  
    1.61 -	for(int i=0; i<maxmesh->GetNumberOfTexVerts(); i++) {
    1.62 +	/*for(int i=0; i<maxmesh->GetNumberOfTexVerts(); i++) {
    1.63  		Point3 tex = maxmesh->GetTexVertex(i);
    1.64  
    1.65  		texcoords[i * 2] = tex.x;
    1.66  		texcoords[i * 2 + 1] = tex.y;
    1.67 -	}
    1.68 +	}*/
    1.69  
    1.70  	goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_VERTEX, vertices, num_verts);
    1.71  	goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_NORMAL, normals, num_verts);
    1.72 -	goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_TEXCOORD, texcoords, num_verts);
    1.73 +	//goat3d_set_mesh_attribs(mesh, GOAT3D_MESH_ATTR_TEXCOORD, texcoords, num_verts);
    1.74  
    1.75  	delete [] vertices;
    1.76  	delete [] normals;
    1.77 -	delete [] texcoords;
    1.78 +	//delete [] texcoords;
    1.79  }
    1.80  
    1.81  void GoatExporter::process_light(goat3d *goat, goat3d_light *light, IGameObject *maxobj)