Esempio n. 1
0
        public static void Generate_Texture2D()
        {
            Game1.iterateGenerateFrame = true;

            if (FieldState != DataState.Updated)
            {
                //if (FieldState == DataState.Free)
                //    Update_NewFieldSet(Game1.field);
                if (Update_FieldSet_Active == false)
                {
                    Task.Factory.StartNew(Game1.Make_FieldSet_Copy);
                }
                Game1.iterateGenerateFrame = false;
                return;
            }


            FieldState = DataState.Active;

            int maxIterates, count = 0;

            int[,] mcount;

            int width = Game1.Width, height = Game1.Height;

            ScaleToTextureSize(out maxIterates, out mcount, width, height);

            if (Catmul_Spline.NewColourScale_Available)
            {
                ColourScale = Catmul_Spline.Get_NewColourScale();
            }

            int mc, loop;

            Color[] frameCol = new Color[width * height];

            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    mc = mcount[j, i];

                    loop = 0;
                    while (mc > ColourScale[loop] && loop < ColourRange)
                    {
                        loop++;
                    }

                    frameCol[count++] = Game1.mcolor[loop];
                }
            }

            Game1.freshFrame[1 - Game1._fFdb].SetData(frameCol);

            Game1._fFdb = 1 - Game1._fFdb;

            FieldState = DataState.Free;
            Game1.iterateGenerateFrame = false;
        }
Esempio n. 2
0
        public static void Initialise(int colourRange, int fieldN)
        {
            ColourRange = colourRange;
            //   FieldN = fieldN;

            // NewFieldSet = new float[fieldN, fieldN];

            FieldState  = DataState.Null;
            ColourScale = Catmul_Spline.Get_NewColourScale();

            Update_NewFieldSet();
        }