예제 #1
0
        private static AaronPresetCarVinyl convertFeVinylToAaronVinyl(FEPresetVinyl fePresetVinyl)
        {
            AaronPresetCarVinyl vinyl = new AaronPresetCarVinyl();

            vinyl.Shear      = (byte)(fePresetVinyl.Shear / 2);
            vinyl.Hash       = unchecked ((uint)fePresetVinyl.Hash);
            vinyl.IsMirrored = fePresetVinyl.IsMirrored;
            vinyl.Rotation   = fePresetVinyl.Rotation;
            vinyl.ScaleX     = fePresetVinyl.ScaleX;
            vinyl.ScaleY     = fePresetVinyl.ScaleY;
            vinyl.TranX      = fePresetVinyl.TranX;
            vinyl.TranY      = fePresetVinyl.TranY;
            vinyl.Hues       = new AaronPresetCarVinylHue[fePresetVinyl.Hues.Length];

            for (var index = 0; index < fePresetVinyl.Hues.Length; index++)
            {
                var fePresetVinylHue = fePresetVinyl.Hues[index];

                vinyl.Hues[index]            = new AaronPresetCarVinylHue();
                vinyl.Hues[index].Hue        = unchecked ((uint)fePresetVinylHue.Hue);
                vinyl.Hues[index].Saturation = fePresetVinylHue.Saturation;
                vinyl.Hues[index].Variance   = fePresetVinylHue.Variance;
            }

            return(vinyl);
        }
예제 #2
0
        private static FEPresetVinyl convertAaronVinylToFE(AaronPresetCarVinyl aaronPresetCarVinyl)
        {
            FEPresetVinyl fePresetVinyl = new FEPresetVinyl();

            fePresetVinyl.Hash       = unchecked ((int)aaronPresetCarVinyl.Hash);
            fePresetVinyl.Hues       = new FEPresetVinylHue[4];
            fePresetVinyl.IsMirrored = aaronPresetCarVinyl.IsMirrored;
            fePresetVinyl.Rotation   = aaronPresetCarVinyl.Rotation;

            if (aaronPresetCarVinyl.Shear * 2 > byte.MaxValue)
            {
                throw new InvalidDataException("invalid shear");
            }

            fePresetVinyl.Shear  = (byte)(aaronPresetCarVinyl.Shear * 2);
            fePresetVinyl.ScaleX = aaronPresetCarVinyl.ScaleX;
            fePresetVinyl.ScaleY = aaronPresetCarVinyl.ScaleY;
            fePresetVinyl.TranX  = aaronPresetCarVinyl.TranX;
            fePresetVinyl.TranY  = aaronPresetCarVinyl.TranY;

            fePresetVinyl.Hues[0] = new FEPresetVinylHue();
            fePresetVinyl.Hues[1] = new FEPresetVinylHue();
            fePresetVinyl.Hues[2] = new FEPresetVinylHue();
            fePresetVinyl.Hues[3] = new FEPresetVinylHue();

            for (int i = 0; i < 4; i++)
            {
                fePresetVinyl.Hues[i] = new FEPresetVinylHue();

                if (aaronPresetCarVinyl.Hues[i] != null)
                {
                    fePresetVinyl.Hues[i].Hue        = unchecked ((int)aaronPresetCarVinyl.Hues[i].Hue);
                    fePresetVinyl.Hues[i].Saturation = aaronPresetCarVinyl.Hues[i].Saturation;
                    fePresetVinyl.Hues[i].Variance   = aaronPresetCarVinyl.Hues[i].Variance;
                }
            }

            return(fePresetVinyl);
        }