40 #ifndef _graphicsscenemanager_cpp
41 #define _graphicsscenemanager_cpp
43 #include "Graphics/cameramanager.h"
44 #include "Graphics/scenemanager.h"
46 #include "Physics/physicsmanager.h"
48 #include "UI/uimanager.h"
50 #include "areaeffectmanager.h"
52 #include "worldobject.h"
53 #include "stringtool.h"
133 String FreshSkyMaterialName =
"",
135 String FreshSkyMaterialGroupName =
"",
136 bool FreshSkyDrawnFirst =
false,
170 Ogre::Root::getSingleton().destroySceneManager(
OgreManager);
178 ThreadResources(NULL)
181 this->
SMD->
OgreManager = Ogre::Root::getSingleton().createSceneManager(InternalManagerTypeName);
188 ThreadResources(NULL)
196 if(!ManagerType.
Empty())
199 if(!CurrAttrib.
Empty())
200 ManagerName = CurrAttrib.
AsString();
202 if(ManagerName.empty())
203 ManagerName =
"Default";
204 this->
SMD->
OgreManager = Ogre::Root::getSingleton().createSceneManager(ManagerName+
"SceneManager");
207 bool TextureShadows =
false;
209 if(!ShadowSettings.
Empty())
213 if(!CurrAttrib.
Empty())
215 TechniqueName = CurrAttrib.
AsString();
216 if(
"StencilModulative" == TechniqueName )
218 else if(
"StencilAdditive" == TechniqueName )
220 else if(
"TextureModulative" == TechniqueName )
222 else if(
"TextureAdditive" == TechniqueName )
224 else if(
"TextureAdditiveIntegrated" == TechniqueName )
226 else if(
"TextureModulativeIntegrated" == TechniqueName )
230 if(!TechniqueName.empty())
232 if(String::npos != TechniqueName.find(
"Texture"))
233 TextureShadows =
true;
235 CurrAttrib = ShadowSettings.
GetAttribute(
"ShadowColour");
239 CurrAttrib = ShadowSettings.
GetAttribute(
"ShadowFarDistance");
247 if(!TextureShadowSettings.
Empty() && TextureShadows)
249 CurrAttrib = TextureShadowSettings.
GetAttribute(
"ShadowTextureCount");
250 if(!CurrAttrib.
Empty())
253 CurrAttrib = TextureShadowSettings.
GetAttribute(
"ShadowTextureSize");
254 if(!CurrAttrib.
Empty())
271 Ogre::ShadowTechnique Type;
275 Type = Ogre::SHADOWTYPE_STENCIL_MODULATIVE;
278 Type = Ogre::SHADOWTYPE_STENCIL_ADDITIVE;
281 Type = Ogre::SHADOWTYPE_TEXTURE_MODULATIVE;
284 Type = Ogre::SHADOWTYPE_TEXTURE_ADDITIVE;
287 Type = Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED;
290 Type = Ogre::SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED;
293 Type = Ogre::SHADOWTYPE_NONE;
300 Ogre::ShadowTechnique ShadowType = this->
SMD->
OgreManager->getShadowTechnique();
303 case Ogre::SHADOWTYPE_STENCIL_MODULATIVE:
306 case Ogre::SHADOWTYPE_STENCIL_ADDITIVE:
309 case Ogre::SHADOWTYPE_TEXTURE_MODULATIVE:
312 case Ogre::SHADOWTYPE_TEXTURE_ADDITIVE:
315 case Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED:
318 case Ogre::SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED:
363 this->
SMD->
OgreManager->setSkyPlane(
true, SkyPlane_.
GetOgrePlane(), Material, Scale, Tiling, DrawFirst, Bow, XSegments, YSegments, Group);
384 Quaternion Orientation,
int XSegments,
int YSegments)
388 this->
SMD->
OgreManager->setSkyDome(
true, Material, Curvature, Tiling, Distance, DrawFirst, Orientation.
GetOgreQuaternion(), XSegments, YSegments, -1, Group);
411 this->
Proxies.push_back(NewProxy);
418 this->
Proxies.push_back(NewProxy);
425 this->
Proxies.push_back(NewProxy);
432 this->
Proxies.push_back(NewProxy);
439 this->
Proxies.push_back(NewProxy);
446 this->
Proxies.push_back(NewProxy);
453 this->
Proxies.push_back(NewProxy);
460 this->
Proxies.push_back(NewProxy);
467 this->
Proxies.push_back(NewProxy);
474 this->
Proxies.push_back(NewProxy);
481 this->
Proxies.push_back(NewProxy);
489 {
return this->
Proxies.at(Index); }
492 {
return this->
Proxies.size(); }
498 if( ToBeDestroyed == (*ProxIt) ) {
499 WorldObject* Parent = (*ProxIt)->GetParentObject();
514 WorldObject* Parent = (*ProxIt)->GetParentObject();
528 this->
SMD->
OgreManager->setAmbientLight(Ogre::ColourValue(Red, Green, Blue, Alpha));
551 if( (*it)->GetProxyType() == Mezzanine::PT_Graphics_ParticleSystemProxy )
552 static_cast<ParticleSystemProxy*>( (*it) )->PauseParticleSystem(Pause);
596 {
return ManagerBase::MT_SceneManager; }
599 {
return "DefaultSceneManager"; }
608 {
return this->
SMD; }
623 return "DefaultSceneManager";
631 String InternalManagerTypeName;
632 for( NameValuePairList::iterator ParIt = Params.begin() ; ParIt != Params.end() ; ++ParIt )
634 String Lower = (*ParIt).first;
636 if(
"internalmanagertypename" == Lower )
638 InternalManagerTypeName = (*ParIt).second;
652 delete ToBeDestroyed;
661 stream <<
"<SceneManager Version=\"1\" Name=\"" << Ev.
GetName()
667 <<
"\" SkyMethod=\"" << Ev.
WhichSky()
679 Ogre::SceneManager::SkyPlaneGenParameters Values=SMD->
OgreManager->getSkyPlaneGenParameters();
680 stream <<
"<SkyPlane Version=\"1"
684 <<
"\" Scale=\"" << Values.skyPlaneScale
685 <<
"\" Tiling=\"" << Values.skyPlaneTiling
686 <<
"\" Bow=\"" << Values.skyPlaneBow
687 <<
"\" XSegments=\"" << Values.skyPlaneXSegments
688 <<
"\" YSegments=\"" << Values.skyPlaneYSegments
696 Ogre::SceneManager::SkyBoxGenParameters Values = SMD->
OgreManager->getSkyBoxGenParameters();
697 stream <<
"<SkyBox Version=\"1"
701 <<
"\" Distance=\"" << Values.skyBoxDistance
709 Ogre::SceneManager::SkyDomeGenParameters Values=SMD->
OgreManager->getSkyDomeGenParameters();
710 stream <<
"<SkyDome Version=\"1"
714 <<
"\" Distance=\"" << Values.skyDomeDistance
715 <<
"\" Curvature=\"" << Values.skyDomeCurvature
716 <<
"\" Tiling=\"" << Values.skyDomeTiling
717 <<
"\" XSegments=\"" << Values.skyDomeXSegments
718 <<
"\" YSegments=\"" << Values.skyDomeYSegments
719 <<
"\" YSegments_keep=\"" << Values.skyDomeYSegments_keep
728 stream <<
"</SceneManager>";
756 Doc->GetFirstChild() >> Ev;
785 Child.GetFirstChild() >> AllAroundUs;
800 if(Child.GetFirstChild())
805 Child.GetFirstChild() >> InTheShade;
820 if(Child.GetAttribute(
"Version").AsInt() == 1)
825 Child.GetFirstChild().GetFirstChild() >> Orientation;
829 Ev.
CreateSkyBox( Child.GetAttribute(
"MaterialName").AsString(),
830 Child.GetAttribute(
"MaterialGroupName").AsString(),
831 Child.GetAttribute(
"Distance").AsReal(),
832 Child.GetAttribute(
"DrawFirst").AsBool(),
844 if(Child.GetAttribute(
"Version").AsInt() == 1)
849 Child.GetFirstChild().GetFirstChild() >> Orientation;
853 Ev.
CreateSkyDome( Child.GetAttribute(
"MaterialName").AsString(),
854 Child.GetAttribute(
"MaterialGroupName").AsString(),
855 Child.GetAttribute(
"Distance").AsReal(),
856 Child.GetAttribute(
"Curvature").AsReal(),
857 Child.GetAttribute(
"Tiling").AsReal(),
858 Child.GetAttribute(
"DrawFirst").AsBool(),
860 Child.GetAttribute(
"XSegments").AsInt(),
861 Child.GetAttribute(
"YSegments").AsInt());
874 Child.GetFirstChild() >> SkyOrientation;
876 if(Child.GetAttribute(
"Version").AsInt() == 1)
879 Child.GetAttribute(
"MaterialName").AsString(),
880 Child.GetAttribute(
"MaterialGroupName").AsString(),
881 Child.GetAttribute(
"Scale").AsReal(),
882 Child.GetAttribute(
"Tiling").AsReal(),
883 Child.GetAttribute(
"DrawFirst").AsBool(),
884 Child.GetAttribute(
"Bow").AsBool(),
885 Child.GetAttribute(
"XSegments").AsInt(),
886 Child.GetAttribute(
"YSegments").AsInt());