Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created July 22, 2015 00:15
Show Gist options
  • Save LordNed/e1e443fc185cad0b72e5 to your computer and use it in GitHub Desktop.
Save LordNed/e1e443fc185cad0b72e5 to your computer and use it in GitHub Desktop.
public class SimpleMeshHeader
{
public:
char[4] Magic;
public int SubMeshOffset;
public int NumSubMeshes;
public SimpleSubMesh* GetMesh(int index)
{
return (SimpleSubMesh *)(this + SubMeshOffset) + (index * sizeof(SimpleSubMesh));
}
}
public class SimpleSubMesh
{
int NumVertices;
int VertexOffset;
public Vector3 GetVertex(int index)
{
return (Vector3)((this + VertexOffset) + (index * sizeof(Vector3)));
}
public Vector3* GetVertices()
{
return (Vector3 *)(this + VertexOffset);
}
}
void Main()
{
char* pMeshFile = File.LoadFile(test); // Load mesh into a new char[file.Length];
Vector3 firstVert = pMeshFile->GetMesh(0)->GetVertex(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment