static unsafe BRenderGrannyMesh LoadGR2Internal(granny_file *grannyFile) { try { if (grannyFile != null) { // It's a file Granny can load (but might be just a raw bunch of bits). granny_file_info *file_info = GrannyGetFileInfo((IntPtr)grannyFile); if (file_info != null) { ConvertCoordinateSystem(file_info, true, true); //file has been transformed, load our meshes BRenderGrannyMesh mesh = new BRenderGrannyMesh(); createMeshFromGR2(ref mesh, file_info); return(mesh); } } } catch (Exception e) { Console.WriteLine("Error loading granny file"); } return(null); }
static public unsafe BRenderGrannyMesh LoadGR2FromIntPtr(IntPtr ptr, int size) { granny_file *grannyFile = (granny_file *)GrannyReadEntireFileFromMemory(size, ptr.ToPointer()); return(LoadGR2Internal(grannyFile)); }
public static extern unsafe void GrannyFreeFileSection(granny_file *File, int SectionIndex);