reading model files with c#...

Started by
9 comments, last by xyz 20 years, 1 month ago
faces = new Face[numFaces] only creates the array it does not create the individual Face class instances. That snippet would work fine if Face was a value type but it is not in this case.

You will need to do something like this :

faces = new Face[numFaces];				for(int i=0; i < numFaces; i++ ) //**?? I think yours got chopped{							    line = sr.ReadLine();				    string[] curr = line.Split(' ');	    //** Create an instance of the face	     faces[i] = new Face();    faces[i].vertIndex[0] = Int32.Parse(curr[0]);    faces[i].vertIndex[1] = Int32.Parse(curr[1]);    faces[i].vertIndex[2] = Int32.Parse(curr[2]);}

Cheers,
~Entz

-=-=-=-=-=-=-=-=-=-=-=-=-=-
http:\\www.leviathan3d.com (under construction)
Edit: Fixed up source tags

[edited by - Entz on March 5, 2004 11:42:04 PM]
Cheers,~Entz-=-=-=-=-=-=-=-=-=-=-=-=-=-http:www.leviathan3d.com (under construction)

This topic is closed to new replies.

Advertisement