/** Renders the scene with the given view-proj-matrices */ void D3D11PointLight::RenderCubemapFace(const D3DXMATRIX& view, const D3DXMATRIX& proj, UINT faceIdx) { D3D11GraphicsEngineBase* engineBase = (D3D11GraphicsEngineBase *)Engine::GraphicsEngine; D3D11GraphicsEngine* engine = (D3D11GraphicsEngine *) engineBase; // TODO: Remove and use newer system! CameraReplacement cr; cr.PositionReplacement = LightInfo->Vob->GetPositionWorld(); cr.ProjectionReplacement = proj; cr.ViewReplacement = view; // Replace gothics camera Engine::GAPI->SetCameraReplacementPtr(&cr); if(engine->GetDummyCubeRT()) engine->GetContext()->ClearRenderTargetView(engine->GetDummyCubeRT()->GetRTVCubemapFace(faceIdx), (float *)&float4(0,0,0,0)); // Disable shadows for NPCs // TODO: Only for the player himself, because his shadows look ugly when using a torch bool oldDrawSkel = Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes; //Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes = false; float range = LightInfo->Vob->GetLightRange() * 1.1f; // Draw cubemap face ID3D11RenderTargetView* debugRTV = engine->GetDummyCubeRT() != NULL ? engine->GetDummyCubeRT()->GetRTVCubemapFace(faceIdx) : NULL; engine->RenderShadowCube(cr.PositionReplacement, range, DepthCubemap, DepthCubemap->GetDSVCubemapFace(faceIdx), debugRTV, false); //Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes = oldDrawSkel; // Reset settings Engine::GAPI->SetCameraReplacementPtr(NULL); }
/** Renders all cubemap faces at once, using the geometry shader */ void D3D11PointLight::RenderFullCubemap() { D3D11GraphicsEngineBase* engineBase = (D3D11GraphicsEngineBase *)Engine::GraphicsEngine; D3D11GraphicsEngine* engine = (D3D11GraphicsEngine *) engineBase; // TODO: Remove and use newer system! // Disable shadows for NPCs // TODO: Only for the player himself, because his shadows look ugly when using a torch bool oldDrawSkel = Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes; //Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes = false; float range = LightInfo->Vob->GetLightRange() * 1.1f; // Draw no npcs if this is a static light. This is archived by simply not drawing them in the first update bool noNPCs = !DrawnOnce;//!LightInfo->Vob->IsStatic(); // Draw cubemap std::map<MeshKey, WorldMeshInfo*, cmpMeshKey>* wc = &WorldMeshCache; // Don't use the cache if we have moved if(WorldCacheInvalid) wc = NULL; engine->RenderShadowCube(LightInfo->Vob->GetPositionWorld(), range, DepthCubemap, NULL, NULL, false, LightInfo->IsIndoorVob, noNPCs, &VobCache, &SkeletalVobCache, wc); //Engine::GAPI->GetRendererState()->RendererSettings.DrawSkeletalMeshes = oldDrawSkel; }