diff --git a/OgreMain/include/Ogre.i b/OgreMain/include/Ogre.i index 021129f07ee..d69a2aa44b0 100644 --- a/OgreMain/include/Ogre.i +++ b/OgreMain/include/Ogre.i @@ -666,6 +666,10 @@ SHARED_PTR(HardwarePixelBuffer); typedef pointer_category category; static const char* type_name() { return "Ogre::Camera"; } }; + template<> struct traits { + typedef pointer_category category; + static const char* type_name() { return "Ogre::StaticGeometry"; } + }; } %} #endif @@ -884,6 +888,7 @@ SHARED_PTR(Mesh); %newobject Ogre::SceneManager::createRayQuery(const Ray&); %rename(SceneManager_Listener) Ogre::SceneManager::Listener; %template(MovableObjectMap) std::map; +%template(StaticGeometryMap) std::map; %template(CameraMap) std::map; %include "OgreSceneManager.h" %include "OgreDefaultDebugDrawer.h" diff --git a/OgreMain/include/OgreSceneManager.h b/OgreMain/include/OgreSceneManager.h index 6c1d6f06c62..a799d4a4402 100644 --- a/OgreMain/include/OgreSceneManager.h +++ b/OgreMain/include/OgreSceneManager.h @@ -405,6 +405,7 @@ namespace Ogre { typedef std::map CameraList; typedef std::map AnimationList; typedef std::map MovableObjectMap; + typedef std::map StaticGeometryMap; private: HardwareVertexBufferPtr mInstanceBuffer; @@ -421,8 +422,7 @@ namespace Ogre { /// Queue of objects for rendering std::unique_ptr mRenderQueue; - typedef std::map StaticGeometryList; - StaticGeometryList mStaticGeometryList; + StaticGeometryMap mStaticGeometryList; typedef std::map InstanceManagerMap; InstanceManagerMap mInstanceManagerMap; @@ -2979,6 +2979,8 @@ namespace Ogre { StaticGeometry* getStaticGeometry(const String& name) const; /** Returns whether a static geometry instance with the given name exists. */ bool hasStaticGeometry(const String& name) const; + /** Returns all static geometry instances with names. */ + const StaticGeometryMap* getStaticGeometryCollection() const; /** Remove & destroy a StaticGeometry instance. */ void destroyStaticGeometry(StaticGeometry* geom); /** Remove & destroy a StaticGeometry instance. */ diff --git a/OgreMain/src/OgreSceneManager.cpp b/OgreMain/src/OgreSceneManager.cpp index 359c08a7da4..f76a082501a 100644 --- a/OgreMain/src/OgreSceneManager.cpp +++ b/OgreMain/src/OgreSceneManager.cpp @@ -2948,7 +2948,7 @@ StaticGeometry* SceneManager::createStaticGeometry(const String& name) //--------------------------------------------------------------------- StaticGeometry* SceneManager::getStaticGeometry(const String& name) const { - StaticGeometryList::const_iterator i = mStaticGeometryList.find(name); + StaticGeometryMap::const_iterator i = mStaticGeometryList.find(name); if (i == mStaticGeometryList.end()) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, @@ -2963,6 +2963,12 @@ bool SceneManager::hasStaticGeometry(const String& name) const return (mStaticGeometryList.find(name) != mStaticGeometryList.end()); } +//----------------------------------------------------------------------- +const SceneManager::StaticGeometryMap* SceneManager:: getStaticGeometryCollection() const +{ + return &mStaticGeometryList; +} + //--------------------------------------------------------------------- void SceneManager::destroyStaticGeometry(StaticGeometry* geom) { @@ -2971,7 +2977,7 @@ void SceneManager::destroyStaticGeometry(StaticGeometry* geom) //--------------------------------------------------------------------- void SceneManager::destroyStaticGeometry(const String& name) { - StaticGeometryList::iterator i = mStaticGeometryList.find(name); + StaticGeometryMap::iterator i = mStaticGeometryList.find(name); if (i != mStaticGeometryList.end()) { OGRE_DELETE i->second;