コード例 #1
0
        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;
                }
            }
コード例 #2
0
ファイル: Parameter.cs プロジェクト: inrg/sa_tools
 public override void Read(byte[] file, int address)
 {
     IndexAttributes = (IndexAttributeFlags)ByteConverter.ToInt32(file, address);
 }
コード例 #3
0
ファイル: Parameter.cs プロジェクト: inrg/sa_tools
 public IndexAttributeParameter(IndexAttributeFlags flags)
 {
     ParameterType   = ParameterType.IndexAttributeFlags;
     IndexAttributes = flags;
 }
コード例 #4
0
ファイル: Param.cs プロジェクト: TGEnigma/SAModelTools
 internal override void ReadBody(MeshStateParamType type, EndianBinaryReader reader)
 {
     Flags = ( IndexAttributeFlags )reader.ReadInt32();
 }
コード例 #5
0
ファイル: Param.cs プロジェクト: TGEnigma/SAModelTools
 public IndexAttributeFlagsParam(IndexAttributeFlags flags)
 {
     Flags = flags;
 }