Beispiel #1
0
        internal static GlobalLighting Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var time = reader.ReadUInt32AsEnum <TimeOfDay>();

                var lightingConfigurations = new Dictionary <TimeOfDay, GlobalLightingConfiguration>();

                for (var i = 0; i < TimeOfDayValues.Length; i++)
                {
                    lightingConfigurations[TimeOfDayValues[i]] = GlobalLightingConfiguration.Parse(reader, version);
                }

                var shadowColor = MapColorArgb.Parse(reader);

                // TODO: BFME. Overbright? Bloom?
                byte[] unknown = null;
                if (version >= 7 && version < 11)
                {
                    unknown = reader.ReadBytes(version >= 9 ? 4 : 44);
                }

                Vector3?unknown2 = null;
                MapColorArgb?unknown3 = null;
                if (version >= 12)
                {
                    unknown2 = reader.ReadVector3();
                    unknown3 = MapColorArgb.Parse(reader);
                }

                ColorRgbF?noCloudFactor = null;
                if (version >= 8)
                {
                    noCloudFactor = reader.ReadColorRgbF();
                }

                return new GlobalLighting
                {
                    Time = time,
                    LightingConfigurations = lightingConfigurations,
                    ShadowColor = shadowColor,
                    Unknown = unknown,
                    Unknown2 = unknown2,
                    Unknown3 = unknown3,
                    NoCloudFactor = noCloudFactor
                };
            }));
        }
Beispiel #2
0
        internal static GlobalLightingConfiguration Parse(BinaryReader reader, uint version)
        {
            var result = new GlobalLightingConfiguration();

            result.TerrainSun = GlobalLight.Parse(reader);

            if (version < 10)
            {
                result.ObjectSun = GlobalLight.Parse(reader);

                if (version >= 7)
                {
                    result.InfantrySun = GlobalLight.Parse(reader);
                }
            }

            result.TerrainAccent1 = GlobalLight.Parse(reader);

            if (version < 10)
            {
                result.ObjectAccent1 = GlobalLight.Parse(reader);

                if (version >= 7)
                {
                    result.InfantryAccent1 = GlobalLight.Parse(reader);
                }
            }

            result.TerrainAccent2 = GlobalLight.Parse(reader);

            if (version < 10)
            {
                result.ObjectAccent2 = GlobalLight.Parse(reader);

                if (version >= 7)
                {
                    result.InfantryAccent2 = GlobalLight.Parse(reader);
                }
            }

            return(result);
        }
Beispiel #3
0
        internal static GlobalLighting Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var time = reader.ReadUInt32AsEnum <TimeOfDay>();

                var lightingConfigurations = new Dictionary <TimeOfDay, GlobalLightingConfiguration>();

                for (var i = 0; i < TimeOfDayValues.Length; i++)
                {
                    lightingConfigurations[TimeOfDayValues[i]] = GlobalLightingConfiguration.Parse(reader);
                }

                var shadowColor = MapColorArgb.Parse(reader);

                return new GlobalLighting
                {
                    Time = time,
                    LightingConfigurations = lightingConfigurations,
                    ShadowColor = shadowColor
                };
            }));
        }