コード例 #1
0
		//run particle logic every so 'value' steps
		internal void RunParticleTypeEvery(ParticleSystem system, int step, int value, ref ParticleSystemActionData child)
		{
			//int stepBase = step + timeStepCount;
				
			if (value > 3)
			{
				//step is getting pretty big...
				//so...
				//don't loop all the particles, loop the timesteps that match
				//then loop all their particles.
				//this accesses less data but jumps around a lot.

				SystemTimeStep timestep;
				for (int t = 0; t < this.timeStepCount; t += value)
				{
					//this step is affected, so iterate all it's children.
					timestep = this.timeSteps[(step + t) & timeStepMask];
					uint index = timestep.firstParticleIndex;

					for (int i = 0; i < timestep.count; i++)
					{
						child.RunParticleChildren(system, this, index, this.particles[index].index, step);

						index = particles[index].nextParticleIndexForTimeStep;
					}
				}
			}
			else
			{
				uint cap =particleCapacity;
				float f = 0;
				for (uint i = 0; i < cap; i++)
				{
					if (((step + particles[i].timeStepIndex) % value) == 0)
						child.RunParticleChildren(system, this, i, f, step);
					f++;
				}
			}
		}
コード例 #2
0
		//run particle logic one particle at a time
		internal void RunParticleTypeOneByOne(ParticleSystem system, int step, ref ParticleSystemActionData child)
		{
			uint cap = particleCapacity;
			float f = 0;
			for (uint i = 0; i < cap; i++)
				child.RunParticle(system, this, i,f++, step);
		}