| 32 | } |
| 33 | |
| 34 | void ExponentialHeightFog::Draw(RenderContext& renderContext) |
| 35 | { |
| 36 | // Render only when shader is valid and fog can be rendered |
| 37 | // Do not render exponential fog in orthographic views |
| 38 | if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Fog) |
| 39 | && EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer) |
| 40 | && _shader |
| 41 | && _shader->IsLoaded() |
| 42 | && renderContext.View.IsPerspectiveProjection()) |
| 43 | { |
| 44 | if (_psFog.States[0] == nullptr) |
| 45 | _psFog.CreatePipelineStates(); |
| 46 | if (!_psFog.States[0]->IsValid()) |
| 47 | { |
| 48 | GPUPipelineState::Description psDesc = GPUPipelineState::Description::DefaultFullscreenTriangle; |
| 49 | psDesc.DepthWriteEnable = false; |
| 50 | psDesc.BlendMode.BlendEnable = true; |
| 51 | psDesc.BlendMode.SrcBlend = BlendingMode::Blend::One; |
| 52 | psDesc.BlendMode.DestBlend = BlendingMode::Blend::SrcAlpha; |
| 53 | psDesc.BlendMode.BlendOp = BlendingMode::Operation::Add; |
| 54 | psDesc.BlendMode.SrcBlendAlpha = BlendingMode::Blend::One; |
| 55 | psDesc.BlendMode.DestBlendAlpha = BlendingMode::Blend::Zero; |
| 56 | psDesc.BlendMode.BlendOpAlpha = BlendingMode::Operation::Add; |
| 57 | psDesc.BlendMode.RenderTargetWriteMask = BlendingMode::ColorWrite::RGB; |
| 58 | if (_psFog.Create(psDesc, _shader->GetShader(), "PS_Fog")) |
| 59 | { |
| 60 | LOG(Warning, "Cannot create graphics pipeline state object for '{0}'.", ToString()); |
| 61 | return; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // Register for Fog Pass |
| 66 | renderContext.List->Fog.Init(renderContext.View, this); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | void ExponentialHeightFog::Serialize(SerializeStream& stream, const void* otherObj) |
| 71 | { |
nothing calls this directly
no test coverage detected