FileInfo * VFSPlugin_LWO::Read(unsigned char *buffer, unsigned int length) { m_offset = 0; m_buffer = buffer; m_length = length; m_fileinfo = new MeshFileInfo(); m_fileinfo->mesh = fusion->Mesh->CreateMesh(); m_fileinfo->filelength = m_length; // Read the FORM tag if(ReadLong() != ID_FORM) return NULL; // Read the entire data size long chunklen = ReadLong()-4; // Read the LWO2 tag if(ReadLong() != ID_LWO2) return NULL; // Read chunks while(chunklen > 0) chunklen -= ReadChunk(); // Process Surface (turn it into a useable mesh) ProcessSurface(); // Return a ptr to the file info return m_fileinfo; }
vsTextureInternal::vsTextureInternal( const vsString &filename_in ): vsResource(filename_in), m_texture(0), m_depth(false), m_premultipliedAlpha(false) { vsString filename = vsFile::GetFullFilename(filename_in); SDL_Surface *loadedImage = IMG_Load(filename.c_str()); vsAssert(loadedImage != NULL, vsFormatString("Unable to load texture %s: %s", filename.c_str(), IMG_GetError())); ProcessSurface(loadedImage); SDL_FreeSurface(loadedImage); }