diff -r 9c3803e890e3 OgreMain/CMakeLists.txt --- a/OgreMain/CMakeLists.txt Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/CMakeLists.txt Sat Jun 15 16:45:04 2013 +0200 @@ -217,6 +217,7 @@ include/OgreShadowTextureManager.h include/OgreShadowVolumeExtrudeProgram.h include/OgreSharedPtr.h + include/OgreSharedPtrSpecialisation.h src/OgreSIMDHelper.h include/OgreSimpleRenderable.h include/OgreSimpleSpline.h @@ -416,6 +417,7 @@ src/OgreShadowCaster.cpp src/OgreShadowTextureManager.cpp src/OgreShadowVolumeExtrudeProgram.cpp + src/OgreSharedPtrSpecialisation.cpp src/OgreSimpleRenderable.cpp src/OgreSimpleSpline.cpp src/OgreSkeleton.cpp diff -r 9c3803e890e3 OgreMain/include/OgreEntity.h --- a/OgreMain/include/OgreEntity.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreEntity.h Sat Jun 15 16:45:04 2013 +0200 @@ -36,7 +36,7 @@ #include "OgreQuaternion.h" #include "OgreVector3.h" #include "OgreHardwareBufferManager.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreRenderable.h" #include "OgreResourceGroupManager.h" #include "OgreHeaderPrefix.h" diff -r 9c3803e890e3 OgreMain/include/OgreInstanceBatch.h --- a/OgreMain/include/OgreInstanceBatch.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreInstanceBatch.h Sat Jun 15 16:45:04 2013 +0200 @@ -32,7 +32,7 @@ #include "OgreRenderOperation.h" #include "OgreRenderable.h" #include "OgreMovableObject.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreHeaderPrefix.h" namespace Ogre diff -r 9c3803e890e3 OgreMain/include/OgreInstanceManager.h --- a/OgreMain/include/OgreInstanceManager.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreInstanceManager.h Sat Jun 15 16:45:04 2013 +0200 @@ -29,7 +29,7 @@ #define __InstanceManager_H__ #include "OgrePrerequisites.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreRenderOperation.h" #include "OgreHeaderPrefix.h" diff -r 9c3803e890e3 OgreMain/include/OgreInstancedGeometry.h --- a/OgreMain/include/OgreInstancedGeometry.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreInstancedGeometry.h Sat Jun 15 16:45:04 2013 +0200 @@ -36,7 +36,7 @@ #include "OgreAnimationTrack.h" #include "OgreBone.h" #include "OgreIteratorWrappers.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreHeaderPrefix.h" namespace Ogre { diff -r 9c3803e890e3 OgreMain/include/OgreLodConfig.h --- a/OgreMain/include/OgreLodConfig.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreLodConfig.h Sat Jun 15 16:45:04 2013 +0200 @@ -30,7 +30,7 @@ #define __LogConfig_H_ #include "OgrePrerequisites.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreLodStrategy.h" namespace Ogre diff -r 9c3803e890e3 OgreMain/include/OgreLodStrategy.h --- a/OgreMain/include/OgreLodStrategy.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreLodStrategy.h Sat Jun 15 16:45:04 2013 +0200 @@ -30,7 +30,7 @@ #include "OgrePrerequisites.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreMovableObject.h" #include "OgreCamera.h" diff -r 9c3803e890e3 OgreMain/include/OgreMesh.h --- a/OgreMain/include/OgreMesh.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreMesh.h Sat Jun 15 16:45:04 2013 +0200 @@ -42,7 +42,7 @@ #include "OgrePose.h" #include "OgreDataStream.h" #include "OgreHeaderPrefix.h" - +//#include "OgreSharedPtrSpecialisation.h" namespace Ogre { @@ -942,26 +942,6 @@ }; - /** Specialisation of SharedPtr to allow SharedPtr to be assigned to MeshPtr - @note Has to be a subclass since we need operator=. - We could templatise this instead of repeating per Resource subclass, - except to do so requires a form VC6 does not support i.e. - ResourceSubclassPtr : public SharedPtr - */ - class _OgreExport MeshPtr : public SharedPtr - { - public: - MeshPtr() : SharedPtr() {} - explicit MeshPtr(Mesh* rep) : SharedPtr(rep) {} - MeshPtr(const MeshPtr& r) : SharedPtr(r) {} - MeshPtr(const ResourcePtr& r); - /// Operator used to convert a ResourcePtr to a MeshPtr. - MeshPtr& operator=(const ResourcePtr& r); - protected: - /// Override destroy since we need to delete Mesh after fully defined. - void destroy(void); - }; - /** A way of recording the way each LODs is recorded this Mesh. */ struct MeshLodUsage { diff -r 9c3803e890e3 OgreMain/include/OgreMeshManager.h --- a/OgreMain/include/OgreMeshManager.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreMeshManager.h Sat Jun 15 16:45:04 2013 +0200 @@ -34,7 +34,7 @@ #include "OgreSingleton.h" #include "OgreVector3.h" #include "OgreHardwareBuffer.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgrePatchMesh.h" #include "OgreHeaderPrefix.h" diff -r 9c3803e890e3 OgreMain/include/OgreMeshSerializerImpl.h --- a/OgreMain/include/OgreMeshSerializerImpl.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreMeshSerializerImpl.h Sat Jun 15 16:45:04 2013 +0200 @@ -33,7 +33,7 @@ #include "OgreString.h" #include "OgreSerializer.h" #include "OgreMaterial.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreEdgeListBuilder.h" namespace Ogre { diff -r 9c3803e890e3 OgreMain/include/OgreNode.h --- a/OgreMain/include/OgreNode.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreNode.h Sat Jun 15 16:45:04 2013 +0200 @@ -37,7 +37,7 @@ #include "OgreString.h" #include "OgreRenderable.h" #include "OgreIteratorWrappers.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreUserObjectBindings.h" #include "OgreHeaderPrefix.h" diff -r 9c3803e890e3 OgreMain/include/OgrePatchMesh.h --- a/OgreMain/include/OgrePatchMesh.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgrePatchMesh.h Sat Jun 15 16:45:04 2013 +0200 @@ -29,7 +29,7 @@ #define __PatchMesh_H__ #include "OgrePrerequisites.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgrePatchSurface.h" namespace Ogre { diff -r 9c3803e890e3 OgreMain/include/OgreProgressiveMeshGenerator.h --- a/OgreMain/include/OgreProgressiveMeshGenerator.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreProgressiveMeshGenerator.h Sat Jun 15 16:45:04 2013 +0200 @@ -32,7 +32,7 @@ #include "OgrePrerequisites.h" #include "OgreVector3.h" #include "OgreSmallVector.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreLodConfig.h" namespace Ogre diff -r 9c3803e890e3 OgreMain/include/OgreSharedPtrSpecialisation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OgreMain/include/OgreSharedPtrSpecialisation.h Sat Jun 15 16:45:04 2013 +0200 @@ -0,0 +1,52 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OGRE + (Object-oriented Graphics Rendering Engine) +For the latest info, see http://www.ogre3d.org/ + +Copyright (c) 2000-2013 Torus Knot Software Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +----------------------------------------------------------------------------- +*/ +#ifndef __SharedPtrSpecialisation_H__ +#define __SharedPtrSpecialisation_H__ +namespace Ogre { + class Mesh; + /** Specialisation of SharedPtr to allow SharedPtr to be assigned to MeshPtr + @note Has to be a subclass since we need operator=. + We could templatise this instead of repeating per Resource subclass, + except to do so requires a form VC6 does not support i.e. + ResourceSubclassPtr : public SharedPtr + */ + class _OgreExport MeshPtr : public SharedPtr + { + public: + MeshPtr() : SharedPtr() {} + explicit MeshPtr(Mesh* rep) : SharedPtr(rep) {} + MeshPtr(const MeshPtr& r) : SharedPtr(r) {} + MeshPtr(const ResourcePtr& r); + /// Operator used to convert a ResourcePtr to a MeshPtr. + MeshPtr& operator=(const ResourcePtr& r); + protected: + /// Override destroy since we need to delete Mesh after fully defined. + void destroy(void); + }; +} +#endif \ No newline at end of file diff -r 9c3803e890e3 OgreMain/include/OgreStaticGeometry.h --- a/OgreMain/include/OgreStaticGeometry.h Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/include/OgreStaticGeometry.h Sat Jun 15 16:45:04 2013 +0200 @@ -31,7 +31,7 @@ #include "OgrePrerequisites.h" #include "OgreMovableObject.h" #include "OgreRenderable.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" #include "OgreLodStrategy.h" #include "OgreHeaderPrefix.h" diff -r 9c3803e890e3 OgreMain/src/OgreMesh.cpp --- a/OgreMain/src/OgreMesh.cpp Fri Jun 14 01:59:14 2013 -0500 +++ b/OgreMain/src/OgreMesh.cpp Sat Jun 15 16:45:04 2013 +0200 @@ -47,54 +47,7 @@ #include "OgrePixelCountLodStrategy.h" namespace Ogre { - //----------------------------------------------------------------------- - MeshPtr::MeshPtr(const ResourcePtr& r) : SharedPtr() - { - // lock & copy other mutex pointer - OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME) - { - OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME); - OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME); - pRep = static_cast(r.getPointer()); - pUseCount = r.useCountPointer(); - if (pUseCount) - { - ++(*pUseCount); - } - } - } - //----------------------------------------------------------------------- - MeshPtr& MeshPtr::operator=(const ResourcePtr& r) - { - if (pRep == static_cast(r.getPointer())) - return *this; - release(); - // lock & copy other mutex pointer - OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME) - { - OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME); - OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME); - pRep = static_cast(r.getPointer()); - pUseCount = r.useCountPointer(); - if (pUseCount) - { - ++(*pUseCount); - } - } - else - { - // RHS must be a null pointer - assert(r.isNull() && "RHS must be null if it has no mutex!"); - setNull(); - } - return *this; - } - //----------------------------------------------------------------------- - void MeshPtr::destroy(void) - { - // We're only overriding so that we can destroy after full definition of Mesh - SharedPtr::destroy(); - } + //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- diff -r 9c3803e890e3 OgreMain/src/OgreSharedPtrSpecialisation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OgreMain/src/OgreSharedPtrSpecialisation.cpp Sat Jun 15 16:45:04 2013 +0200 @@ -0,0 +1,81 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OGRE + (Object-oriented Graphics Rendering Engine) +For the latest info, see http://www.ogre3d.org/ + +Copyright (c) 2000-2013 Torus Knot Software Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +----------------------------------------------------------------------------- +*/ +#include "OgreStableHeaders.h" +#include "OgreSharedPtrSpecialisation.h" +#include "OgreMesh.h" + +namespace Ogre { + //----------------------------------------------------------------------- + MeshPtr::MeshPtr(const ResourcePtr& r) : SharedPtr() + { + // lock & copy other mutex pointer + OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME) + { + OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME); + OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME); + pRep = static_cast(r.getPointer()); + pUseCount = r.useCountPointer(); + if (pUseCount) + { + ++(*pUseCount); + } + } + } + //----------------------------------------------------------------------- + MeshPtr& MeshPtr::operator=(const ResourcePtr& r) + { + if (pRep == static_cast(r.getPointer())) + return *this; + release(); + // lock & copy other mutex pointer + OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME) + { + OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME); + OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME); + pRep = static_cast(r.getPointer()); + pUseCount = r.useCountPointer(); + if (pUseCount) + { + ++(*pUseCount); + } + } + else + { + // RHS must be a null pointer + assert(r.isNull() && "RHS must be null if it has no mutex!"); + setNull(); + } + return *this; + } + //----------------------------------------------------------------------- + void MeshPtr::destroy(void) + { + // We're only overriding so that we can destroy after full definition of Mesh + SharedPtr::destroy(); + } +} \ No newline at end of file diff -r 9c3803e890e3 Tools/XMLConverter/include/OgreXMLMeshSerializer.h --- a/Tools/XMLConverter/include/OgreXMLMeshSerializer.h Fri Jun 14 01:59:14 2013 -0500 +++ b/Tools/XMLConverter/include/OgreXMLMeshSerializer.h Sat Jun 15 16:45:04 2013 +0200 @@ -30,7 +30,7 @@ #define __XMLMeshSerializer_H__ #include "OgreXMLPrerequisites.h" -#include "OgreMesh.h" +#include "OgreSharedPtrSpecialisation.h" namespace Ogre {