예제 #1
0
        public void Initalize(ParticleArrayHolder holder, ParticleOptions options)
        {
            if (IsCudaAvailable())
            {
                unsafe
                {
                    fixed (Vector2* ppositions = holder.positions, pvel = holder.velocities)
                    {
                        fixed (float* pRotations = holder.Rotations, pLifeTimes = holder.lifetimes)
                        {
                            fixed (Rectangle* prect = holder.rects)
                            {
                                fixed (byte* palphas = holder.alphas)
                                {
                                    //CudaInitialize(particlePTR, particles.Length, options);
                                    //TODO
                                    try
                                    {
                                        cudaObject = CudaInitialize(ppositions, pvel, pRotations, pLifeTimes, prect, palphas, holder.positions.Length);
                                    }
                                    catch (Exception)
                                    {

                                        //throw;
                                    }

                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
 private ParticleArrayHolder CreateHolder()
 {
     ParticleArrayHolder holder = new ParticleArrayHolder();
     holder.alphas = alphas;
     holder.lifetimes = lifetimes;
     holder.positions = positions;
     holder.rects = rects;
     holder.Rotations = Rotations;
     holder.velocities = velocities;
     return holder;
 }
예제 #3
0
 public unsafe void SingleParticleChanged(ParticleArrayHolder holder, int number)
 {
     if (IsCudaAvailable())
     {
         //CudaInitialize(particlePTR, particles.Length, options);
         SinglePArticleChanged(cudaObject, holder.positions[number], holder.velocities[number], holder.Rotations[number], holder.lifetimes[number], holder.rects[number], holder.alphas[number], number);
     }
 }
예제 #4
0
        public unsafe void Run(ParticleArrayHolder holder, ParticleOptions options)
        {
            if (IsCudaAvailable())
            {
                fixed (Vector2* ppositions = holder.positions, pvel = holder.velocities)
                {
                    fixed (float* pRotations = holder.Rotations, pLifeTimes = holder.lifetimes)
                    {
                        fixed (Rectangle* prect = holder.rects)
                        {
                            fixed (byte* palphas = holder.alphas)
                            {
                                //CudaInitialize(particlePTR, particles.Length, options);

                                CudaMain(cudaObject, ppositions, pvel, pRotations, pLifeTimes, prect, palphas, holder.positions.Length, options);

                            }
                        }
                    }
                }
            }
        }