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

Method ApplySky

Source/Engine/Level/Actors/Sky.cpp:169–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void Sky::ApplySky(GPUContext* context, RenderContext& renderContext, const Matrix& world)
170{
171 // Get precomputed cache and bind it to the pipeline
172 AtmosphereCache cache;
173 if (!AtmospherePreCompute::GetCache(&cache))
174 return;
175 context->BindSR(4, cache.Transmittance);
176 context->BindSR(5, cache.Irradiance);
177 context->BindSR(6, cache.Inscatter->ViewVolume());
178
179 // Setup constants data
180 Matrix m;
181 Data data;
182 Matrix::Multiply(world, renderContext.View.ViewProjection(), m);
183 Matrix::Transpose(m, data.WorldViewProjection);
184 Matrix::Transpose(renderContext.View.IVP, data.InvViewProjection);
185 GBufferPass::SetInputs(renderContext.View, data.GBuffer);
186 data.ViewOffset = renderContext.View.Origin + GetPosition();
187 data.NoiseScale = renderContext.View.IsSingleFrame ? 0.01f : 0.03f;
188 InitConfig(data.Fog);
189 //data.Fog.AtmosphericFogSunPower *= SunLight ? SunLight->Brightness : 1.0f;
190 if (EnumHasNoneFlags(renderContext.View.Flags, ViewFlags::SpecularLight))
191 {
192 // Hide sun disc if specular light is disabled
193 data.Fog.AtmosphericFogSunDiscScale = 0;
194 }
195
196 // Bind pipeline
197 auto cb = _shader->GetShader()->GetCB(0);
198 context->UpdateCB(cb, &data);
199 context->BindCB(0, cb);
200 context->SetState(_psSky);
201}
202
203void Sky::EndPlay()
204{

Callers 2

FillMethod · 0.45
DrawSkyMethod · 0.45

Calls 12

GetCacheFunction · 0.85
InitConfigFunction · 0.85
EnumHasNoneFlagsFunction · 0.85
MultiplyFunction · 0.50
TransposeFunction · 0.50
GetPositionFunction · 0.50
BindSRMethod · 0.45
ViewVolumeMethod · 0.45
GetShaderMethod · 0.45
UpdateCBMethod · 0.45
BindCBMethod · 0.45
SetStateMethod · 0.45

Tested by

no test coverage detected