Skip to content

Commit

Permalink
implement dists
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle committed Feb 26, 2025
1 parent 6587932 commit 52226af
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ private Func<float> GetGeneratorFloat(float low, float high, ParticlePropertyTyp
return () => high;
case ParticlePropertyType.RandomUniform:
return () => random.NextFloat(low, high);
case ParticlePropertyType.RandomNormal:

Check failure on line 88 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomNormal'

Check failure on line 88 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomNormal'
return () => (float) Math.Clamp(random.NextGaussian((low+high)/2, (high-low)/6), low, high);
case ParticlePropertyType.RandomLinear:

Check failure on line 90 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomLinear'

Check failure on line 90 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomLinear'
return () => MathF.Sqrt(random.NextFloat(0, 1)) * (high - low) + low;
case ParticlePropertyType.RandomSquare:

Check failure on line 92 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomSquare'

Check failure on line 92 in OpenDreamClient/Rendering/ClientDreamParticlesSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParticlePropertyType' does not contain a definition for 'RandomSquare'
return () => MathF.Cbrt(random.NextFloat(0, 1)) * (high - low) + low;
default:
throw new NotImplementedException();
}
Expand All @@ -94,21 +100,17 @@ private Func<Vector2> GetGeneratorVector2(Vector2 low, Vector2 high, ParticlePro
switch (type) {
case ParticlePropertyType.HighValue:
return () => high;
case ParticlePropertyType.RandomUniform:
return () => new Vector2(random.NextFloat(low.X, high.X), random.NextFloat(low.Y, high.Y));
default:
throw new NotImplementedException();
return () => new Vector2(GetGeneratorFloat(low.X, high.X, type)(), GetGeneratorFloat(low.Y, high.Y, type)());
}
}

private Func<Vector3> GetGeneratorVector3(Vector3 low, Vector3 high, ParticlePropertyType type){
switch (type) {
case ParticlePropertyType.HighValue:
return () => high;
case ParticlePropertyType.RandomUniform:
return () => new Vector3(random.NextFloat(low.X, high.X), random.NextFloat(low.Y, high.Y), random.NextFloat(low.Z, high.Z));
default:
throw new NotImplementedException();
return () => new Vector3(GetGeneratorFloat(low.X, high.X, type)(), GetGeneratorFloat(low.Y, high.Y, type)(), GetGeneratorFloat(low.Z, high.Z, type)());
}
}
}

0 comments on commit 52226af

Please # to comment.