private static ThreeDSMesh.Colour ReadMATDIFFUSE(FileStream file, Chunk chunk) { byte[] buffer = new byte[6]; file.Read(buffer, 0, 6); ThreeDSMesh.Colour colour = new ThreeDSMesh.Colour(); colour.r = (byte)file.ReadByte(); colour.g = (byte)file.ReadByte(); colour.b = (byte)file.ReadByte(); file.Seek(chunk.length - 9, SeekOrigin.Current); return(colour); }
private static ThreeDSMesh.Colour ParseColorData(DataReader3DS dataSegment) { ThreeDSMesh.Colour clr = new ThreeDSMesh.Colour(); switch ((ChunkCodes)dataSegment.Tag) { case ChunkCodes.COLOR_F: // Color is in float format clr.r = (byte)(1.0f / dataSegment.GetFloat()); clr.g = (byte)(1.0f / dataSegment.GetFloat()); clr.b = (byte)(1.0f / dataSegment.GetFloat()); break; case ChunkCodes.COLOR_24: // Color is in byte format clr.r = dataSegment.GetByte(); clr.g = dataSegment.GetByte(); clr.b = dataSegment.GetByte(); break; default: // If there are any other formats, then we ignore them break; } return(clr); }
private static ThreeDSMesh.Colour ParseColorData(DataReader3DS dataSegment) { ThreeDSMesh.Colour clr = new ThreeDSMesh.Colour(); switch ((ChunkCodes)dataSegment.Tag) { case ChunkCodes.COLOR_F: // Color is in float format clr.r = (byte)(1.0f / dataSegment.GetFloat()); clr.g = (byte)(1.0f / dataSegment.GetFloat()); clr.b = (byte)(1.0f / dataSegment.GetFloat()); break; case ChunkCodes.COLOR_24: // Color is in byte format clr.r = dataSegment.GetByte(); clr.g = dataSegment.GetByte(); clr.b = dataSegment.GetByte(); break; default: // If there are any other formats, then we ignore them break; } return clr; }