Project

General

Profile

SO3Engine
SO3ShadowDeferred.cpp
Go to the documentation of this file.
1
9
10#ifdef SO3_BUILD_DEFERRED
11namespace SO3
12{
13
14SShadowDeferred::SShadowDeferred() : SShadow(0, "", SShadowManager::SO3_SHADOWS_DEFERRED)
15{
16}
17
18SShadowDeferred::SShadowDeferred(SShadowManager* sManager) : SShadow(sManager, "DEFERRED", SShadowManager::SO3_SHADOWS_DEFERRED)
19{
20 Ogre::FocusedShadowCameraSetup* shadowCameraSetup = new Ogre::FocusedShadowCameraSetup();
21 //shadowCameraSetup->setCameraLightDirectionThreshold(Ogre::Degree(5));
22 //shadowCameraSetup->setOptimalAdjustFactor(5);
23 SetCameraSetup(Ogre::ShadowCameraSetupPtr(shadowCameraSetup));
24
25 ogreScene->setShadowTechnique(static_cast <Ogre::ShadowTechnique> (Ogre::SHADOWDETAILTYPE_TEXTURE | Ogre::SHADOWDETAILTYPE_INTEGRATED | shadowManager->GetLightingTechnique()));
26
27 ogreScene->setShadowTextureCount(1);
28 //Use a value of "2" to use a different depth buffer pool and avoid sharing this with the Backbuffer's
29 ogreScene->setShadowTextureConfig(0, sManager->GetTextureSize(), sManager->GetTextureSize(), Ogre::PF_FLOAT16_R, 2);
30 //ogreScene->setShadowTexturePixelFormat(Ogre::PF_FLOAT16_R);
31 ogreScene->setShadowTextureSelfShadow(true);
32 ogreScene->setShadowCasterRenderBackFaces(false);
33 //ogreScene->setShadowTextureFSAA(2.0);
34
35 // Set up caster material
36 ogreScene->setShadowTextureCasterMaterial("SO3/Deferred/Shadows/Caster");
37 ogreScene->setShadowTextureReceiverMaterial("");
38
39 // Disable fog on the caster pass.
40 Ogre::MaterialPtr passCaterMaterial = currentScene->O3MaterialManager->getByName("SO3/Deferred/Shadows/Caster");
41 Ogre::Pass* deferredCasterPass = passCaterMaterial->getTechnique(0)->getPass(0);
42 deferredCasterPass->setFog(true);
43}
44
46{
47 ogreScene->setShadowTextureCasterMaterial("");
48 ogreScene->setShadowTextureReceiverMaterial("");
49 ogreScene->setShadowTextureCount(1);
50 ogreScene->setShadowTexturePixelFormat(Ogre::PF_X8R8G8B8);
51 ogreScene->setShadowCasterRenderBackFaces(false);
52 ogreScene->setShadowTextureSelfShadow(false);
53}
54
55
57{
58 Ogre::ShadowTechnique newTechnique = static_cast <Ogre::ShadowTechnique> (Ogre::SHADOWDETAILTYPE_TEXTURE | shadowManager->GetLightingTechnique());
59 ogreScene->setShadowTechnique(newTechnique);
60}
61}
62
63#endif //SO3_BUILD_DEFERRED
Ogre::MaterialManager * O3MaterialManager
Definition SO3Scene.h:129
virtual void UpdateShadowTechnique()
SShadowManager * shadowManager
Definition SO3Shadow.h:75
Ogre::SceneManager * ogreScene
Definition SO3Shadow.h:74
void SetCameraSetup(Ogre::ShadowCameraSetupPtr shadowCameraSetup)
Definition SO3Shadow.cpp:57
SScene * currentScene
Definition SO3Shadow.h:73
ShadowLightingType GetLightingTechnique()
Abstract class defining a shadow rendering technique. .