MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / RenderSky

Method RenderSky

SampleFramework12/v1.00/Graphics/Skybox.cpp:435–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433#if EnableSkyModel_
434
435void Skybox::RenderSky(ID3D12GraphicsCommandList* cmdList, const Float4x4& view,
436 const Float4x4& projection, const SkyCache& skyCache,
437 bool enableSun, const Float3& scale)
438{
439 PIXMarker pixEvent(cmdList, "Skybox Render Sky");
440
441 Assert_(skyCache.Initialized());
442
443 // Set the pixel shader constants
444 psConstantBuffer.Data.SunDirection = skyCache.SunDirection;
445 psConstantBuffer.Data.Scale = scale;
446 if(enableSun)
447 {
448 Float3 sunColor = skyCache.SunRadiance;
449 float maxComponent = Max(sunColor.x, Max(sunColor.y, sunColor.z));
450 if(maxComponent > FP16Max)
451 sunColor *= (FP16Max / maxComponent);
452 psConstantBuffer.Data.SunColor = Float3::Clamp(sunColor, 0.0f, FP16Max);
453 psConstantBuffer.Data.CosSunAngularRadius = std::cos(DegToRad(skyCache.SunSize));
454 }
455 else
456 {
457 psConstantBuffer.Data.SunColor = 0.0f;
458 psConstantBuffer.Data.CosSunAngularRadius = 0.0f;
459 }
460
461 RenderCommon(cmdList, &skyCache.CubeMap, view, projection, scale);
462}
463
464#endif // EnableSkyModel_
465

Callers 2

RenderForwardMethod · 0.80
RenderDeferredMethod · 0.80

Calls 4

MaxFunction · 0.85
ClampFunction · 0.85
DegToRadFunction · 0.85
InitializedMethod · 0.45

Tested by

no test coverage detected