예제 #1
0
        private static ColorChannelControl ReadChannelControl(EndianBinaryReader stream)
        {
            var retVal = new ColorChannelControl
            {
                LightingEnabled     = stream.ReadBoolean(),
                MaterialSrc         = (GXColorSrc)stream.ReadByte(),
                LitMask             = (GXLightMask)stream.ReadByte(),
                DiffuseFunction     = (GXDiffuseFunction)stream.ReadByte(),
                AttenuationFunction = (GXAttenuationFunction)stream.ReadByte(),
                AmbientSrc          = (GXColorSrc)stream.ReadByte()
            };

            switch ((int)retVal.AttenuationFunction)
            {
            case 0:
            case 2:
                break;

            case 1:
                retVal.AttenuationFunction = GXAttenuationFunction.Spec;
                break;

            case 3:
                retVal.AttenuationFunction = GXAttenuationFunction.Spot;
                break;
            }

            Trace.Assert(stream.ReadUInt16() == 0xFFFF); // Padding
            return(retVal);
        }
예제 #2
0
파일: MAT3.cs 프로젝트: magcius/JStudio
        private static ColorChannelControl ReadChannelControl(EndianBinaryReader stream)
        {
            var retVal = new ColorChannelControl
            {
                LightingEnabled     = stream.ReadBoolean(),
                MaterialSrc         = (GXColorSrc)stream.ReadByte(),
                LitMask             = (GXLightMask)stream.ReadByte(),
                DiffuseFunction     = (GXDiffuseFunction)stream.ReadByte(),
                AttenuationFunction = (GXAttenuationFunction)stream.ReadByte(),
                AmbientSrc          = (GXColorSrc)stream.ReadByte()
            };

            Trace.Assert(stream.ReadUInt16() == 0xFFFF); // Padding
            return(retVal);
        }