| 433 | #if EnableSkyModel_ |
| 434 | |
| 435 | void 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 |
no test coverage detected