Пример #1
0
        public void SetNewTables(ColorTableValues table, List <uint> times, List <Vector3> colors)
        {
            mTimeTables[(int)table]  = times;
            mColorTables[(int)table] = colors;

            DBC.LightIntBand band = DBC.DBCStores.LightIntBand[mLight.skyParam * 18 + (uint)table - 17];
            band.NumEntries = (uint)times.Count;
            for (int i = 0; i < times.Count; ++i)
            {
                band.Times[i]  = times[i];
                band.Values[i] = ToUint(colors[i]);
            }
        }
Пример #2
0
 public Vector3 GetColorEntry(ColorTableValues table)
 {
     return mColors[(int)table];
 }
Пример #3
0
        public void SetNewTables(ColorTableValues table, List<uint> times, List<Vector3> colors)
        {
            mTimeTables[(int)table] = times;
            mColorTables[(int)table] = colors;

            DBC.LightIntBand band = DBC.DBCStores.LightIntBand[mLight.skyParam * 18 + (uint)table - 17];
            band.NumEntries = (uint)times.Count;
            for (int i = 0; i < times.Count; ++i)
            {
                band.Times[i] = times[i];
                band.Values[i] = ToUint(colors[i]);
            }
        }
Пример #4
0
 public List<uint> GetTimeLine(ColorTableValues table)
 {
     return mTimeTables[(int)table];
 }
Пример #5
0
 public List<Vector3> GetColorLine(ColorTableValues table)
 {
     return mColorTables[(int)table];
 }
Пример #6
0
        public Vector3 GetColorForTime(ColorTableValues table, float time = -1)
        {
            int idx = (int)table;
            if (time < 0)
                time = (float)((Game.GameManager.GameTime.TotalMilliseconds / 10.0f) % 2880);
            else
                time %= 2880;
            List<uint> timeValues = mTimeTables[(int)table];
            if (timeValues.Count == 0)
                return Vector3.Zero;

            if (timeValues[0] > time)
                time = timeValues[0];

            if (timeValues.Count == 1)
                return mColorTables[(int)table][0];

            Vector3 v1 = Vector3.Zero, v2 = Vector3.Zero;
            uint t1 = 0, t2 = 0;

            for (int i = 0; i < mTimeTables[(int)table].Count; ++i)
            {
                if (i + 1 >= mTimeTables[(int)table].Count)
                {
                    v1 = mColorTables[idx][i];
                    v2 = mColorTables[idx][0];
                    t1 = mTimeTables[idx][i];
                    t2 = mTimeTables[idx][0] + 2880;
                    break;
                }

                var ts = mTimeTables[(int)table][i];
                var te = mTimeTables[idx][i + 1];
                if (ts <= time && te >= time)
                {
                    t1 = ts;
                    t2 = te;
                    v1 = mColorTables[idx][i];
                    v2 = mColorTables[idx][i + 1];
                    break;
                }
            }

            uint diff = t2 - t1;
            if (diff == 0)
                return v1;

            float sat = (time - t1) / diff;
            return (v1 + sat * (v2 - v1));
        }
Пример #7
0
 public Vector3 GetColorEntry(ColorTableValues table)
 {
     return(mColors[(int)table]);
 }
Пример #8
0
        public Vector3 GetColorForTime(ColorTableValues table, float time = -1)
        {
            int idx = (int)table;

            if (time < 0)
            {
                time = (float)((Game.GameManager.GameTime.TotalMilliseconds / 10.0f) % 2880);
            }
            else
            {
                time %= 2880;
            }
            List <uint> timeValues = mTimeTables[(int)table];

            if (timeValues.Count == 0)
            {
                return(Vector3.Zero);
            }

            if (timeValues[0] > time)
            {
                time = timeValues[0];
            }

            if (timeValues.Count == 1)
            {
                return(mColorTables[(int)table][0]);
            }

            Vector3 v1 = Vector3.Zero, v2 = Vector3.Zero;
            uint    t1 = 0, t2 = 0;

            for (int i = 0; i < mTimeTables[(int)table].Count; ++i)
            {
                if (i + 1 >= mTimeTables[(int)table].Count)
                {
                    v1 = mColorTables[idx][i];
                    v2 = mColorTables[idx][0];
                    t1 = mTimeTables[idx][i];
                    t2 = mTimeTables[idx][0] + 2880;
                    break;
                }

                var ts = mTimeTables[(int)table][i];
                var te = mTimeTables[idx][i + 1];
                if (ts <= time && te >= time)
                {
                    t1 = ts;
                    t2 = te;
                    v1 = mColorTables[idx][i];
                    v2 = mColorTables[idx][i + 1];
                    break;
                }
            }

            uint diff = t2 - t1;

            if (diff == 0)
            {
                return(v1);
            }

            float sat = (time - t1) / diff;

            return(v1 + sat * (v2 - v1));
        }
Пример #9
0
 public List <uint> GetTimeLine(ColorTableValues table)
 {
     return(mTimeTables[(int)table]);
 }
Пример #10
0
 public List <Vector3> GetColorLine(ColorTableValues table)
 {
     return(mColorTables[(int)table]);
 }