MCPcopy Create free account
hub / github.com/carbonengine/trinity / NormalDistribution

Function NormalDistribution

trinity/PostProcess/Tr2PostProcessRenderer.cpp:222–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220{
221
222float NormalDistribution( float x, float sigma, float weight )
223{
224 const float dx = std::abs( x );
225 const float clampedOneMinusDX = std::max( 0.0f, 1.0f - ( dx * dx ) );
226
227 if( weight > 1.0f )
228 {
229 return std::pow( clampedOneMinusDX, weight );
230 }
231 const float gaussian = std::exp( -TRI_PI * 5.0f * ( ( dx * dx ) / ( sigma * sigma ) ) );
232 return Lerp( gaussian, clampedOneMinusDX, weight );
233}
234
235GaussianData CalculateGaussianPassParameters( float radius, float centerWeight, float normalizingFactor, Vector3 overallWeight, Vector2 direction )
236{

Callers 1

Calls 1

LerpFunction · 0.85

Tested by

no test coverage detected