void LoadTexture(Chunk chunk, BasicTexture texture) { Chunk child; for (int pos = chunk.Child; pos < chunk.Next; pos = child.Next) { child = ReadChunk(pos); int args = child.Args; switch (child.Type) { case ChunkType.FileImage: int size = ReadInt32(args); var image = new byte[size]; Array.Copy(fileImage, args + 4, image, 0, size); texture.Texture = new Texture2D(image, true); break; case ChunkType.FileName: texture.FileName = ReadString(child.Args, child.Args + child.ArgsSize); break; } } }
void LoadTexture( Chunk chunk, BasicTexture texture ) { Chunk child ; for ( int pos = chunk.Child ; pos < chunk.Next ; pos = child.Next ) { child = ReadChunk( pos ) ; int args = child.Args ; switch ( child.Type ) { case ChunkType.FileImage : int size = ReadInt32( args ) ; var image = new byte[ size ] ; Array.Copy( fileImage, args + 4, image, 0, size ) ; texture.Texture = new Texture2D( image, true ) ; break ; case ChunkType.FileName: texture.FileName = ReadString( child.Args, child.Args + child.ArgsSize ) ; break; } } }