Skip to content

Commit

Permalink
v2.7.4 even better !
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Mar 10, 2017
1 parent 2eb0d53 commit 3056a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions PersistentKSPShurikenEmitter.cs
Expand Up @@ -337,12 +337,10 @@ public void EmitterOnUpdate(Vector3 emitterWorldVelocity)
}
}
Profiler.EndSample();

if (particles == null || pe.maxParticles > particles.Length)
particles = new ParticleSystem.Particle[pe.maxParticles];

int maxParticles = pe.maxParticles;


// This line (and the one that does the oposite at the end) is actally the slowest part of the whole function
Profiler.BeginSample("GetParticles");
int numParticlesAlive = pe.GetParticles(particles);
Expand All @@ -369,13 +367,13 @@ public void EmitterOnUpdate(Vector3 emitterWorldVelocity)
Profiler.BeginSample("Loop");

//Step through all the particles:
for (int j = 0; j < maxParticles; j++)
for (int j = 0; j < numParticlesAlive; j++)
{
ParticleSystem.Particle particle = particles[j];

//Profiler.BeginSample("Cull");
// Check if we need to cull the number of particles
if (SmokeScreenConfig.particleDecimate != 0 && maxParticles > SmokeScreenConfig.decimateFloor)
if (SmokeScreenConfig.particleDecimate != 0 && numParticlesAlive > SmokeScreenConfig.decimateFloor)
{
SmokeScreenConfig.particleCounter++;
if ((SmokeScreenConfig.particleDecimate > 0
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Expand Up @@ -34,5 +34,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.3.0")]
[assembly: AssemblyFileVersion("2.7.3.0")]
[assembly: AssemblyVersion("2.7.4.0")]
[assembly: AssemblyFileVersion("2.7.4.0")]

0 comments on commit 3056a94

Please sign in to comment.