Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/SkyManager.cpp
Show First 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | std::vector<CStrW> SkyManager::GetSkySets() const | ||||
return skies; | return skies; | ||||
} | } | ||||
void SkyManager::RenderSky( | void SkyManager::RenderSky( | ||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext) | Renderer::Backend::IDeviceCommandContext* deviceCommandContext) | ||||
{ | { | ||||
GPU_SCOPED_LABEL(deviceCommandContext, "Render sky"); | GPU_SCOPED_LABEL(deviceCommandContext, "Render sky"); | ||||
if (!m_SkyVisible) | const CTexturePtr& skyTextureCube = | ||||
return; | !m_SkyVisible || m_SkySet.empty() || !m_SkyTextureCube | ||||
? g_Renderer.GetTextureManager().GetBlackTextureCube() | |||||
// Do nothing unless SetSkySet was called | : m_SkyTextureCube; | ||||
if (m_SkySet.empty() || !m_SkyTextureCube) | |||||
return; | |||||
const CCamera& camera = g_Renderer.GetSceneRenderer().GetViewCamera(); | const CCamera& camera = g_Renderer.GetSceneRenderer().GetViewCamera(); | ||||
CShaderTechniquePtr skytech = | CShaderTechniquePtr skytech = | ||||
g_Renderer.GetShaderManager().LoadEffect(str_sky_simple); | g_Renderer.GetShaderManager().LoadEffect(str_sky_simple); | ||||
deviceCommandContext->SetGraphicsPipelineState( | deviceCommandContext->SetGraphicsPipelineState( | ||||
skytech->GetGraphicsPipelineStateDesc()); | skytech->GetGraphicsPipelineStateDesc()); | ||||
deviceCommandContext->BeginPass(); | deviceCommandContext->BeginPass(); | ||||
Renderer::Backend::IShaderProgram* shader = skytech->GetShader(); | Renderer::Backend::IShaderProgram* shader = skytech->GetShader(); | ||||
deviceCommandContext->SetTexture( | deviceCommandContext->SetTexture( | ||||
shader->GetBindingSlot(str_baseTex), m_SkyTextureCube->GetBackendTexture()); | shader->GetBindingSlot(str_baseTex), skyTextureCube->GetBackendTexture()); | ||||
// Translate so the sky center is at the camera space origin. | // Translate so the sky center is at the camera space origin. | ||||
CMatrix3D translate; | CMatrix3D translate; | ||||
translate.SetTranslation(camera.GetOrientation().GetTranslation()); | translate.SetTranslation(camera.GetOrientation().GetTranslation()); | ||||
// Currently we have a hardcoded near plane in the projection matrix. | // Currently we have a hardcoded near plane in the projection matrix. | ||||
CMatrix3D scale; | CMatrix3D scale; | ||||
scale.SetScaling(10.0f, 10.0f, 10.0f); | scale.SetScaling(10.0f, 10.0f, 10.0f); | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator