Esempio n. 1
0
        protected override void ReadV8(ByteReader reader)
        {
            base.ReadV8(reader);

            DataFlags = reader.ReadU16();
            if (( DataFlags & 0x0001 ) == 0x0001) {
                // Pattern bits are valid
                if (( DataFlags & 0x0002 ) == 0x0002) {
                    float c = reader.ReadF32();
                    AmbientColor = new[] {c, c, c, 1.0f};
                } else {
                    AmbientColor = reader.ReadRGBA();
                }
                DiffuseColor = reader.ReadRGBA();
                if ( ( DataFlags & 0x0004 ) == 0x0004 ) {
                    float c = reader.ReadF32();
                    SpecularColor = new[] { c, c, c, 1.0f };
                } else {
                    SpecularColor = reader.ReadRGBA();
                }
                if ( ( DataFlags & 0x0008 ) == 0x0008 ) {
                    float c = reader.ReadF32();
                    EmissionColor = new[] { c, c, c, 1.0f };
                } else {
                    EmissionColor = reader.ReadRGBA();
                }
            } else {
                AmbientColor = reader.ReadRGBA();
                DiffuseColor = reader.ReadRGBA();
                SpecularColor = reader.ReadRGBA();
                EmissionColor = reader.ReadRGBA();
            }
            Shininess = reader.ReadF32();
        }
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     ushort storedMask = reader.ReadU16();
     for ( int i = 0; i < 16; i++ ) {
         if ( ( storedMask & 0x8000 ) == 0x8000 ) {
             Transform[i] = reader.ReadF32();
         }
         storedMask <<= 1;
     }
 }