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; } } } } } } } }
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; }
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); } }
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); } } } } } }