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

Method setupResources

Source/Engine/Renderer/ReflectionsPass.cpp:187–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187bool ReflectionsPass::setupResources()
188{
189 // Wait for the assets
190 if (!_sphereModel->CanBeRendered() || !_boxModel->CanBeRendered() || !_preIntegratedGF->IsLoaded() || !_shader->IsLoaded())
191 return true;
192 const auto shader = _shader->GetShader();
193 CHECK_INVALID_SHADER_PASS_CB_SIZE(shader, 0, Data);
194
195 // Create pipeline stages
196 GPUPipelineState::Description psDesc;
197 if (!_psProbe->IsValid())
198 {
199 psDesc = GPUPipelineState::Description::DefaultNoDepth;
200 psDesc.BlendMode = BlendingMode::AlphaBlend;
201 psDesc.VS = shader->GetVS("VS_Model");
202 psDesc.PS = shader->GetPS("PS_EnvProbe");
203 psDesc.CullMode = CullMode::Normal;
204 psDesc.DepthEnable = true;
205 psDesc.DepthBoundsEnable = _depthBounds;
206 if (_psProbe->Init(psDesc))
207 return true;
208 psDesc.DepthFunc = ComparisonFunc::Always;
209 psDesc.CullMode = CullMode::Inverted;
210 if (_psProbeInside->Init(psDesc))
211 return true;
212 }
213 psDesc = GPUPipelineState::Description::DefaultFullscreenTriangle;
214 if (!_psCombinePass->IsValid())
215 {
216 psDesc.BlendMode = BlendingMode::Add;
217 psDesc.BlendMode.RenderTargetWriteMask = BlendingMode::ColorWrite::RGB;
218 if (_depthBounds)
219 {
220 psDesc.DepthEnable = psDesc.DepthBoundsEnable = true;
221 psDesc.DepthWriteEnable = false;
222 }
223 psDesc.PS = shader->GetPS("PS_CombinePass");
224 if (_psCombinePass->Init(psDesc))
225 return true;
226 }
227
228 return false;
229}
230
231void ReflectionsPass::Dispose()
232{

Callers

nothing calls this directly

Calls 5

IsLoadedMethod · 0.45
GetShaderMethod · 0.45
IsValidMethod · 0.45
GetPSMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected