private void Read(EndianBinaryReader reader, IndexAttributeFlags flags) { // always big endian var endianness = reader.Endianness; reader.Endianness = Endianness.Big; UnpackFlags(reader.ReadByte()); var indexCount = reader.ReadUInt16(); Indices = new Index[indexCount]; for (int i = 0; i < indexCount; i++) { ref var index = ref Indices[i]; if (flags.HasFlag(IndexAttributeFlags.HasPosition)) { index.PositionIndex = flags.HasFlag(IndexAttributeFlags.Position16BitIndex) ? reader.ReadUInt16() : reader.ReadByte(); } else { index.PositionIndex = ushort.MaxValue; } if (flags.HasFlag(IndexAttributeFlags.HasNormal)) { index.NormalIndex = flags.HasFlag(IndexAttributeFlags.Normal16BitIndex) ? reader.ReadUInt16() : reader.ReadByte(); } else { index.NormalIndex = ushort.MaxValue; } if (flags.HasFlag(IndexAttributeFlags.HasColor)) { index.ColorIndex = flags.HasFlag(IndexAttributeFlags.Color16BitIndex) ? reader.ReadUInt16() : reader.ReadByte(); } else { index.ColorIndex = ushort.MaxValue; } if (flags.HasFlag(IndexAttributeFlags.HasUV)) { index.UVIndex = flags.HasFlag(IndexAttributeFlags.UV16BitIndex) ? reader.ReadUInt16() : reader.ReadByte(); } else { index.UVIndex = ushort.MaxValue; } }
public override void Read(byte[] file, int address) { IndexAttributes = (IndexAttributeFlags)ByteConverter.ToInt32(file, address); }
public IndexAttributeParameter(IndexAttributeFlags flags) { ParameterType = ParameterType.IndexAttributeFlags; IndexAttributes = flags; }
internal override void ReadBody(MeshStateParamType type, EndianBinaryReader reader) { Flags = ( IndexAttributeFlags )reader.ReadInt32(); }
public IndexAttributeFlagsParam(IndexAttributeFlags flags) { Flags = flags; }