Model ModelLoader::Load(const string &aFileName, bool aNormalizeMesh /*= false*/) { ResetLoader(); cout << "Loading mesh " << aFileName << " ... "; FILE* pFile = fopen(aFileName.c_str(),"rb"); while(!feof(pFile)) { DispatchRead(pFile); } if(mNormals.size() == 1) { GenerateNormals(); } if(aNormalizeMesh) { NormalizeMesh(); } unsigned int GLId = FillPrimitive(); fclose(pFile); cout << "DONE." << endl; Model RetVal(mVertices, mCombinedVertices,GLId); return RetVal; }
static int LoadROM(const char *filename) { int result=0; int opened; ResetLoader(); HW_HOST(REG_HOST_CONTROL)=HOST_CONTROL_RESET; if((opened=FileOpen(&file,filename))) { int filesize=file.size; unsigned int c=0; int bits; HW_HOST(REG_HOST_ROMSIZE) = file.size; bits=0; c=filesize-1; while(c) { ++bits; c>>=1; } bits-=9; result=1; while(filesize>0) { OSD_ProgressBar(c,bits); if(FileRead(&file,sector_buffer)) { int i; int *p=(int *)§or_buffer; for(i=0;i<512;i+=4) { unsigned int t=*p++; HW_HOST(REG_HOST_BOOTDATA)=t; } } else { result=0; filesize=512; } FileNextSector(&file); filesize-=512; ++c; } }