diff --git a/oggsound/include/OgreOggISound.h b/oggsound/include/OgreOggISound.h index b719cea..3787a19 100644 --- a/oggsound/include/OgreOggISound.h +++ b/oggsound/include/OgreOggISound.h @@ -516,7 +516,7 @@ namespace OgreOggSound */ void _getSharedProperties(BufferListPtr& buffers, float& length, ALenum& format); - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 /** Gets name */ virtual Ogre::String getName(); @@ -532,7 +532,7 @@ namespace OgreOggSound */ OgreOggISound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); @@ -581,11 +581,11 @@ namespace OgreOggSound */ virtual void _notifyAttached( Ogre::Node* node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , bool isTagPoint = false #endif ); - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 /** Notifys object its been moved @remarks Overridden from MovableObject. @@ -596,7 +596,7 @@ namespace OgreOggSound */ virtual void _updateRenderQueue(Ogre::RenderQueue *queue, Ogre::Camera *camera, const Ogre::Camera *lodCamera); #endif - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 /** Renderable callback @remarks Overridden function from MovableObject. @@ -683,7 +683,7 @@ namespace OgreOggSound bool mGiveUpSource; // Flag to indicate whether sound should release its source when stopped bool mStream; // Stream flag bool mSourceRelative; // Relative position flag - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 bool mLocalTransformDirty; // Transformation update flag #else Ogre::Vector3 mPosition; // 3D position diff --git a/oggsound/include/OgreOggListener.h b/oggsound/include/OgreOggListener.h index 29a4067..eb2799a 100644 --- a/oggsound/include/OgreOggListener.h +++ b/oggsound/include/OgreOggListener.h @@ -50,24 +50,24 @@ namespace OgreOggSound Creates a listener object to act as the ears of the user. */ OgreOggListener( - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::IdType id, Ogre::SceneManager *scnMgr, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #else Ogre::SceneManager* scnMgr = NULL #endif ): - #if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR > 0 + #if AV_OGRE_NEXT_VERSION >= 0x20100 MovableObject(id, objMemMgr, scnMgr, renderQueueId), #endif mVelocity(Ogre::Vector3::ZERO) - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , mLocalTransformDirty(false) #endif , mSceneMgr(scnMgr) { for (int i=0; i<6; ++i ) mOrientation[i]=0.f; mName = "OgreOggListener"; - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 setLocalAabb(Ogre::Aabb::BOX_NULL); setQueryFlags(0); #endif @@ -107,7 +107,7 @@ namespace OgreOggSound bounding radius for this object. */ virtual float getBoundingRadius(void) const; - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 void _updateRenderQueue(Ogre::RenderQueue *queue) override {} void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables) override {} #else @@ -119,11 +119,11 @@ namespace OgreOggSound */ virtual void _notifyAttached( Ogre::Node* node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , bool isTagPoint = false #endif ); - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 /** Moved callback @remarks Overridden function from MovableObject. @@ -137,7 +137,7 @@ namespace OgreOggSound /** Returns scenemanager which created this listener. */ Ogre::SceneManager* getSceneManager() { return mSceneMgr; } - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 /** Sets scenemanager which created this listener. */ void setSceneManager(Ogre::SceneManager& m) { mSceneMgr=&m; } @@ -153,7 +153,7 @@ namespace OgreOggSound */ Ogre::Vector3 mVelocity; // 3D velocity float mOrientation[6]; // 3D orientation - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::Vector3 mPosition; // 3D position Ogre::Quaternion mOrient; // 3D orientation as Quaternion #else diff --git a/oggsound/include/OgreOggSound.h b/oggsound/include/OgreOggSound.h index ad206d8..26b2b0c 100644 --- a/oggsound/include/OgreOggSound.h +++ b/oggsound/include/OgreOggSound.h @@ -43,7 +43,7 @@ #include "OgreOggSoundManager.h" #ifndef OGRE_LOG_ERROR -#if OGRE_VERSION_MAJOR == 2 +#if AV_OGRE_NEXT_VERSION >= 0x20000 #define OGRE_LOG_ERROR(a) Ogre::LogManager::getSingleton().logMessage(Ogre::LML_CRITICAL, a) #else #define OGRE_LOG_ERROR(a) Ogre::LogManager::getSingleton().logError(a) diff --git a/oggsound/include/OgreOggSoundFactory.h b/oggsound/include/OgreOggSoundFactory.h index 5e93f9b..b7d3cc6 100644 --- a/oggsound/include/OgreOggSoundFactory.h +++ b/oggsound/include/OgreOggSoundFactory.h @@ -42,7 +42,7 @@ namespace OgreOggSound { protected: - #if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR > 0 + #if AV_OGRE_NEXT_VERSION >= 0x20100 Ogre::MovableObject* createInstanceImpl(Ogre::IdType id, Ogre::ObjectMemoryManager *objectMemoryManager, Ogre::SceneManager* manager, const Ogre::NameValuePairList* params = 0); #else Ogre::MovableObject* createInstanceImpl(const Ogre::String& name, const Ogre::NameValuePairList* params); @@ -55,7 +55,7 @@ namespace OgreOggSound const Ogre::String& getType(void) const; - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 void destroyInstance( Ogre::MovableObject* obj); #endif }; diff --git a/oggsound/include/OgreOggSoundManager.h b/oggsound/include/OgreOggSoundManager.h index 5ee2950..6a8cf1a 100644 --- a/oggsound/include/OgreOggSoundManager.h +++ b/oggsound/include/OgreOggSoundManager.h @@ -841,7 +841,7 @@ namespace OgreOggSound OgreOggISound* _createSoundImpl( const Ogre::String& name, - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::IdType id, #endif const Ogre::String& file, diff --git a/oggsound/include/OgreOggSoundPrereqs.h.in b/oggsound/include/OgreOggSoundPrereqs.h.in index e58dbef..7e18ee9 100644 --- a/oggsound/include/OgreOggSoundPrereqs.h.in +++ b/oggsound/include/OgreOggSoundPrereqs.h.in @@ -35,6 +35,19 @@ #include #include +// set AV_OGRE_NEXT_VERSION to easy check Ogre version +// using separate define to avoid issue with `#define OGRE_NEXT_VERSION 0` +// and code using `#ifndef OGRE_NEXT_VERSION` to detect Ogre legacy +#ifdef OGRE_NEXT_VERSION + #define AV_OGRE_NEXT_VERSION OGRE_NEXT_VERSION +#else + #if OGRE_VERSION_MAJOR == 2 + #define AV_OGRE_NEXT_VERSION OGRE_VERSION + #else + #define AV_OGRE_NEXT_VERSION 0 + #endif +#endif + /** * OGGSOUND_THREADED: Specifies whether to use threads for streaming * 0 - No multithreading diff --git a/oggsound/include/OgreOggStaticSound.h b/oggsound/include/OgreOggStaticSound.h index b874cc2..41bbc5d 100644 --- a/oggsound/include/OgreOggStaticSound.h +++ b/oggsound/include/OgreOggStaticSound.h @@ -91,7 +91,7 @@ namespace OgreOggSound */ OgreOggStaticSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); diff --git a/oggsound/include/OgreOggStaticWavSound.h b/oggsound/include/OgreOggStaticWavSound.h index c8cb4aa..31942ec 100644 --- a/oggsound/include/OgreOggStaticWavSound.h +++ b/oggsound/include/OgreOggStaticWavSound.h @@ -128,7 +128,7 @@ namespace OgreOggSound */ OgreOggStaticWavSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); diff --git a/oggsound/include/OgreOggStreamBufferSound.h b/oggsound/include/OgreOggStreamBufferSound.h index 10d3c25..2c11f15 100644 --- a/oggsound/include/OgreOggStreamBufferSound.h +++ b/oggsound/include/OgreOggStreamBufferSound.h @@ -95,7 +95,7 @@ namespace OgreOggSound */ OgreOggStreamBufferSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); diff --git a/oggsound/include/OgreOggStreamSound.h b/oggsound/include/OgreOggStreamSound.h index 2383106..a2d702f 100644 --- a/oggsound/include/OgreOggStreamSound.h +++ b/oggsound/include/OgreOggStreamSound.h @@ -108,7 +108,7 @@ namespace OgreOggSound */ OgreOggStreamSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); diff --git a/oggsound/include/OgreOggStreamWavSound.h b/oggsound/include/OgreOggStreamWavSound.h index 956b710..5bce123 100644 --- a/oggsound/include/OgreOggStreamWavSound.h +++ b/oggsound/include/OgreOggStreamWavSound.h @@ -108,7 +108,7 @@ namespace OgreOggSound */ OgreOggStreamWavSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ); diff --git a/oggsound/src/OgreOggISound.cpp b/oggsound/src/OgreOggISound.cpp index 26771b5..cdaff73 100644 --- a/oggsound/src/OgreOggISound.cpp +++ b/oggsound/src/OgreOggISound.cpp @@ -74,11 +74,11 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggISound::OgreOggISound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : - #if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR > 0 + #if AV_OGRE_NEXT_VERSION >= 0x20100 MovableObject(id, objMemMgr, scnMgr, renderQueueId), mPosition(0,0,0), mDirection(0,0,0), @@ -115,7 +115,7 @@ namespace OgreOggSound ,mAudioOffset(0) ,mAudioEnd(0) ,mLoopOffset(0) - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 ,mLocalTransformDirty(true) #endif ,mDisable3D(false) @@ -132,7 +132,7 @@ namespace OgreOggSound mOggCallbacks.seek_func = OOSStreamSeek; mOggCallbacks.tell_func = OOSStreamTell; mBuffers.reset(); - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 setLocalAabb(Ogre::Aabb::BOX_NULL); setQueryFlags(0); #endif @@ -143,7 +143,7 @@ namespace OgreOggSound OgreOggSoundManager::getSingletonPtr()->_releaseSoundImpl(this); } /*/////////////////////////////////////////////////////////////////*/ - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::String OgreOggISound::getName() { return mName; } @@ -657,7 +657,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ void OgreOggISound::update(float fTime) { - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 if (mLocalTransformDirty) { Ogre::Vector3 position(0, 0, 0); @@ -717,7 +717,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ void OgreOggISound::_notifyAttached( Ogre::Node* node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , bool isTagPoint #endif ) @@ -725,12 +725,12 @@ namespace OgreOggSound // Call base class notify Ogre::MovableObject::_notifyAttached( node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , isTagPoint #endif ); - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 // Immediately set position/orientation when attached mLocalTransformDirty = true; #endif @@ -740,7 +740,7 @@ namespace OgreOggSound return; } /*/////////////////////////////////////////////////////////////////*/ - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 void OgreOggISound::_notifyMoved(void) { // Call base class notify @@ -752,7 +752,7 @@ namespace OgreOggSound void OgreOggISound::_updateRenderQueue(Ogre::RenderQueue *queue, Ogre::Camera *camera, const Ogre::Camera *lodCamera) { } #endif - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 /*/////////////////////////////////////////////////////////////////*/ void OgreOggISound::visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables) { diff --git a/oggsound/src/OgreOggListener.cpp b/oggsound/src/OgreOggListener.cpp index 4baf1b7..4134fbf 100644 --- a/oggsound/src/OgreOggListener.cpp +++ b/oggsound/src/OgreOggListener.cpp @@ -43,7 +43,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ void OgreOggListener::update() { - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 if(mLocalTransformDirty) { if ( mParentNode ) @@ -111,7 +111,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ void OgreOggListener::_notifyAttached( Ogre::Node* node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , bool isTagPoint #endif ) @@ -119,7 +119,7 @@ namespace OgreOggSound // Call base class notify Ogre::MovableObject::_notifyAttached( node - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 , isTagPoint #endif ); @@ -127,7 +127,7 @@ namespace OgreOggSound // Immediately set position/orientation when attached if (mParentNode) { - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 mLocalTransformDirty = true; #endif update(); @@ -136,7 +136,7 @@ namespace OgreOggSound return; } /*/////////////////////////////////////////////////////////////////*/ - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 void OgreOggListener::_notifyMoved(void) { // Call base class notify diff --git a/oggsound/src/OgreOggSoundFactory.cpp b/oggsound/src/OgreOggSoundFactory.cpp index 949d369..b39b1fe 100644 --- a/oggsound/src/OgreOggSoundFactory.cpp +++ b/oggsound/src/OgreOggSoundFactory.cpp @@ -43,14 +43,14 @@ namespace OgreOggSound return FACTORY_TYPE_NAME; } //----------------------------------------------------------------------- - #if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR > 0 + #if AV_OGRE_NEXT_VERSION >= 0x20100 Ogre::MovableObject* OgreOggSoundFactory::createInstanceImpl(Ogre::IdType id, Ogre::ObjectMemoryManager *objectMemoryManager, Ogre::SceneManager* manager, const Ogre::NameValuePairList* params) #else Ogre::MovableObject* OgreOggSoundFactory::createInstanceImpl(const Ogre::String& name, const Ogre::NameValuePairList* params) #endif { Ogre::String fileName; - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::String reName = Ogre::BLANKSTRING; #else Ogre::String reName = name; @@ -113,7 +113,7 @@ namespace OgreOggSound "OgreOggSoundFactory::createInstance"); } - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 return OgreOggSoundManager::getSingletonPtr()->_createSoundImpl(reName, id, fileName, stream, loop, preBuffer, immediate); #else return OgreOggSoundManager::getSingletonPtr()->_createSoundImpl(reName, fileName, stream, loop, preBuffer, immediate); @@ -123,7 +123,7 @@ namespace OgreOggSound return 0; } -#if OGRE_VERSION_MAJOR == 2 +#if AV_OGRE_NEXT_VERSION >= 0x20000 void OgreOggSoundFactory::destroyInstance( Ogre::MovableObject* obj) { if ( dynamic_cast(obj) ) diff --git a/oggsound/src/OgreOggSoundManager.cpp b/oggsound/src/OgreOggSoundManager.cpp index f75f505..4f0092b 100644 --- a/oggsound/src/OgreOggSoundManager.cpp +++ b/oggsound/src/OgreOggSoundManager.cpp @@ -208,7 +208,7 @@ namespace OgreOggSound mDevice=0; // trying to make sure the scene manager is still there - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 if ( mListener && !Ogre::Root::getSingleton().getSceneManagers().empty()) #else if ( mListener ) @@ -324,7 +324,7 @@ namespace OgreOggSound // If no manager specified - grab first one if ( !scnMgr ) { - #if OGRE_VERSION_MAJOR != 2 + #if AV_OGRE_NEXT_VERSION < 0x20000 auto& inst = Ogre::Root::getSingletonPtr()->getSceneManagers(); if ( !inst.empty() ) mSceneMgr = inst.begin()->second; @@ -515,7 +515,7 @@ namespace OgreOggSound try { sound = static_cast( - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 scnMgr->createMovableObject( OgreOggSoundFactory::FACTORY_TYPE_NAME, &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), ¶ms ) #else scnMgr->createMovableObject( name, OgreOggSoundFactory::FACTORY_TYPE_NAME, ¶ms ) @@ -537,7 +537,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggISound* OgreOggSoundManager::_createSoundImpl( const Ogre::String& name, - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::IdType id, #endif const Ogre::String& file, @@ -555,14 +555,14 @@ namespace OgreOggSound return 0; } -#if OGRE_VERSION_MAJOR == 2 +#if AV_OGRE_NEXT_VERSION >= 0x20000 auto scnMgr = mSceneMgr; #endif if ( file == "BUFFER" ) { sound = OGRE_NEW_T(OgreOggStreamBufferSound, Ogre::MEMCATEGORY_GENERAL)( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, Ogre::Id::generateNewId(), &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 #endif ); @@ -588,14 +588,14 @@ namespace OgreOggSound if(stream) sound = OGRE_NEW_T(OgreOggStreamSound, Ogre::MEMCATEGORY_GENERAL)( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, Ogre::Id::generateNewId(), &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 #endif ); else sound = OGRE_NEW_T(OgreOggStaticSound, Ogre::MEMCATEGORY_GENERAL)( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, Ogre::Id::generateNewId(), &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 #endif ); @@ -638,14 +638,14 @@ namespace OgreOggSound if(stream) sound = OGRE_NEW_T(OgreOggStreamWavSound, Ogre::MEMCATEGORY_GENERAL)( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, Ogre::Id::generateNewId(), &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 #endif ); else sound = OGRE_NEW_T(OgreOggStaticWavSound, Ogre::MEMCATEGORY_GENERAL)( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, Ogre::Id::generateNewId(), &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 #endif ); @@ -693,7 +693,7 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggListener* OgreOggSoundManager::_createListener() { - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 OgreOggListener* l = OGRE_NEW_T(OgreOggListener, Ogre::MEMCATEGORY_GENERAL)(Ogre::Id::generateNewId(), mSceneMgr, &(mSceneMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), 0 ); #else OgreOggListener* l = OGRE_NEW_T(OgreOggListener, Ogre::MEMCATEGORY_GENERAL)(mSceneMgr); diff --git a/oggsound/src/OgreOggStaticSound.cpp b/oggsound/src/OgreOggStaticSound.cpp index 6b6a6bb..ccccb46 100644 --- a/oggsound/src/OgreOggStaticSound.cpp +++ b/oggsound/src/OgreOggStaticSound.cpp @@ -38,12 +38,12 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggStaticSound::OgreOggStaticSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : OgreOggISound( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, id, objMemMgr, renderQueueId #endif ) diff --git a/oggsound/src/OgreOggStaticWavSound.cpp b/oggsound/src/OgreOggStaticWavSound.cpp index b94adec..688c36d 100644 --- a/oggsound/src/OgreOggStaticWavSound.cpp +++ b/oggsound/src/OgreOggStaticWavSound.cpp @@ -39,12 +39,12 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggStaticWavSound::OgreOggStaticWavSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : OgreOggISound( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, id, objMemMgr, renderQueueId #endif ) diff --git a/oggsound/src/OgreOggStreamBufferSound.cpp b/oggsound/src/OgreOggStreamBufferSound.cpp index 568dc02..23a7cda 100644 --- a/oggsound/src/OgreOggStreamBufferSound.cpp +++ b/oggsound/src/OgreOggStreamBufferSound.cpp @@ -39,12 +39,12 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggStreamBufferSound::OgreOggStreamBufferSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : OgreOggISound( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, id, objMemMgr, renderQueueId #endif ) diff --git a/oggsound/src/OgreOggStreamSound.cpp b/oggsound/src/OgreOggStreamSound.cpp index e2fab6b..d8a6bcc 100644 --- a/oggsound/src/OgreOggStreamSound.cpp +++ b/oggsound/src/OgreOggStreamSound.cpp @@ -38,12 +38,12 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggStreamSound::OgreOggStreamSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : OgreOggISound( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, id, objMemMgr, renderQueueId #endif ) diff --git a/oggsound/src/OgreOggStreamWavSound.cpp b/oggsound/src/OgreOggStreamWavSound.cpp index c552c57..984cc96 100644 --- a/oggsound/src/OgreOggStreamWavSound.cpp +++ b/oggsound/src/OgreOggStreamWavSound.cpp @@ -39,12 +39,12 @@ namespace OgreOggSound /*/////////////////////////////////////////////////////////////////*/ OgreOggStreamWavSound::OgreOggStreamWavSound( const Ogre::String& name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , Ogre::SceneManager* scnMgr, Ogre::IdType id, Ogre::ObjectMemoryManager *objMemMgr, Ogre::uint8 renderQueueId #endif ) : OgreOggISound( name - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 , scnMgr, id, objMemMgr, renderQueueId #endif ) diff --git a/theoravideo/include/OgreVideoManager.h b/theoravideo/include/OgreVideoManager.h index f6775ca..1e97594 100644 --- a/theoravideo/include/OgreVideoManager.h +++ b/theoravideo/include/OgreVideoManager.h @@ -10,6 +10,20 @@ the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php #ifndef _OgreVideoManager_h #define _OgreVideoManager_h +#include +// set AV_OGRE_NEXT_VERSION to easy check Ogre version +// using separate define to avoid issue with `#define OGRE_NEXT_VERSION 0` +// and code using `#ifndef OGRE_NEXT_VERSION` to detect Ogre legacy +#ifdef OGRE_NEXT_VERSION + #define AV_OGRE_NEXT_VERSION OGRE_NEXT_VERSION +#else + #if OGRE_VERSION_MAJOR == 2 + #define AV_OGRE_NEXT_VERSION OGRE_VERSION + #else + #define AV_OGRE_NEXT_VERSION 0 + #endif +#endif + #include #include @@ -91,7 +105,7 @@ namespace Ogre private: struct ClipTexture { TheoraVideoClip* clip; - #if OGRE_VERSION_MAJOR == 2 and OGRE_VERSION_MINOR >= 2 + #if AV_OGRE_NEXT_VERSION >= 0x20200 TextureGpu* texture; #else TexturePtr texture; @@ -114,7 +128,12 @@ namespace Ogre static OgreVideoManager* mVideoMgr; public: const String& getName() const; + #if AV_OGRE_NEXT_VERSION > 0x30000 + void getAbiCookie(AbiCookie &outAbiCookie); + void install(const NameValuePairList *options); + #else void install(); + #endif void uninstall() {} void initialise() {} void shutdown(); diff --git a/theoravideo/src/OgreVideoDLLmain.cpp b/theoravideo/src/OgreVideoDLLmain.cpp index a28f4dc..d7186a0 100644 --- a/theoravideo/src/OgreVideoDLLmain.cpp +++ b/theoravideo/src/OgreVideoDLLmain.cpp @@ -19,7 +19,7 @@ namespace Ogre extern "C" void _OgreTheoraExport dllStartPlugin() { theoraVideoPlugin = new OgreVideoPlugin(); - Root::getSingleton().installPlugin(theoraVideoPlugin); + Root::getSingleton().installPlugin(theoraVideoPlugin, nullptr); } extern "C" void _OgreTheoraExport dllStopPlugin() diff --git a/theoravideo/src/OgreVideoManager.cpp b/theoravideo/src/OgreVideoManager.cpp index afb3674..a228b0a 100644 --- a/theoravideo/src/OgreVideoManager.cpp +++ b/theoravideo/src/OgreVideoManager.cpp @@ -12,7 +12,7 @@ the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php #include "OgreVideoManager.h" #include "OgreTheoraDataStream.h" -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 2 +#if AV_OGRE_NEXT_VERSION >= 0x20200 #include #include #include @@ -32,13 +32,17 @@ the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php #include "TheoraTimer.h" #include -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 1 +#if AV_OGRE_NEXT_VERSION >= 0x20100 #include #include #include using namespace Ogre::v1; #endif +#if AV_OGRE_NEXT_VERSION > 0x30000 +#include +#endif + namespace Ogre { int nextPow2(int x) @@ -81,7 +85,7 @@ namespace Ogre createVideoTexture(mInputFileName, material_name, group_name, group_name); } -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 1 +#if AV_OGRE_NEXT_VERSION >= 0x20100 static void fillTexture(TextureGpu* texture, const uint8* data, int xSize, int ySize) { TextureGpuManager *textureMgr = Root::getSingletonPtr()->getRenderSystem()->getTextureGpuManager(); StagingTexture *stagingTexture = textureMgr->getStagingTexture( xSize, ySize, 1, 1, PFG_RGBA8_UNORM ); @@ -114,7 +118,7 @@ namespace Ogre Matrix4 mat=Matrix4::IDENTITY; mat.setScale(Vector3((float) clip->getWidth()/(w + 0.5), (float) clip->getHeight()/(h + 0.5),1)); -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 2 +#if AV_OGRE_NEXT_VERSION >= 0x20200 TextureGpuManager *textureMgr = Root::getSingletonPtr()->getRenderSystem()->getTextureGpuManager(); TextureGpu* t = textureMgr->createOrRetrieveTexture( name, @@ -151,12 +155,12 @@ namespace Ogre mClipsTextures[name]={clip,t}; -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 1 +#if AV_OGRE_NEXT_VERSION >= 0x20100 // set it in a datablock HlmsUnlitDatablock* ogreDatablock = static_cast( Root::getSingletonPtr()->getHlmsManager()->getHlms(HLMS_UNLIT)->getDatablock(material_name) ); - #if OGRE_VERSION_MINOR >= 2 + #if AV_OGRE_NEXT_VERSION >= 0x20200 ogreDatablock->setTexture( 0, name ); #else ogreDatablock->setTexture( 0, 0, t ); @@ -216,7 +220,7 @@ namespace Ogre { int w=f->getStride(),h=f->getHeight(); -#if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR >= 1 +#if AV_OGRE_NEXT_VERSION >= 0x20100 fillTexture(it->second.texture, reinterpret_cast(f->getBuffer()), w, h); #else unsigned char *texData=(unsigned char*) it->second.texture->getBuffer()->lock(HardwareBuffer::HBL_DISCARD); @@ -260,10 +264,15 @@ namespace Ogre static String name = "TheoraVideoPlugin"; return name; } - void OgreVideoPlugin::install() + void OgreVideoPlugin::install + ( + #if AV_OGRE_NEXT_VERSION > 0x30000 + const NameValuePairList *options + #endif + ) { if (mVideoMgr) { - #if OGRE_VERSION_MAJOR == 2 + #if AV_OGRE_NEXT_VERSION >= 0x20000 Ogre::LogManager::getSingleton().logMessage(Ogre::LML_CRITICAL, "OgreVideoPlugin was already been initialized ... ignoring next initialise of plugin" ); @@ -289,5 +298,11 @@ namespace Ogre delete mVideoMgr; mVideoMgr = 0; } + #if AV_OGRE_NEXT_VERSION > 0x30000 + void OgreVideoPlugin::getAbiCookie(AbiCookie &outAbiCookie) + { + outAbiCookie = generateAbiCookie(); + } + #endif } // end namespace Ogre