Exemplo n.º 1
0
        public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums)
            : base(multiThreadTask)
        {
            if (spectrums == null || spectrums.Length != 4)
            {
                throw new ArgumentException("Spectrums array must have a length of 4");
            }

            m_spectrums = spectrums;

            Condition = condition;
            Size      = condition.Key.Size;
            GridSizes = condition.GridSizes;
            WaveAmps  = condition.WaveAmps;
            NumGrids  = condition.Key.NumGrids;           //OYM:  这里

            m_rnd         = new System.Random(0);         //OYM:  创建一个random
            m_distibution = SPECTRUM_DISTRIBUTION.LINEAR; //OYM:  分配模式

            float factor = 2.0f * Mathf.PI * Size;        //OYM:  工厂?

            InverseGridSizes = new Vector4(factor / GridSizes.x, factor / GridSizes.y, factor / GridSizes.z, factor / GridSizes.w);

            m_spectrum01 = new Color[Size * Size]; //OYM:  一个color数组

            if (NumGrids > 2)
            {
                m_spectrum23 = new Color[Size * Size]; //OYM:  又一个?
            }
            m_wtable = new Color[Size * Size];         //OYM:  这一堆玩意没写注释
        }
Exemplo n.º 2
0
        public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums)
            : base(multiThreadTask)
        {
            if (spectrums == null || spectrums.Length != 4)
                throw new ArgumentException("Spectrums array must have a length of 4");

            m_spectrums = spectrums;

            Condition = condition;
            Size = condition.Key.Size;
            GridSizes = condition.GridSizes;
            WaveAmps = condition.WaveAmps;
            NumGrids = condition.Key.NumGrids;

            m_rnd = new System.Random(0);
            m_distibution = SPECTRUM_DISTRIBUTION.LINEAR;

            float factor = 2.0f * Mathf.PI * Size;
            InverseGridSizes = new Vector4(factor / GridSizes.x, factor / GridSizes.y, factor / GridSizes.z, factor / GridSizes.w);

            m_spectrum01 = new Color[Size * Size];

            if(NumGrids > 2)
                m_spectrum23 = new Color[Size * Size];

            m_wtable = new Color[Size * Size];
        }
Exemplo n.º 3
0
        protected float RandomNumber()
        {
            SPECTRUM_DISTRIBUTION distibution = this.m_distibution;

            if (distibution == SPECTRUM_DISTRIBUTION.LINEAR)
            {
                return((float)this.m_rnd.NextDouble());
            }
            if (distibution != SPECTRUM_DISTRIBUTION.GAUSSIAN)
            {
                return((float)this.m_rnd.NextDouble());
            }
            return(this.GaussianRandomNumber());
        }
Exemplo n.º 4
0
 public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums)
     : base(multiThreadTask)
 {
     if (spectrums == null || spectrums.Length != 4)
     {
         throw new ArgumentException("Spectrums array must have a length of 4");
     }
     this.m_spectrums = spectrums;
     this.Condition = condition;
     this.Size = condition.Key.Size;
     this.GridSizes = condition.GridSizes;
     this.WaveAmps = condition.WaveAmps;
     this.NumGrids = condition.Key.NumGrids;
     this.m_rnd = new System.Random(0);
     this.m_distibution = SPECTRUM_DISTRIBUTION.LINEAR;
     float num = 6.28318548f * (float)this.Size;
     this.InverseGridSizes = new Vector4(num / this.GridSizes.x, num / this.GridSizes.y, num / this.GridSizes.z, num / this.GridSizes.w);
     this.m_spectrum01 = new Color[this.Size * this.Size];
     if (this.NumGrids > 2)
     {
         this.m_spectrum23 = new Color[this.Size * this.Size];
     }
     this.m_wtable = new Color[this.Size * this.Size];
 }
Exemplo n.º 5
0
        public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums) : base(multiThreadTask)
        {
            if (spectrums == null || spectrums.Length != 4)
            {
                throw new ArgumentException("Spectrums array must have a length of 4");
            }
            this.m_spectrums   = spectrums;
            this.Condition     = condition;
            this.Size          = condition.Key.Size;
            this.GridSizes     = condition.GridSizes;
            this.WaveAmps      = condition.WaveAmps;
            this.NumGrids      = condition.Key.NumGrids;
            this.m_rnd         = new System.Random(0);
            this.m_distibution = SPECTRUM_DISTRIBUTION.LINEAR;
            float num = 6.28318548f * (float)this.Size;

            this.InverseGridSizes = new Vector4(num / this.GridSizes.x, num / this.GridSizes.y, num / this.GridSizes.z, num / this.GridSizes.w);
            this.m_spectrum01     = new Color[this.Size * this.Size];
            if (this.NumGrids > 2)
            {
                this.m_spectrum23 = new Color[this.Size * this.Size];
            }
            this.m_wtable = new Color[this.Size * this.Size];
        }