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

Method Draw

Source/Engine/Level/Actors/ExponentialHeightFog.cpp:34–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void 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
70void ExponentialHeightFog::Serialize(SerializeStream& stream, const void* otherObj)
71{

Callers

nothing calls this directly

Calls 8

EnumHasAnyFlagsFunction · 0.85
CreatePipelineStatesMethod · 0.80
ToStringFunction · 0.50
IsLoadedMethod · 0.45
IsValidMethod · 0.45
CreateMethod · 0.45
GetShaderMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected