예제 #1
0
        public override void Initialize(Engine.Workflow w)
        {
            base.Initialize(w);

            // both have all values initialized at 0 by default;
            t_buffer_1 = new Engine.Effects.Particles.FluidField(t_imageSource.Width, t_imageSource.Height);
            t_buffer_2 = new Effects.Particles.FluidField(t_imageSource.Width, t_imageSource.Height);

            sum  = new double[t_imageSource.Width * t_imageSource.Height];
            b1_1 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_2 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_3 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_4 = new double[t_imageSource.Width * t_imageSource.Height];

            b2_1 = new double[t_imageSource.Width * t_imageSource.Height];
        }
예제 #2
0
        internal override void Draw(MousePoint p)
        {
            t_buffer_1.SetFluidAmount(5d, p.X, p.Y, PixelSetOptions.Ignore);

            int offset = 0;

            for (int i = 0; i < t_steps; i++)
            {
                offset = 0;
                for (int y = 0; y < t_imageSource.Height; y++)
                {
                    Engine.Threading.ParamList paramList = new Threading.ParamList();
                    paramList.Add("y", typeof(int), y);
                    loop.Loop(t_imageSource.Width, Threaded_Draw, paramList);
                    //Threaded_Draw(0, t_imageSource.Width, paramList);
                }

                Engine.EngineCppLibrary.CalculateRippleEffect s_calculateRippleEffect = (Engine.EngineCppLibrary.CalculateRippleEffect)Marshal.GetDelegateForFunctionPointer(
                    Engine.EngineCppLibrary.Pointer_calculateRippleEffect,
                    typeof(Engine.EngineCppLibrary.CalculateRippleEffect));

                s_calculateRippleEffect(t_imageSource.Width * t_imageSource.Height, sum, b1_1, b1_2, b1_3, b1_4, b2_1, t_dampening);

                offset = 0;
                for (int y = 0; y < t_imageSource.Height; y++)
                {
                    for (int x = 0; x < t_imageSource.Width; x++)
                    {
                        t_buffer_2.SetFluidAmount(sum[offset], x, y, PixelSetOptions.Ignore);
                        offset++;
                    }
                }

                Engine.Effects.Particles.FluidField temp = t_buffer_1;
                t_buffer_1 = t_buffer_2;
                t_buffer_2 = temp;
            }

            ShadeImage();
        }