Code:
public void CreateOBJFile()
{
Console.WriteLine("Creating OBJFile.");
BinaryReader reader = new BinaryReader(
File.Open("C:\\30_48.mesh",
FileMode.Open)); // stormwind
TextWriter tw = new StreamWriter("stormwind.obj");
reader.ReadBytes(32); //jump over BBX
reader.ReadBytes(16); //jump over ADT
// INDICES
reader.ReadChars(3);
reader.ReadByte();
UInt32 indexSize = reader.ReadUInt32();
int[] indexes = new int[indexSize];
for (int i = 0; i < indexSize; i++)
{
indexes[i] = (int)(reader.ReadInt32()+1);
}
Console.WriteLine("Done with saving indices.");
// write VERTICES
reader.ReadChars(3);
reader.ReadByte();
UInt32 vertexSize = reader.ReadUInt32();
for (int i = 0; i < vertexSize; i++)
{
tw.WriteLine("v " + reader.ReadSingle() + " " + reader.ReadSingle() + " " + reader.ReadSingle());
}
Console.WriteLine("Done with writing vertices.");
// write INDICES
for (int i = 0; i < indexSize;)
{
tw.WriteLine("f " + indexes[i++] + " " + indexes[i++] + " " + indexes[i++]);
}
Console.WriteLine("Done with writing indices.");
tw.Close();
Console.WriteLine("Done.");
}
This should generate a decent .obj for recast.
I am at this point now and have no idea what methods should be called from recast to read the mesh (the steps how to read the mesh) and then call findStraightPath. This may be because I am a lazy f u c k and reading C++ code hurts my brain.