public static W3dRgb Parse(BinaryReader reader) { var result = new W3dRgb { R = reader.ReadByte(), G = reader.ReadByte(), B = reader.ReadByte(), }; reader.ReadByte(); // padding return(result); }
public static W3dBox Parse(BinaryReader reader) { var result = new W3dBox { Version = reader.ReadUInt32() }; var flags = reader.ReadUInt32(); result.BoxType = (W3dBoxType)(flags & 0b11); result.CollisionTypes = (W3dBoxCollisionTypes)(flags & 0xFF0); result.Name = reader.ReadFixedLengthString(W3dConstants.NameLength * 2); result.Color = W3dRgb.Parse(reader); result.Center = reader.ReadVector3(); result.Extent = reader.ReadVector3(); return(result); }
internal static W3dBox Parse(BinaryReader reader, W3dParseContext context) { return(ParseChunk(reader, context, header => { var result = new W3dBox { Version = reader.ReadUInt32() }; var flags = reader.ReadUInt32(); result.BoxType = (W3dBoxType)(flags & 0b11); result.CollisionTypes = (W3dBoxCollisionTypes)(flags & 0xFF0); result.Name = reader.ReadFixedLengthString(W3dConstants.NameLength * 2); result.Color = W3dRgb.Parse(reader); result.Center = reader.ReadVector3(); result.Extent = reader.ReadVector3(); return result; }));
public static W3dVertexMaterial Parse(BinaryReader reader) { var rawAttributes = reader.ReadUInt32(); var result = new W3dVertexMaterial { Attributes = (W3dVertexMaterialFlags)(rawAttributes & 0xF), Stage0Mapping = ConvertStageMapping(rawAttributes, 0x00FF0000, 16), Stage1Mapping = ConvertStageMapping(rawAttributes, 0x0000FF00, 8), Ambient = W3dRgb.Parse(reader), Diffuse = W3dRgb.Parse(reader), Specular = W3dRgb.Parse(reader), Emissive = W3dRgb.Parse(reader), Shininess = reader.ReadSingle(), Opacity = reader.ReadSingle(), Translucency = reader.ReadSingle() }; return(result); }
internal static W3dVertexMaterialInfo Parse(BinaryReader reader, W3dParseContext context) { return(ParseChunk(reader, context, header => { var rawAttributes = reader.ReadUInt32(); return new W3dVertexMaterialInfo { Attributes = (W3dVertexMaterialFlags)(rawAttributes & 0xF), Stage0Mapping = ConvertStageMapping(rawAttributes, 0x00FF0000, 16), Stage1Mapping = ConvertStageMapping(rawAttributes, 0x0000FF00, 8), Ambient = W3dRgb.Parse(reader), Diffuse = W3dRgb.Parse(reader), Specular = W3dRgb.Parse(reader), Emissive = W3dRgb.Parse(reader), Shininess = reader.ReadSingle(), Opacity = reader.ReadSingle(), Translucency = reader.ReadSingle() }; })); }