| 84 | } |
| 85 | |
| 86 | void Sky::Draw(RenderContext& renderContext) |
| 87 | { |
| 88 | if (HasContentLoaded() && EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Sky)) |
| 89 | { |
| 90 | // Ensure to have pipeline state cache created |
| 91 | if (_psSky == nullptr) |
| 92 | { |
| 93 | const auto shader = _shader->GetShader(); |
| 94 | |
| 95 | // Create pipeline states |
| 96 | if (_psSky == nullptr) |
| 97 | { |
| 98 | _psSky = GPUDevice::Instance->CreatePipelineState(); |
| 99 | |
| 100 | GPUPipelineState::Description psDesc = GPUPipelineState::Description::Default; |
| 101 | psDesc.VS = shader->GetVS("VS"); |
| 102 | psDesc.PS = shader->GetPS("PS_Sky"); |
| 103 | psDesc.CullMode = CullMode::Inverted; |
| 104 | psDesc.DepthWriteEnable = false; |
| 105 | psDesc.DepthClipEnable = false; |
| 106 | psDesc.DepthFunc = ComparisonFunc::LessEqual; |
| 107 | |
| 108 | if (_psSky->Init(psDesc)) |
| 109 | { |
| 110 | LOG(Warning, "Cannot create graphics pipeline state object for '{0}'.", ToString()); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // Register for the sky and fog pass |
| 116 | renderContext.List->Sky = this; |
| 117 | //if(renderContext.View.Flags & ViewFlags::Fog) != 0) |
| 118 | //renderContext.List->AtmosphericFog = this; // TODO: finish atmosphere fog |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void Sky::Serialize(SerializeStream& stream, const void* otherObj) |
| 123 | { |
nothing calls this directly
no test coverage detected