void SkyLight::SetCastShadow(const bool& bCast) { Light::SetCastShadow(bCast); if(m_pMaterial) { m_pMaterial->SetCurrentTech(bCast ? "with_shadow" : "with_no_shadow"); } if(bCast && m_pShadowMap == nullptr) { ResizeShadowMap(); } if(bCast == false && m_pShadowMap != nullptr) { m_pShadowMap->Release(); m_pShadowMap.reset(); } }
bool SkyLight::Create(RenderManagerPtr pRenderManager) { m_pRenderManager = pRenderManager; m_pMaterial = pRenderManager->CreateMaterialFromFile("./assets/standard/material/dr_render_sky_light.material"); if(m_pMaterial == nullptr) { return false; } //m_bCastShadow = true; if(false == m_pMaterial->SetCurrentTech(m_bCastShadow ? "with_shadow" : "with_no_shadow")) { return false; } if(m_bCastShadow) { ResizeShadowMap(); } return true; }
void Light::SetShadowMapSize(uint32 w, uint32 h) { m_shadowMapWidth = w; m_shadowMapHeight = h; ResizeShadowMap(); }