MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetLayerValue

Function GetLayerValue

Source/Engine/Renderer/AtmospherePreCompute.cpp:316–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316void GetLayerValue(int32 layer, float& atmosphereR, Float4& dhdh)
317{
318 float r = layer / Math::Max<float>(InscatterAltitudeSampleNum - 1.0f, 1.0f);
319 r = r * r;
320 r = Math::Sqrt(RadiusGround * RadiusGround + r * (RadiusAtmosphere * RadiusAtmosphere - RadiusGround * RadiusGround)) + (layer == 0 ? 0.01f : (layer == InscatterAltitudeSampleNum - 1 ? -0.001f : 0.0f));
321 const float dMin = RadiusAtmosphere - r;
322 const float dMax = Math::Sqrt(r * r - RadiusGround * RadiusGround) + Math::Sqrt(RadiusAtmosphere * RadiusAtmosphere - RadiusGround * RadiusGround);
323 const float dMinP = r - RadiusGround;
324 const float dMaxP = Math::Sqrt(r * r - RadiusGround * RadiusGround);
325 atmosphereR = r;
326 dhdh = Float4(dMin, dMax, dMinP, dMaxP);
327}
328
329void AtmospherePreComputeImpl::Render(RenderTask* task, GPUContext* context)
330{

Callers 1

RenderMethod · 0.85

Calls 2

Float4Class · 0.85
SqrtFunction · 0.50

Tested by

no test coverage detected