コード例 #1
0
        /// <summary>
        /// Initialize Timecyc.dat file<para/>
        /// Чтение файла Timecyc
        /// </summary>
        public static void Init()
        {
            if (weatherParams == null)
            {
                Entry[,] ea = new Entry[7, 24];
                TextFile f = new TextFile(PathManager.GetAbsolute("data/Timecyc.dat"), false, false);
                int      w = 0, h = 0;
                foreach (TextFile.Line l in f.Lines)
                {
                    Entry e = new Entry();

                    e.AmbientStatic = new Vector3(
                        l.Text[0].ToFloat() / 255f,
                        l.Text[1].ToFloat() / 255f,
                        l.Text[2].ToFloat() / 255f
                        );
                    e.AmbientDynamic = new Vector3(
                        l.Text[3].ToFloat() / 255f,
                        l.Text[4].ToFloat() / 255f,
                        l.Text[5].ToFloat() / 255f
                        );
                    e.DiffuseStatic = new Vector3(
                        l.Text[6].ToFloat() / 255f,
                        l.Text[7].ToFloat() / 255f,
                        l.Text[8].ToFloat() / 255f
                        );
                    e.DiffuseDynamic = new Vector3(
                        l.Text[9].ToFloat() / 255f,
                        l.Text[10].ToFloat() / 255f,
                        l.Text[11].ToFloat() / 255f
                        );
                    e.DirectLight = new Vector3(
                        l.Text[12].ToFloat() / 255f,
                        l.Text[13].ToFloat() / 255f,
                        l.Text[14].ToFloat() / 255f
                        );
                    e.SkyTop = new Vector3(
                        l.Text[15].ToFloat() / 255f,
                        l.Text[16].ToFloat() / 255f,
                        l.Text[17].ToFloat() / 255f
                        );
                    e.SkyBottom = new Vector3(
                        l.Text[18].ToFloat() / 255f,
                        l.Text[19].ToFloat() / 255f,
                        l.Text[20].ToFloat() / 255f
                        );

                    e.CameraClip  = l.Text[33].ToFloat();
                    e.FogDistance = l.Text[34].ToFloat();

                    // Storing data
                    // Сохранение данных
                    ea[w, h] = e;
                    h++;
                    if (h > 23)
                    {
                        h = 0;
                        w++;
                    }
                }
                weatherParams = ea;
            }
        }